aboutsummaryrefslogtreecommitdiff
path: root/bot/src/events
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-03-29 11:42:40 -0400
committerAndrew Lee <andrew@alee14.me>2025-03-29 11:42:40 -0400
commitf18f5fff1fd0b8336df464d6e6f62efbc29aa618 (patch)
treecc23d2aa33ccb9dcd67f6bda811e5f32b0edc766 /bot/src/events
parent879c2a05c86682564f1f68aa234fd8e5298e95f6 (diff)
downloadAleeBot-f18f5fff1fd0b8336df464d6e6f62efbc29aa618.tar.gz
AleeBot-f18f5fff1fd0b8336df464d6e6f62efbc29aa618.tar.bz2
AleeBot-f18f5fff1fd0b8336df464d6e6f62efbc29aa618.zip
Added analytics; try/catch for ready event
Diffstat (limited to 'bot/src/events')
-rw-r--r--bot/src/events/ClientReady.js48
-rw-r--r--bot/src/events/GuildMemberUpdate.js2
-rw-r--r--bot/src/events/InteractionCreate.js3
3 files changed, 30 insertions, 23 deletions
diff --git a/bot/src/events/ClientReady.js b/bot/src/events/ClientReady.js
index eeb8ab0..9669287 100644
--- a/bot/src/events/ClientReady.js
+++ b/bot/src/events/ClientReady.js
@@ -28,28 +28,32 @@ export default {
console.log(`[i] Bot ID: ${client.user.id}`);
console.log(`[i] Running version ${abVersion} | Serving in ${client.guilds.cache.size} guilds`);
- await botActivity(client);
- await QuoteOfTheDay(client);
-
- if (process.env.NODE_ENV !== 'development') {
- const readyEmbed = new EmbedBuilder()
- .setAuthor({ name: 'AleeBot Status', iconURL: client.user.avatarURL() })
- .setDescription('AleeBot has started')
- .addFields(
- { name: 'Version', value: `${abVersion}`, inline: true },
- { name: 'Node.JS Version', value: `${process.versions.node}`, inline: true },
- { name: 'Discord.JS Version', value: `${version}`, inline: true }
- )
- .setColor(abEmbedColour);
-
- let statusChannel = client.channels.cache.get(process.env.STATUS_CHANNEL_ID);
- if (!statusChannel) return console.error('The status channel does not exist! Skipping.');
- await statusChannel.send({ embeds: [readyEmbed] });
+ try {
+ await botActivity(client);
+ await QuoteOfTheDay(client);
+
+ if (process.env.NODE_ENV !== 'development') {
+ const readyEmbed = new EmbedBuilder()
+ .setAuthor({name: 'AleeBot Status', iconURL: client.user.avatarURL()})
+ .setDescription('AleeBot has started')
+ .addFields(
+ {name: 'Version', value: `${abVersion}`, inline: true},
+ {name: 'Node.JS Version', value: `${process.versions.node}`, inline: true},
+ {name: 'Discord.JS Version', value: `${version}`, inline: true}
+ )
+ .setColor(abEmbedColour);
+
+ let statusChannel = client.channels.cache.get(process.env.STATUS_CHANNEL_ID);
+ if (!statusChannel) return console.error('The status channel does not exist! Skipping.');
+ await statusChannel.send({embeds: [readyEmbed]});
+ }
+
+ setInterval(function () {
+ botActivity(client);
+ }, 200000);
+
+ } catch (e) {
+ console.error(e);
}
-
- setInterval(function() {
- botActivity(client);
- }, 200000);
-
}
};
diff --git a/bot/src/events/GuildMemberUpdate.js b/bot/src/events/GuildMemberUpdate.js
index 3c90268..1fec4fe 100644
--- a/bot/src/events/GuildMemberUpdate.js
+++ b/bot/src/events/GuildMemberUpdate.js
@@ -24,7 +24,7 @@ export default {
await guildMember.send({ embeds: [logEmbed] });
} catch (e) {
- console.error(e);
+ console.error(e);
}
}
};
diff --git a/bot/src/events/InteractionCreate.js b/bot/src/events/InteractionCreate.js
index ac979d2..777ce39 100644
--- a/bot/src/events/InteractionCreate.js
+++ b/bot/src/events/InteractionCreate.js
@@ -1,4 +1,5 @@
import { Events, MessageFlags } from 'discord.js';
+import { Analytics } from '../plugins/analytics.js';
function error(e) {
return `Something went wrong. [Submit an issue at the AleeBot repository.](<https://github.com/Alee14/AleeBot/issues>)\nMessage:\n\`\`\`js\n${e.stack}\`\`\``;
@@ -14,6 +15,8 @@ export default {
if (!command) return;
try {
+ console.log(`[i] ${interaction.user.username} has executed ${command.data.name}`);
+ await Analytics(command, interaction);
await command.execute(interaction);
} catch (e) {
console.error(e);