Skip to content

Commit 872774b

Browse files
committed
Improved Code...
1 parent 2ce4b5d commit 872774b

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

events/guildCreate.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,12 @@ var con = mysql.createPool({
1717

1818
const dbquery = util.promisify(con.query).bind(con);
1919

20-
module.exports = new Event("guildCreate", async(client) => {
20+
module.exports = new Event("guildCreate", async(client, guild) => {
2121
try {
22-
console.log(yellow(`[LOGIN] logged in as ${client.user.tag} -> Version ${version}`))
2322

24-
//ACTIVITY
25-
let status_state = 0;
26-
setInterval(() => {
27-
let status_presences = [
28-
{ type: 'PLAYING', message: 'Version: ' + version },
29-
{ type: 'LISTENING', message: '@' + client.user.tag },
30-
];
31-
status_state = (status_state + 1) % status_presences.length;
32-
status_presence = status_presences[status_state];
33-
client.user.setActivity(status_presence.message, { type: status_presence.type });
34-
}, 5000);
23+
await dbquery(`INSERT INTO guilds (guildid) VALUES ('${guild.id}')`);
3524

3625
} catch (error) {
37-
return console.log(red(`[EVENT] In the event ready an error has occurred -> ${error}`))
26+
return console.log(error);
3827
}
3928
});

events/interactionCreate.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const Event = require("../structures/event.js");
2-
const { red } = require('chalk');
32

43
module.exports = new Event("interactionCreate", async(client, interaction) => {
54
try {
65

76
} catch (error) {
8-
return console.log(red(`[EVENT] In the event interactionCreate an error has occurred -> ${error}`))
7+
return console.log(error);
98
}
109
});

events/ready.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ module.exports = new Event("ready", async(client) => {
3434
}, 5000);
3535

3636
} catch (error) {
37-
return console.log(red(`[EVENT] In the event ready an error has occurred -> ${error}`))
37+
return console.log(error);
3838
}
3939
});

0 commit comments

Comments
 (0)