diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts index 622903c..58a1df3 100644 --- a/src/commands/mod/ban.ts +++ b/src/commands/mod/ban.ts @@ -20,6 +20,7 @@ import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import type { GuildMember, Message, TextChannel } from 'discord.js'; import IDs from '../../utils/ids'; +import { addBan } from '../../utils/database/ban'; class BanCommand extends Command { public constructor(context: Command.Context, options: Command.Options) { @@ -51,7 +52,6 @@ class BanCommand extends Command { // Command run public async chatInputRun(interaction: Command.ChatInputInteraction) { - // TODO add database updates // Get the arguments const user = interaction.options.getUser('user'); const reason = interaction.options.getString('reason'); @@ -106,6 +106,9 @@ class BanCommand extends Command { fetchReply: true, }); + // Add ban to database + await addBan(user.id, mod.user.id, reason); + // Log the ban let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as TextChannel | undefined; @@ -181,6 +184,9 @@ class BanCommand extends Command { await message.react('✅'); + // Add ban to database + await addBan(user.id, mod.id, reason); + // Log the ban let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as TextChannel | undefined; diff --git a/src/commands/mod/unban.ts b/src/commands/mod/unban.ts index 621c523..f923227 100644 --- a/src/commands/mod/unban.ts +++ b/src/commands/mod/unban.ts @@ -20,6 +20,7 @@ import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import type { User, Message, TextChannel } from 'discord.js'; import IDs from '../../utils/ids'; +import { removeBan } from '../../utils/database/ban'; class UnbanCommand extends Command { public constructor(context: Command.Context, options: Command.Options) { @@ -48,7 +49,6 @@ class UnbanCommand extends Command { // Command run public async chatInputRun(interaction: Command.ChatInputInteraction) { - // TODO add database updates // Get the arguments const user = interaction.options.getUser('user'); const mod = interaction.member; @@ -73,6 +73,9 @@ class UnbanCommand extends Command { fetchReply: true, }); + // Add unban to database + await removeBan(user.id, mod.user.id); + // Log the ban let modRestrict = guild.channels.cache.get(IDs.channels.restricted.moderators) as TextChannel | undefined; @@ -120,6 +123,9 @@ class UnbanCommand extends Command { await message.react('✅'); + // Add unban to database + await removeBan(user.id, mod.id); + await message.reply({ content: `${user} has been unbanned.`, });