diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-03-23 01:39:11 -0400 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-03-23 01:39:11 -0400 |
| commit | d7c46a9eae28046bb26da182abc298dc18ed5a10 (patch) | |
| tree | a1f9955a757b150b88ed5398ef851ab2d1d4a46b /bot/src | |
| parent | b60e681998a456adecb93b5fe04b66ad4ac9abb6 (diff) | |
| download | AleeBot-d7c46a9eae28046bb26da182abc298dc18ed5a10.tar.gz AleeBot-d7c46a9eae28046bb26da182abc298dc18ed5a10.tar.bz2 AleeBot-d7c46a9eae28046bb26da182abc298dc18ed5a10.zip | |
Replacing Astro with Next.JS; Prefix warning; Consistent env vars
Diffstat (limited to 'bot/src')
| -rw-r--r-- | bot/src/api/routes/settings.js | 4 | ||||
| -rw-r--r-- | bot/src/api/server.js | 4 | ||||
| -rw-r--r-- | bot/src/bot.js | 2 | ||||
| -rw-r--r-- | bot/src/commands/settings.js | 2 | ||||
| -rw-r--r-- | bot/src/events/ClientReady.js | 4 | ||||
| -rw-r--r-- | bot/src/events/GuildCreate.js | 2 | ||||
| -rw-r--r-- | bot/src/events/GuildDelete.js | 2 | ||||
| -rw-r--r-- | bot/src/events/GuildMemberAdd.js | 2 | ||||
| -rw-r--r-- | bot/src/events/MessageCreate.js | 5 | ||||
| -rw-r--r-- | bot/src/storage/consts.js | 3 |
10 files changed, 21 insertions, 9 deletions
diff --git a/bot/src/api/routes/settings.js b/bot/src/api/routes/settings.js index 68d8745..8757874 100644 --- a/bot/src/api/routes/settings.js +++ b/bot/src/api/routes/settings.js @@ -35,7 +35,9 @@ export function settingsRouter(client) { channels.push(channelInfo); }); - res.json(channels); + res.json({ + channels: channels + }); } catch (e) { console.error('Error fetching settings:', e); res.status(500).send('Internal Server Error'); diff --git a/bot/src/api/server.js b/bot/src/api/server.js index 74d8511..15211eb 100644 --- a/bot/src/api/server.js +++ b/bot/src/api/server.js @@ -74,8 +74,8 @@ export const apiServer = (client) => { }); // Start the server - app.listen(process.env.port, () => { - console.log(`[i] Starting API at http://localhost:${process.env.port}`); + app.listen(process.env.PORT, () => { + console.log(`[i] Starting API at http://localhost:${process.env.PORT}`); }); }; diff --git a/bot/src/bot.js b/bot/src/bot.js index 91c26c8..c301234 100644 --- a/bot/src/bot.js +++ b/bot/src/bot.js @@ -5,7 +5,7 @@ const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBit init(client); -client.login(process.env.token).then(() => { +client.login(process.env.TOKEN).then(() => { console.log('[>] Successfully authenticated.'); }).catch(() => { console.log('[X] Login failed. The token that you have put in is invalid.'); diff --git a/bot/src/commands/settings.js b/bot/src/commands/settings.js index 7d7494d..4f29e0f 100644 --- a/bot/src/commands/settings.js +++ b/bot/src/commands/settings.js @@ -1,4 +1,4 @@ -import {ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, SlashCommandBuilder} from 'discord.js'; +import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, SlashCommandBuilder } from 'discord.js'; import { abEmbedColour } from '../storage/consts.js'; export default { data: new SlashCommandBuilder() diff --git a/bot/src/events/ClientReady.js b/bot/src/events/ClientReady.js index c806d6a..6a6b097 100644 --- a/bot/src/events/ClientReady.js +++ b/bot/src/events/ClientReady.js @@ -42,9 +42,9 @@ export default { ) .setColor(abEmbedColour); - let statusChannel = client.channels.cache.get(process.env.statusChannelID); + 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]}); + await statusChannel.send({ embeds: [readyEmbed] }); } setInterval(function() { diff --git a/bot/src/events/GuildCreate.js b/bot/src/events/GuildCreate.js index 0c59bb1..c3cf034 100644 --- a/bot/src/events/GuildCreate.js +++ b/bot/src/events/GuildCreate.js @@ -19,7 +19,7 @@ export default { await guildSettings.create({ guildID: guild.id }); - let statusChannel = guild.client.channels.cache.get(process.env.statusChannelID); + let statusChannel = guild.client.channels.cache.get(process.env.STATUS_CHANNEL_ID); if (!statusChannel) return; await statusChannel.send({ embeds: [logEmbed] }); } diff --git a/bot/src/events/GuildDelete.js b/bot/src/events/GuildDelete.js index 63c3c5b..5cdd88a 100644 --- a/bot/src/events/GuildDelete.js +++ b/bot/src/events/GuildDelete.js @@ -22,7 +22,7 @@ export default { await guildSettings.destroy({ where: { guildID: guild.id } }); } - let statusChannel = guild.client.channels.cache.get(process.env.statusChannelID); + let statusChannel = guild.client.channels.cache.get(process.env.STATUS_CHANNEL_ID); if (!statusChannel) return; await statusChannel.send({ embeds: [logEmbed] }); } diff --git a/bot/src/events/GuildMemberAdd.js b/bot/src/events/GuildMemberAdd.js index 1e3cd54..08121ad 100644 --- a/bot/src/events/GuildMemberAdd.js +++ b/bot/src/events/GuildMemberAdd.js @@ -24,6 +24,8 @@ export default { await guildMember.send({ embeds: [logEmbed] }); + // autoban system? + if (autoRole) { if (member.guild.id !== serverWhitelist) return; const role = member.guild.roles.cache.get(roleWhitelist); diff --git a/bot/src/events/MessageCreate.js b/bot/src/events/MessageCreate.js index 4895ab2..ab75a62 100644 --- a/bot/src/events/MessageCreate.js +++ b/bot/src/events/MessageCreate.js @@ -1,5 +1,6 @@ import { Events } from 'discord.js'; import { ChatBot } from '../plugins/chatbot.js'; +import { prefix, prefixNotice } from '../storage/consts.js'; export default { name: Events.MessageCreate, @@ -15,5 +16,9 @@ export default { if (!args) return; await ChatBot(msg, args); } + + if (prefixNotice && msg.content.startsWith(prefix)) { + return await msg.reply('# :warning: **AleeBot no longer uses the prefix system.**\n## Please use the new slash command system.'); + } } }; diff --git a/bot/src/storage/consts.js b/bot/src/storage/consts.js index 9255cd2..9a408f4 100644 --- a/bot/src/storage/consts.js +++ b/bot/src/storage/consts.js @@ -8,3 +8,6 @@ export const userWhitelist = ['242775871059001344']; export const autoRole = true; export const serverWhitelist = '243022206437687296'; export const roleWhitelist = '657426918416580614'; + +export const prefix = 'ab:'; +export const prefixNotice = true; |
