From 10434adad478d21bbb834a5803125db9f54c9d6c Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Wed, 2 Apr 2025 02:21:41 -0400 Subject: Added i18n (basic); Blacklist feature; Put error msg into a file --- bot/src/storage/functions.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bot/src/storage/functions.js (limited to 'bot/src/storage') 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.]()**\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; +} -- cgit v1.2.3