I have no idea what I'm doing.
All checks were successful
CI / CI (push) Successful in 17s
Lint Codebase / eslint (push) Successful in 12s

I have no idea what I'm doinnnn
This commit is contained in:
SileNce5k 2024-11-06 04:06:34 +01:00
parent 5a4cfd0a5f
commit 80fd096d0a
Signed by: SileNce
GPG key ID: B0A142BB4291B204

View file

@ -1,6 +1,7 @@
const fs = require('fs'); const fs = require('fs');
const createInitialConfig = require("./util/createInitialConfig") const createInitialConfig = require("./util/createInitialConfig")
const convertTimerJSONToSQL = require('./util/timer/convertTimerJSONToSQL.js'); const convertTimerJSONToSQL = require('./util/timer/convertTimerJSONToSQL.js');
const createTimerTables = require('./server/createDatabaseTables/createTimersTable');
if(!fs.existsSync("./data/config.json")) { if(!fs.existsSync("./data/config.json")) {
createInitialConfig(); createInitialConfig();
} }
@ -16,18 +17,19 @@ async function checkAndConvertJSONToSQL(){
process.stdout.write(false + "\n") process.stdout.write(false + "\n")
} }
} }
const createTimerTables = require('./server/createDatabaseTables/createTimersTable');
const createLastfmTable = require('./server/createDatabaseTables/createLastfmTable');
createLastfmTable();
checkAndConvertJSONToSQL();
const { Collection, Client, GatewayIntentBits, Partials } = require('discord.js'); function main(){
const client = new Client({ intents: [GatewayIntentBits.Guilds, const { Collection, Client, GatewayIntentBits, Partials } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent, GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences GatewayIntentBits.GuildPresences
], partials: [Partials.Channel] }); ], partials: [Partials.Channel] });
const { const {
globalPrefix, globalPrefix,
token, token,
loginMessage, loginMessage,
@ -36,37 +38,50 @@ const {
owners, owners,
presenceType, presenceType,
presenceText presenceText
} = require('./data/config.json'); } = require('./data/config.json');
client.settings = new Collection(); client.settings = new Collection();
client.commands = new Collection(); client.commands = new Collection();
client.serverPrefixes = new Collection(); client.serverPrefixes = new Collection();
client.settings.set("presenceType", presenceType); client.settings.set("presenceType", presenceType);
client.settings.set("presenceText", presenceText); client.settings.set("presenceText", presenceText);
const reloadCommands = require("./util/reloadCommands.js"); const reloadCommands = require("./util/reloadCommands.js");
const onMessage = require('./server/message'); const onMessage = require('./server/message');
const onReady = require('./server/ready'); const onReady = require('./server/ready');
reloadCommands(client) reloadCommands(client)
client.once('ready', () => { client.once('ready', () => {
onReady(client, enableLoginMessage, loginChannel, loginMessage) onReady(client, enableLoginMessage, loginChannel, loginMessage)
}); });
client.once('reconnecting', () => { client.once('reconnecting', () => {
console.log('Reconnecting!'); console.log('Reconnecting!');
}); });
client.once('disconnect', () => { client.once('disconnect', () => {
console.log('Disconnect!'); console.log('Disconnect!');
}); });
client.on('messageCreate', async message => { client.on('messageCreate', async message => {
onMessage(client, owners, message, globalPrefix); onMessage(client, owners, message, globalPrefix);
});
client.login(token);
}
async function prepareBot(){
const createLastfmTable = require('./server/createDatabaseTables/createLastfmTable');
await checkAndConvertJSONToSQL();
await createLastfmTable();
await checkAndConvertJSONToSQL();
}
prepareBot().then( () => {
main();
}); });
client.login(token);