I have no idea what I'm doing.
I have no idea what I'm doinnnn
This commit is contained in:
parent
5a4cfd0a5f
commit
517d9e7383
1 changed files with 63 additions and 50 deletions
113
server.js
113
server.js
|
@ -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,57 +17,69 @@ 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');
|
|
||||||
const client = new Client({ intents: [GatewayIntentBits.Guilds,
|
|
||||||
GatewayIntentBits.GuildMessages,
|
|
||||||
GatewayIntentBits.MessageContent,
|
|
||||||
GatewayIntentBits.GuildMembers,
|
|
||||||
GatewayIntentBits.GuildPresences
|
|
||||||
], partials: [Partials.Channel] });
|
|
||||||
const {
|
|
||||||
globalPrefix,
|
|
||||||
token,
|
|
||||||
loginMessage,
|
|
||||||
loginChannel,
|
|
||||||
enableLoginMessage,
|
|
||||||
owners,
|
|
||||||
presenceType,
|
|
||||||
presenceText
|
|
||||||
} = require('./data/config.json');
|
|
||||||
|
|
||||||
client.settings = new Collection();
|
|
||||||
client.commands = new Collection();
|
|
||||||
client.serverPrefixes = new Collection();
|
|
||||||
|
|
||||||
|
|
||||||
client.settings.set("presenceType", presenceType);
|
|
||||||
client.settings.set("presenceText", presenceText);
|
|
||||||
|
|
||||||
const reloadCommands = require("./util/reloadCommands.js");
|
|
||||||
const onMessage = require('./server/message');
|
|
||||||
const onReady = require('./server/ready');
|
|
||||||
|
|
||||||
reloadCommands(client)
|
|
||||||
|
|
||||||
client.once('ready', () => {
|
|
||||||
onReady(client, enableLoginMessage, loginChannel, loginMessage)
|
|
||||||
});
|
|
||||||
|
|
||||||
client.once('reconnecting', () => {
|
|
||||||
console.log('Reconnecting!');
|
|
||||||
});
|
|
||||||
|
|
||||||
client.once('disconnect', () => {
|
|
||||||
console.log('Disconnect!');
|
|
||||||
});
|
|
||||||
|
|
||||||
client.on('messageCreate', async message => {
|
|
||||||
onMessage(client, owners, message, globalPrefix);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
client.login(token);
|
async function main(){
|
||||||
|
const { Collection, Client, GatewayIntentBits, Partials } = require('discord.js');
|
||||||
|
const client = new Client({ intents: [GatewayIntentBits.Guilds,
|
||||||
|
GatewayIntentBits.GuildMessages,
|
||||||
|
GatewayIntentBits.MessageContent,
|
||||||
|
GatewayIntentBits.GuildMembers,
|
||||||
|
GatewayIntentBits.GuildPresences
|
||||||
|
], partials: [Partials.Channel] });
|
||||||
|
const {
|
||||||
|
globalPrefix,
|
||||||
|
token,
|
||||||
|
loginMessage,
|
||||||
|
loginChannel,
|
||||||
|
enableLoginMessage,
|
||||||
|
owners,
|
||||||
|
presenceType,
|
||||||
|
presenceText
|
||||||
|
} = require('./data/config.json');
|
||||||
|
|
||||||
|
client.settings = new Collection();
|
||||||
|
client.commands = new Collection();
|
||||||
|
client.serverPrefixes = new Collection();
|
||||||
|
|
||||||
|
|
||||||
|
client.settings.set("presenceType", presenceType);
|
||||||
|
client.settings.set("presenceText", presenceText);
|
||||||
|
|
||||||
|
const reloadCommands = require("./util/reloadCommands.js");
|
||||||
|
const onMessage = require('./server/message');
|
||||||
|
const onReady = require('./server/ready');
|
||||||
|
|
||||||
|
reloadCommands(client)
|
||||||
|
|
||||||
|
client.once('ready', () => {
|
||||||
|
onReady(client, enableLoginMessage, loginChannel, loginMessage)
|
||||||
|
});
|
||||||
|
|
||||||
|
client.once('reconnecting', () => {
|
||||||
|
console.log('Reconnecting!');
|
||||||
|
});
|
||||||
|
|
||||||
|
client.once('disconnect', () => {
|
||||||
|
console.log('Disconnect!');
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('messageCreate', async message => {
|
||||||
|
onMessage(client, owners, message, globalPrefix);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
client.login(token);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function prepareBot(){
|
||||||
|
const createLastfmTable = require('./server/createDatabaseTables/createLastfmTable');
|
||||||
|
await createLastfmTable();
|
||||||
|
await checkAndConvertJSONToSQL();
|
||||||
|
main();
|
||||||
|
}
|
||||||
|
|
||||||
|
prepareBot();
|
||||||
|
|
Loading…
Add table
Reference in a new issue