File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,13 +25,13 @@ console.log(`server invite link: https://discord.com/oauth2/authorize?client_id=
2525
2626// Create a new client instance
2727const client = new Client ( {
28- intents : [
29- GatewayIntentBits . Guilds ,
30- GatewayIntentBits . GuildMessages ,
31- GatewayIntentBits . GuildMembers ,
32- GatewayIntentBits . GuildMessageReactions ,
33- GatewayIntentBits . MessageContent
34- ]
28+ intents : [
29+ GatewayIntentBits . Guilds ,
30+ GatewayIntentBits . GuildMessages ,
31+ GatewayIntentBits . GuildMembers ,
32+ GatewayIntentBits . GuildMessageReactions ,
33+ GatewayIntentBits . MessageContent
34+ ]
3535} ) ;
3636
3737client . commands = new Collection ( ) ;
Original file line number Diff line number Diff line change @@ -4,20 +4,8 @@ const process = require('node:process');
44
55const sequelize = setupDatabase ( ) ;
66
7- sequelize . sync ( ) . then ( ( ) => {
8- logger . info ( 'sequelize synced' ) ;
9- } ) . catch ( ( ) => {
10- logger . fatal ( 'sequelize instance could not be synced' ) ;
11- process . exit ( ) ;
12- } ) ;
13-
147const User = sequelize . models . User ;
158const Guild = sequelize . models . Guild ;
169const Score = sequelize . models . Score ;
1710
18- ( async ( ) => {
19- const scores = await Score . findAll ( { } ) ;
20- if ( ! scores . length ) logger . warn ( 'database is empty' ) ;
21- } ) ( ) ;
22-
2311module . exports = { User, Guild, Score }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const env = process.env.NODE_ENV || 'development';
66const { logger } = require ( '../logger.js' ) ;
77const config = require ( './config.js' ) [ env ] ;
88
9- async function setupDatabase ( ) {
9+ function setupDatabase ( ) {
1010 logger . info ( `Setting up ${ env } Database` ) ;
1111 // defaults to the devleopment database
1212 const sequelize = new Sequelize (
@@ -26,15 +26,7 @@ async function setupDatabase() {
2626 Score . belongsTo ( User ) ;
2727 Guild . hasMany ( Score ) ;
2828 Score . belongsTo ( Guild ) ;
29-
30- // testing environment needs to be renewed each time the database is initalized as opposed to a
31- // production environment.
32- if ( env == "test" ) {
33- await sequelize . sync ( { force : true } ) ;
34- } else {
35- await sequelize . sync ( ) ;
36- }
37-
29+
3830 return sequelize ;
3931} ;
4032
Original file line number Diff line number Diff line change 11const { Events, ActivityType } = require ( 'discord.js' ) ;
22const { logger } = require ( '../logger' )
33
4- // runs when the bot is logged into discord.
54module . exports = {
65 name :Events . ClientReady ,
76 once : true ,
87 execute ( client ) {
98 logger . info ( `Logged in as ${ client . user . tag } ` ) ;
109 client . user . setActivity ( 'https://youtu.be/q2FYfDpEpGc' , { type : ActivityType . Watching } ) ;
1110 }
12- } ;
11+ } ;
You can’t perform that action at this time.
0 commit comments