aboutsummaryrefslogtreecommitdiff
path: root/bot/src/storage
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-04-02 02:21:41 -0400
committerAndrew Lee <andrew@alee14.me>2025-04-02 02:21:41 -0400
commit10434adad478d21bbb834a5803125db9f54c9d6c (patch)
treee1159a26948d24c2a065dfd15f71b64970515930 /bot/src/storage
parent657599acccf351c7c9366cec9f648b7496c89bdb (diff)
downloadAleeBot-beta.tar.gz
AleeBot-beta.tar.bz2
AleeBot-beta.zip
Added i18n (basic); Blacklist feature; Put error msg into a filebeta
Diffstat (limited to 'bot/src/storage')
-rw-r--r--bot/src/storage/functions.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/bot/src/storage/functions.js b/bot/src/storage/functions.js
new file mode 100644
index 0000000..c689659
--- /dev/null
+++ b/bot/src/storage/functions.js
@@ -0,0 +1,18 @@
+import { blacklistGuild, blacklistUser } from '../db/models/blacklist.js';
+import { MessageFlags } from 'discord.js';
+
+export 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}\`\`\``;
+}
+
+export async function blacklistCheck(interaction) {
+ const blacklistedUser = await blacklistUser.findOne({ where: { userID: interaction.user.id } });
+ const blacklistedGuild = await blacklistGuild.findOne({ where: { guildID: interaction.guild.id } });
+
+ if (blacklistedUser || blacklistedGuild) {
+ await interaction.reply({ content: blacklistedUser ? 'You are banned from using this command.' : 'This server is banned from using this command.', flags: MessageFlags.Ephemeral });
+ return true;
+ }
+
+ return false;
+}