refactor(arabot): change deprecated reply options

This commit is contained in:
Anthony Berg 2025-01-19 12:01:12 +01:00
parent 2207d996a1
commit 0419488b6f
57 changed files with 612 additions and 400 deletions

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { ChannelType } from 'discord.js'; import { ChannelType, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
export class AccessCommand extends Command { export class AccessCommand extends Command {
@ -79,7 +79,7 @@ export class AccessCommand extends Command {
if (!interaction.inCachedGuild()) { if (!interaction.inCachedGuild()) {
await interaction.reply({ await interaction.reply({
content: 'This command can only be run in a server!', content: 'This command can only be run in a server!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -94,7 +94,7 @@ export class AccessCommand extends Command {
if (user === null && role === null) { if (user === null && role === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching slash command data!', content: 'Error fetching slash command data!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -104,7 +104,7 @@ export class AccessCommand extends Command {
await interaction.reply({ await interaction.reply({
content: content:
'You have entered a user and a role at the same time! Please only enter one at a time.', 'You have entered a user and a role at the same time! Please only enter one at a time.',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -116,7 +116,7 @@ export class AccessCommand extends Command {
) { ) {
await interaction.reply({ await interaction.reply({
content: 'Please only select a text or voice channel!', content: 'Please only select a text or voice channel!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -129,7 +129,7 @@ export class AccessCommand extends Command {
) { ) {
await interaction.reply({ await interaction.reply({
content: 'Channel is not in ModMail/Private/Restricted category!', content: 'Channel is not in ModMail/Private/Restricted category!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -143,7 +143,7 @@ export class AccessCommand extends Command {
} else { } else {
await interaction.reply({ await interaction.reply({
content: 'Could not find the role to edit permissions!', content: 'Could not find the role to edit permissions!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -185,7 +185,7 @@ export class AccessCommand extends Command {
default: default:
await interaction.reply({ await interaction.reply({
content: 'Incorrect permission option!', content: 'Incorrect permission option!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -220,7 +220,7 @@ export class AccessCommand extends Command {
default: default:
await interaction.reply({ await interaction.reply({
content: 'Incorrect permission option!', content: 'Incorrect permission option!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Message } from 'discord.js'; import { Message, MessageFlagsBitField } from 'discord.js';
export class ClearCommand extends Command { export class ClearCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) { public constructor(context: Command.LoaderContext, options: Command.Options) {
@ -60,8 +60,8 @@ export class ClearCommand extends Command {
if (channel === null || channel.isDMBased()) { if (channel === null || channel.isDMBased()) {
await interaction.reply({ await interaction.reply({
content: 'Could not fetch channel!', content: 'Could not fetch channel!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -70,8 +70,8 @@ export class ClearCommand extends Command {
await interaction.reply({ await interaction.reply({
content: `Successfully deleted ${messages} messages!`, content: `Successfully deleted ${messages} messages!`,
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
} }

View File

@ -19,7 +19,12 @@
import { RegisterBehavior } from '@sapphire/framework'; import { RegisterBehavior } from '@sapphire/framework';
import { Subcommand } from '@sapphire/plugin-subcommands'; import { Subcommand } from '@sapphire/plugin-subcommands';
import type { Guild, TextChannel, Snowflake } from 'discord.js'; import {
Guild,
TextChannel,
Snowflake,
MessageFlagsBitField,
} from 'discord.js';
import { import {
CategoryChannel, CategoryChannel,
ChannelType, ChannelType,
@ -93,7 +98,9 @@ export class PrivateCommand extends Subcommand {
const modUser = interaction.user; const modUser = interaction.user;
const { guild } = interaction; const { guild } = interaction;
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
// Checks if all the variables are of the right type // Checks if all the variables are of the right type
if (guild === null) { if (guild === null) {
@ -235,7 +242,9 @@ export class PrivateCommand extends Subcommand {
const modUser = interaction.user; const modUser = interaction.user;
const { guild, channel } = interaction; const { guild, channel } = interaction;
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
// Checks if all the variables are of the right type // Checks if all the variables are of the right type
if (guild === null || channel === null) { if (guild === null || channel === null) {

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import type { User, Guild, Message } from 'discord.js'; import { User, Guild, Message, MessageFlagsBitField } from 'discord.js';
import { updateUser } from '#utils/database/dbExistingUser'; import { updateUser } from '#utils/database/dbExistingUser';
import { getBalance } from '#utils/database/fun/economy'; import { getBalance } from '#utils/database/fun/economy';
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
@ -50,7 +50,7 @@ export class BalanceCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Could not find the guild!', content: 'Could not find the guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -66,15 +66,9 @@ export class BalanceCommand extends Command {
} }
public async messageRun(message: Message) { public async messageRun(message: Message) {
const user = message.member?.user; const user = message.author;
const { guild } = message; const { guild } = message;
if (user === undefined) {
await message.react('❌');
await message.reply('Could not find your user!');
return;
}
if (guild === null) { if (guild === null) {
await message.react('❌'); await message.react('❌');
await message.reply('Could not find the guild!'); await message.reply('Could not find the guild!');

View File

@ -19,7 +19,13 @@
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { Time } from '@sapphire/time-utilities'; import { Time } from '@sapphire/time-utilities';
import type { User, Guild, GuildMember, Message } from 'discord.js'; import {
User,
Guild,
GuildMember,
Message,
MessageFlagsBitField,
} from 'discord.js';
import { updateUser } from '#utils/database/dbExistingUser'; import { updateUser } from '#utils/database/dbExistingUser';
import { daily, getLastDaily } from '#utils/database/fun/economy'; import { daily, getLastDaily } from '#utils/database/fun/economy';
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
@ -51,7 +57,7 @@ export class DailyCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Could not find the guild!', content: 'Could not find the guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -67,15 +73,9 @@ export class DailyCommand extends Command {
} }
public async messageRun(message: Message) { public async messageRun(message: Message) {
const user = message.member?.user; const user = message.author;
const { guild } = message; const { guild } = message;
if (user === undefined) {
await message.react('❌');
await message.reply('Could not find your user!');
return;
}
if (guild === null) { if (guild === null) {
await message.react('❌'); await message.react('❌');
await message.reply('Could not find the guild!'); await message.reply('Could not find the guild!');

View File

@ -18,10 +18,10 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { User, Guild, Message } from 'discord.js'; import { User, Guild, Message, MessageFlagsBitField } from 'discord.js';
import { updateUser } from '#utils/database/dbExistingUser'; import { updateUser } from '#utils/database/dbExistingUser';
import { getBalance, transfer } from '#utils/database/fun/economy'; import { getBalance, transfer } from '#utils/database/fun/economy';
import { EmbedBuilder, TextChannel } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
export class BalanceCommand extends Command { export class BalanceCommand extends Command {
@ -75,7 +75,7 @@ export class BalanceCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Could not find the guild!', content: 'Could not find the guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -117,15 +117,9 @@ export class BalanceCommand extends Command {
return; return;
} }
const user = message.member?.user; const user = message.author;
const { guild } = message; const { guild } = message;
if (user === undefined) {
await message.react('❌');
await message.reply('Could not find your user!');
return;
}
if (guild === null) { if (guild === null) {
await message.react('❌'); await message.react('❌');
await message.reply('Could not find the guild!'); await message.reply('Could not find the guild!');
@ -206,20 +200,28 @@ export class BalanceCommand extends Command {
info.embeds.push(embed); info.embeds.push(embed);
// Log the payment in the server // Log the payment in the server
let logChannel = guild.channels.cache.get(IDs.channels.logs.economy) as let logChannel = guild.channels.cache.get(IDs.channels.logs.economy);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch(IDs.channels.logs.economy)) as const fetchLogChannel = await guild.channels
| TextChannel .fetch(IDs.channels.logs.economy)
| undefined; .catch(() => undefined);
if (logChannel === undefined) {
this.container.logger.error('Pay Error: Could not fetch log channel'); if (fetchLogChannel === null || fetchLogChannel === undefined) {
this.container.logger.error('Pay: Could not fetch log channel');
return info; return info;
} else {
logChannel = fetchLogChannel;
} }
} }
if (!logChannel.isSendable()) {
this.container.logger.error(
'Pay: the bot does not have permission to send in the log channel',
);
return info;
}
const logEmbed = new EmbedBuilder(embed.data); const logEmbed = new EmbedBuilder(embed.data);
logEmbed.setTimestamp().setFooter({ text: `ID: ${user.id}` }); logEmbed.setTimestamp().setFooter({ text: `ID: ${user.id}` });
await logChannel.send({ embeds: [logEmbed] }); await logChannel.send({ embeds: [logEmbed] });

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember, MessageFlagsBitField } from 'discord.js';
import { N1984 } from '#utils/gifs'; import { N1984 } from '#utils/gifs';
import { addFunLog, countTotal } from '#utils/database/fun/fun'; import { addFunLog, countTotal } from '#utils/database/fun/fun';
@ -50,8 +50,8 @@ export class N1984Command extends Command {
// Type checks // Type checks
if (!(member instanceof GuildMember)) { if (!(member instanceof GuildMember)) {
await interaction.reply({ await interaction.reply({
ephemeral: true,
content: 'Failed to fetch your user on the bot!', content: 'Failed to fetch your user on the bot!',
flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -79,6 +79,6 @@ export class N1984Command extends Command {
.setFooter({ text: embedFooter }); .setFooter({ text: embedFooter });
// Send the embed // Send the embed
await interaction.reply({ embeds: [n1984Embed], fetchReply: true }); await interaction.reply({ embeds: [n1984Embed], withResponse: true });
} }
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember, MessageFlagsBitField } from 'discord.js';
import { Cringe } from '#utils/gifs'; import { Cringe } from '#utils/gifs';
import { addFunLog, countTotal } from '#utils/database/fun/fun'; import { addFunLog, countTotal } from '#utils/database/fun/fun';
@ -49,8 +49,8 @@ export class CringeCommand extends Command {
// Type check // Type check
if (!(member instanceof GuildMember)) { if (!(member instanceof GuildMember)) {
await interaction.reply({ await interaction.reply({
ephemeral: true,
content: 'Failed to fetch your user on the bot!', content: 'Failed to fetch your user on the bot!',
flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -74,6 +74,6 @@ export class CringeCommand extends Command {
.setFooter({ text: embedFooter }); .setFooter({ text: embedFooter });
// Send the embed // Send the embed
await interaction.reply({ embeds: [cringeEmbed], fetchReply: true }); await interaction.reply({ embeds: [cringeEmbed], withResponse: true });
} }
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember, MessageFlagsBitField } from 'discord.js';
import { Happy } from '#utils/gifs'; import { Happy } from '#utils/gifs';
export class HappyCommand extends Command { export class HappyCommand extends Command {
@ -48,8 +48,8 @@ export class HappyCommand extends Command {
// Type checks // Type checks
if (!(member instanceof GuildMember)) { if (!(member instanceof GuildMember)) {
await interaction.reply({ await interaction.reply({
ephemeral: true,
content: 'Failed to fetch your user on the bot!', content: 'Failed to fetch your user on the bot!',
flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -62,6 +62,6 @@ export class HappyCommand extends Command {
.setImage(randomHappy); .setImage(randomHappy);
// Send the embed // Send the embed
await interaction.reply({ embeds: [happyEmbed], fetchReply: true }); await interaction.reply({ embeds: [happyEmbed], withResponse: true });
} }
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember, MessageFlagsBitField } from 'discord.js';
import { Hugs } from '#utils/gifs'; import { Hugs } from '#utils/gifs';
import { addFunLog, countTotal } from '#utils/database/fun/fun'; import { addFunLog, countTotal } from '#utils/database/fun/fun';
@ -60,8 +60,8 @@ export class HugCommand extends Command {
if (!(hugger instanceof GuildMember)) { if (!(hugger instanceof GuildMember)) {
await interaction.reply({ await interaction.reply({
ephemeral: true,
content: 'Failed to fetch your user on the bot!', content: 'Failed to fetch your user on the bot!',
flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -96,7 +96,7 @@ export class HugCommand extends Command {
await interaction.reply({ await interaction.reply({
content: `${user}`, content: `${user}`,
embeds: [hugEmbed], embeds: [hugEmbed],
fetchReply: true, withResponse: true,
}); });
} }
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember, MessageFlagsBitField } from 'discord.js';
import { Kill } from '#utils/gifs'; import { Kill } from '#utils/gifs';
import { addFunLog, countTotal } from '#utils/database/fun/fun'; import { addFunLog, countTotal } from '#utils/database/fun/fun';
@ -59,8 +59,8 @@ export class KillCommand extends Command {
// Type checks // Type checks
if (!(sender instanceof GuildMember)) { if (!(sender instanceof GuildMember)) {
await interaction.reply({ await interaction.reply({
ephemeral: true,
content: 'Failed to fetch your user on the bot!', content: 'Failed to fetch your user on the bot!',
flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -92,7 +92,7 @@ export class KillCommand extends Command {
await interaction.reply({ await interaction.reply({
content: `${user}`, content: `${user}`,
embeds: [killEmbed], embeds: [killEmbed],
fetchReply: true, withResponse: true,
}); });
} }
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember, MessageFlagsBitField } from 'discord.js';
import { Poke } from '#utils/gifs'; import { Poke } from '#utils/gifs';
import { addFunLog, countTotal } from '#utils/database/fun/fun'; import { addFunLog, countTotal } from '#utils/database/fun/fun';
@ -59,8 +59,8 @@ export class PokeCommand extends Command {
// Type checks // Type checks
if (!(sender instanceof GuildMember)) { if (!(sender instanceof GuildMember)) {
await interaction.reply({ await interaction.reply({
ephemeral: true,
content: 'Failed to fetch your user on the bot!', content: 'Failed to fetch your user on the bot!',
flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -95,7 +95,7 @@ export class PokeCommand extends Command {
await interaction.reply({ await interaction.reply({
content: `${user}`, content: `${user}`,
embeds: [pokeEmbed], embeds: [pokeEmbed],
fetchReply: true, withResponse: true,
}); });
} }
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember, MessageFlagsBitField } from 'discord.js';
import { Sad } from '#utils/gifs'; import { Sad } from '#utils/gifs';
export class SadCommand extends Command { export class SadCommand extends Command {
@ -48,8 +48,8 @@ export class SadCommand extends Command {
// Type checks // Type checks
if (!(member instanceof GuildMember)) { if (!(member instanceof GuildMember)) {
await interaction.reply({ await interaction.reply({
ephemeral: true,
content: 'Failed to fetch your user on the bot!', content: 'Failed to fetch your user on the bot!',
flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -62,6 +62,6 @@ export class SadCommand extends Command {
.setImage(randomSad); .setImage(randomSad);
// Send the embed // Send the embed
await interaction.reply({ embeds: [sadEmbed], fetchReply: true }); await interaction.reply({ embeds: [sadEmbed], withResponse: true });
} }
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, GuildMember } from 'discord.js'; import { EmbedBuilder, GuildMember, MessageFlagsBitField } from 'discord.js';
import { Shrug } from '#utils/gifs'; import { Shrug } from '#utils/gifs';
export class ShrugCommand extends Command { export class ShrugCommand extends Command {
@ -48,8 +48,8 @@ export class ShrugCommand extends Command {
// Type checks // Type checks
if (!(member instanceof GuildMember)) { if (!(member instanceof GuildMember)) {
await interaction.reply({ await interaction.reply({
ephemeral: true,
content: 'Failed to fetch your user on the bot!', content: 'Failed to fetch your user on the bot!',
flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -62,6 +62,6 @@ export class ShrugCommand extends Command {
.setImage(randomShrug); .setImage(randomShrug);
// Send the embed // Send the embed
await interaction.reply({ embeds: [shrugEmbed], fetchReply: true }); await interaction.reply({ embeds: [shrugEmbed], withResponse: true });
} }
} }

View File

@ -18,7 +18,13 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { User, Message, Snowflake, TextChannel, Guild } from 'discord.js'; import {
User,
Message,
Snowflake,
Guild,
MessageFlagsBitField,
} from 'discord.js';
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { addBan, checkBan } from '#utils/database/moderation/ban'; import { addBan, checkBan } from '#utils/database/moderation/ban';
@ -75,13 +81,15 @@ export class BanCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const ban = await this.ban(user.id, mod.id, reason, guild); const ban = await this.ban(user.id, mod.id, reason, guild);
@ -206,21 +214,32 @@ export class BanCommand extends Command {
info.success = true; info.success = true;
// Log the ban // Log the ban
let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch( const fetchLogChannel = await guild.channels.fetch(
IDs.channels.logs.restricted, IDs.channels.logs.restricted,
)) as TextChannel | undefined; );
if (logChannel === undefined) {
this.container.logger.error('Ban Error: Could not fetch log channel'); if (fetchLogChannel === null || fetchLogChannel === undefined) {
this.container.logger.error('Ban: Could not fetch log channel');
info.message = `${user} has been banned. This hasn't been logged in a text channel as log channel could not be found`; info.message = `${user} has been banned. This hasn't been logged in a text channel as log channel could not be found`;
return info; return info;
} else {
logChannel = fetchLogChannel;
} }
} }
if (!logChannel.isSendable()) {
this.container.logger.error(
'Ban: The bot does not have permission to send in the logs channel!',
);
info.message = `${user} has been banned. This hasn't been logged in a text channel as the bot does not have permission to send logs!`;
return info;
}
const log = new EmbedBuilder() const log = new EmbedBuilder()
.setColor('#FF0000') .setColor('#FF0000')
.setAuthor({ .setAuthor({

View File

@ -19,7 +19,7 @@
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import { Duration, DurationFormatter } from '@sapphire/time-utilities'; import { Duration, DurationFormatter } from '@sapphire/time-utilities';
import type { User, Snowflake, TextChannel, Guild } from 'discord.js'; import { User, Snowflake, Guild, MessageFlagsBitField } from 'discord.js';
import { EmbedBuilder, Message } from 'discord.js'; import { EmbedBuilder, Message } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { addTempBan, checkTempBan } from '#utils/database/moderation/tempBan'; import { addTempBan, checkTempBan } from '#utils/database/moderation/tempBan';
@ -79,8 +79,8 @@ export class TempBanCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -94,7 +94,9 @@ export class TempBanCommand extends Command {
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const ban = await this.ban(user.id, mod.id, time, reason, guild); const ban = await this.ban(user.id, mod.id, time, reason, guild);
@ -273,25 +275,37 @@ export class TempBanCommand extends Command {
info.success = true; info.success = true;
// Log the ban // Log the ban
let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch( const fetchLogChannel = await guild.channels.fetch(
IDs.channels.logs.restricted, IDs.channels.logs.restricted,
)) as TextChannel | undefined;
if (logChannel === undefined) {
this.container.logger.error(
'Temp Ban Error: Could not fetch log channel',
); );
if (fetchLogChannel === null || fetchLogChannel === undefined) {
this.container.logger.error('Temp Ban: Could not fetch log channel');
info.message = info.message =
`${user} has been temporarily banned for ${banLength}. ` + `${user} has been temporarily banned for ${banLength}. ` +
"This hasn't been logged in a text channel as log channel could not be found"; "This hasn't been logged in a text channel as log channel could not be found";
return info; return info;
} else {
logChannel = fetchLogChannel;
} }
} }
if (!logChannel.isSendable()) {
this.container.logger.error(
'Temp Ban: The bot does not have permission to send in the logs channel!',
);
info.message =
`${user} has been temporarily banned for ${banLength}. ` +
"This hasn't been logged in a text channel as the bot does not have permission to send logs!";
return info;
}
const log = new EmbedBuilder() const log = new EmbedBuilder()
.setColor('#FF0000') .setColor('#FF0000')
.setAuthor({ .setAuthor({

View File

@ -18,13 +18,13 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { import {
User, User,
Message, Message,
Snowflake, Snowflake,
TextChannel,
Guild, Guild,
GuildBan, GuildBan,
MessageFlagsBitField,
} from 'discord.js'; } from 'discord.js';
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
@ -75,8 +75,8 @@ export class UnbanCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -191,21 +191,32 @@ export class UnbanCommand extends Command {
info.success = true; info.success = true;
// Log unban // Log unban
let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch( const fetchLogChannel = await guild.channels.fetch(
IDs.channels.logs.restricted, IDs.channels.logs.restricted,
)) as TextChannel | undefined; );
if (logChannel === undefined) {
this.container.logger.error('Ban Error: Could not fetch log channel'); if (fetchLogChannel === null || fetchLogChannel === undefined) {
info.message = `${user} has been banned. This hasn't been logged in a text channel as log channel could not be found`; this.container.logger.error('Unban Error: Could not fetch log channel');
info.message = `${user} has been unbanned. This hasn't been logged in a text channel as log channel could not be found`;
return info; return info;
} else {
logChannel = fetchLogChannel;
} }
} }
if (!logChannel.isSendable()) {
this.container.logger.error(
'Unban: The bot does not have permission to send in the logs channel!',
);
info.message = `${user} has been unbanned. This hasn't been logged in a text channel as the bot does not have permission to send logs!`;
return info;
}
const log = new EmbedBuilder() const log = new EmbedBuilder()
.setColor('#28A745') .setColor('#28A745')
.setAuthor({ .setAuthor({

View File

@ -25,6 +25,7 @@ import {
ChannelType, ChannelType,
GuildMember, GuildMember,
Message, Message,
MessageFlagsBitField,
PermissionsBitField, PermissionsBitField,
} from 'discord.js'; } from 'discord.js';
import type { TextChannel, Snowflake } from 'discord.js'; import type { TextChannel, Snowflake } from 'discord.js';
@ -93,8 +94,8 @@ export class DiversityCommand extends Subcommand {
if (interaction.guild === null) { if (interaction.guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Guild not found!', content: 'Guild not found!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -105,8 +106,8 @@ export class DiversityCommand extends Subcommand {
if (channel === undefined) { if (channel === undefined) {
await interaction.reply({ await interaction.reply({
content: 'Channel not found!', content: 'Channel not found!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -115,8 +116,8 @@ export class DiversityCommand extends Subcommand {
if (channel.type !== ChannelType.GuildText) { if (channel.type !== ChannelType.GuildText) {
await interaction.reply({ await interaction.reply({
content: 'Channel is not a text channel!', content: 'Channel is not a text channel!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -128,8 +129,8 @@ export class DiversityCommand extends Subcommand {
if (channel.parentId !== IDs.categories.diversity) { if (channel.parentId !== IDs.categories.diversity) {
await interaction.reply({ await interaction.reply({
content: 'Command was not run in the Diversity section!', content: 'Command was not run in the Diversity section!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -146,7 +147,7 @@ export class DiversityCommand extends Subcommand {
await interaction.reply({ await interaction.reply({
content: `${!open ? 'Opened' : 'Closed'} this channel.`, content: `${!open ? 'Opened' : 'Closed'} this channel.`,
fetchReply: true, withResponse: true,
}); });
} }
@ -163,8 +164,8 @@ export class DiversityCommand extends Subcommand {
if (user === null || guild === null || mod === null) { if (user === null || guild === null || mod === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching user!', content: 'Error fetching user!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -177,8 +178,8 @@ export class DiversityCommand extends Subcommand {
if (guildMember === undefined || diversity === undefined) { if (guildMember === undefined || diversity === undefined) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching user!', content: 'Error fetching user!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -190,7 +191,7 @@ export class DiversityCommand extends Subcommand {
await this.threadManager(guildMember.id, false); await this.threadManager(guildMember.id, false);
await interaction.reply({ await interaction.reply({
content: `Removed the ${diversity.name} role from ${user}`, content: `Removed the ${diversity.name} role from ${user}`,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -199,7 +200,7 @@ export class DiversityCommand extends Subcommand {
await this.threadManager(guildMember.id, true); await this.threadManager(guildMember.id, true);
await interaction.reply({ await interaction.reply({
content: `Gave ${user} the ${diversity.name} role!`, content: `Gave ${user} the ${diversity.name} role!`,
fetchReply: true, withResponse: true,
}); });
await user await user
.send(`You have been given the ${diversity.name} role by ${mod}!`) .send(`You have been given the ${diversity.name} role by ${mod}!`)

View File

@ -21,7 +21,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Message } from 'discord.js'; import { Message, MessageFlagsBitField } from 'discord.js';
import { ChannelType } from 'discord.js'; import { ChannelType } from 'discord.js';
export class MoveAllCommand extends Command { export class MoveAllCommand extends Command {
@ -61,7 +61,9 @@ export class MoveAllCommand extends Command {
const { member } = interaction; const { member } = interaction;
const { guild } = interaction; const { guild } = interaction;
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
if ( if (
channel.type !== ChannelType.GuildVoice && channel.type !== ChannelType.GuildVoice &&

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js'; import { GuildMember, Message, MessageFlagsBitField } from 'discord.js';
export class RenameUserCommand extends Command { export class RenameUserCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) { public constructor(context: Command.LoaderContext, options: Command.Options) {
@ -68,8 +68,8 @@ export class RenameUserCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -81,8 +81,8 @@ export class RenameUserCommand extends Command {
if (member === undefined) { if (member === undefined) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching user!', content: 'Error fetching user!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -93,15 +93,15 @@ export class RenameUserCommand extends Command {
} catch { } catch {
await interaction.reply({ await interaction.reply({
content: "Bot doesn't have permission to change the user's name!", content: "Bot doesn't have permission to change the user's name!",
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.reply({ await interaction.reply({
content: `Changed ${user}'s nickname`, content: `Changed ${user}'s nickname`,
fetchReply: true, flags: MessageFlagsBitField.Flags.Ephemeral,
ephemeral: true, withResponse: true,
}); });
} }

View File

@ -26,6 +26,7 @@ import {
import { import {
ChannelType, ChannelType,
EmbedBuilder, EmbedBuilder,
MessageFlagsBitField,
PermissionsBitField, PermissionsBitField,
time, time,
} from 'discord.js'; } from 'discord.js';
@ -55,7 +56,7 @@ export async function restrictRun(
let user = guild.client.users.cache.get(userId); let user = guild.client.users.cache.get(userId);
if (user === undefined) { if (user === undefined) {
user = await guild.client.users.fetch(userId); user = await guild.client.users.fetch(userId).catch(() => undefined);
if (user === undefined) { if (user === undefined) {
info.message = 'Error fetching user'; info.message = 'Error fetching user';
return info; return info;
@ -242,21 +243,31 @@ export async function restrictRun(
await user.send({ embeds: [dmEmbed] }).catch(() => {}); await user.send({ embeds: [dmEmbed] }).catch(() => {});
// Log the ban // Log the ban
let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch(IDs.channels.logs.restricted)) as const fetchLogChannel = await guild.channels.fetch(
| TextChannel IDs.channels.logs.restricted,
| undefined; );
if (logChannel === undefined) { if (fetchLogChannel === null || fetchLogChannel === undefined) {
container.logger.error('Restrict Error: Could not fetch log channel'); container.logger.error('Restrict: Could not fetch log channel');
info.message = `Restricted ${user} but could not find the log channel. This has been logged to the database.`; info.message = `Restricted ${user} but could not find the log channel. This has been logged to the database.`;
return info; return info;
} else {
logChannel = fetchLogChannel;
} }
} }
if (!logChannel.isSendable()) {
container.logger.error(
'Restrict: The bot does not have permission to send in the logs channel!',
);
info.message = `${user} has been restricted. This hasn't been logged in a text channel as the bot does not have permission to send logs!`;
return info;
}
const message = new EmbedBuilder() const message = new EmbedBuilder()
.setColor('#FF6700') .setColor('#FF6700')
.setAuthor({ .setAuthor({
@ -324,15 +335,17 @@ export class RestrictCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await restrictRun(user?.id, mod.id, reason, guild); const info = await restrictRun(user.id, mod.id, reason, guild);
await interaction.editReply({ await interaction.editReply({
content: info.message, content: info.message,
@ -367,7 +380,7 @@ export class RestrictCommand extends Command {
return; return;
} }
const info = await restrictRun(user?.id, mod.id, reason, guild); const info = await restrictRun(user.id, mod.id, reason, guild);
await message.reply(info.message); await message.reply(info.message);
await message.react(info.success ? '✅' : '❌'); await message.react(info.success ? '✅' : '❌');

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import { ChannelType, EmbedBuilder } from 'discord.js'; import { ChannelType, EmbedBuilder, MessageFlagsBitField } from 'discord.js';
import type { Message, TextChannel, Guild, Snowflake } from 'discord.js'; import type { Message, TextChannel, Guild, Snowflake } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { getRestrictions } from '#utils/database/moderation/restriction'; import { getRestrictions } from '#utils/database/moderation/restriction';
@ -63,8 +63,8 @@ export class RestrictLogsCommand extends Command {
if (guild === null || channel === null) { if (guild === null || channel === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild or channel!', content: 'Error fetching guild or channel!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -86,7 +86,6 @@ export class RestrictLogsCommand extends Command {
// Checks if the channel topic has the user's snowflake // Checks if the channel topic has the user's snowflake
if (channel.topic !== null) { if (channel.topic !== null) {
topic = channel.topic.split(' '); topic = channel.topic.split(' ');
// eslint-disable-next-line prefer-destructuring
userId = topic[2]; userId = topic[2];
} }
} }
@ -95,8 +94,8 @@ export class RestrictLogsCommand extends Command {
if (userId === null) { if (userId === null) {
await interaction.reply({ await interaction.reply({
content: 'User could not be found or was not provided!', content: 'User could not be found or was not provided!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -106,8 +105,8 @@ export class RestrictLogsCommand extends Command {
await interaction.reply({ await interaction.reply({
embeds: info.embeds, embeds: info.embeds,
content: info.message, content: info.message,
fetchReply: true, withResponse: true,
ephemeral: !staffChannel, flags: staffChannel ? undefined : MessageFlagsBitField.Flags.Ephemeral,
}); });
} }
} }
@ -176,7 +175,7 @@ export class RestrictLogsCommand extends Command {
let user = guild.client.users.cache.get(userId); let user = guild.client.users.cache.get(userId);
if (user === undefined) { if (user === undefined) {
user = await guild.client.users.fetch(userId); user = await guild.client.users.fetch(userId).catch(() => undefined);
if (user === undefined) { if (user === undefined) {
info.message = 'Error fetching user'; info.message = 'Error fetching user';
return info; return info;

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { User, Message } from 'discord.js'; import { User, Message, MessageFlagsBitField } from 'discord.js';
import { restrictRun } from './restrict'; import { restrictRun } from './restrict';
export class RestrictToleranceCommand extends Command { export class RestrictToleranceCommand extends Command {
@ -69,15 +69,17 @@ export class RestrictToleranceCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await restrictRun(user?.id, mod.id, reason, guild, true); const info = await restrictRun(user.id, mod.id, reason, guild, true);
await interaction.editReply({ await interaction.editReply({
content: info.message, content: info.message,
@ -112,7 +114,7 @@ export class RestrictToleranceCommand extends Command {
return; return;
} }
const info = await restrictRun(user?.id, mod.id, reason, guild, true); const info = await restrictRun(user.id, mod.id, reason, guild, true);
await message.reply(info.message); await message.reply(info.message);
await message.react(info.success ? '✅' : '❌'); await message.react(info.success ? '✅' : '❌');

View File

@ -19,7 +19,7 @@
import { RegisterBehavior } from '@sapphire/framework'; import { RegisterBehavior } from '@sapphire/framework';
import { Subcommand } from '@sapphire/plugin-subcommands'; import { Subcommand } from '@sapphire/plugin-subcommands';
import type { TextChannel } from 'discord.js'; import { MessageFlagsBitField, TextChannel } from 'discord.js';
import { CategoryChannel, ChannelType } from 'discord.js'; import { CategoryChannel, ChannelType } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
@ -78,7 +78,9 @@ export class RestrictToolsCommand extends Subcommand {
const user = interaction.options.getUser('user'); const user = interaction.options.getUser('user');
const { guild, channel } = interaction; const { guild, channel } = interaction;
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
// Checks if all the variables are of the right type // Checks if all the variables are of the right type
if (guild === null || channel === null) { if (guild === null || channel === null) {
@ -142,11 +144,9 @@ export class RestrictToolsCommand extends Subcommand {
return; return;
} }
const category = guild.channels.cache.get(IDs.categories.restricted) as const category = guild.channels.cache.get(IDs.categories.restricted);
| CategoryChannel
| undefined;
if (category === undefined) { if (!(category instanceof CategoryChannel)) {
await interaction.editReply({ await interaction.editReply({
content: 'Could not find category!', content: 'Could not find category!',
}); });
@ -156,23 +156,45 @@ export class RestrictToolsCommand extends Subcommand {
const textChannels = category.children.cache.filter( const textChannels = category.children.cache.filter(
(c) => c.type === ChannelType.GuildText, (c) => c.type === ChannelType.GuildText,
); );
textChannels.forEach((c) => {
const textChannel = c as TextChannel; for (const channel of textChannels) {
const textChannel = channel[1];
// Checks that the channel is a text channel
if (!(textChannel instanceof TextChannel)) {
continue;
}
// Checks that the channel has a topic
if (textChannel.topic === null) {
continue;
}
// Checks if the channel topic has the user's snowflake // Checks if the channel topic has the user's snowflake
if (textChannel.topic?.includes(user?.id)) { if (textChannel.topic.includes(user.id)) {
topic = textChannel.topic.split(' '); topic = textChannel.topic.split(' ');
const vcId = topic[topic.indexOf(user?.id) + 1]; const vcId = topic[topic.indexOf(user.id) + 1];
const voiceChannel = guild.channels.cache.get(vcId); let voiceChannel = guild.channels.cache.get(vcId);
if (voiceChannel === undefined) {
const fetchVoiceChannel = await guild.channels
.fetch(vcId)
.catch(() => undefined);
if (fetchVoiceChannel !== null && fetchVoiceChannel !== undefined) {
voiceChannel = fetchVoiceChannel;
}
}
if ( if (
voiceChannel !== undefined && voiceChannel !== undefined &&
voiceChannel.parentId === IDs.categories.restricted voiceChannel.parentId === IDs.categories.restricted
) { ) {
voiceChannel.delete(); await voiceChannel.delete();
}
await textChannel.delete();
} }
textChannel.delete();
} }
});
await interaction.editReply({ await interaction.editReply({
content: `Successfully deleted the channel for ${user}`, content: `Successfully deleted the channel for ${user}`,

View File

@ -18,13 +18,19 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import { CategoryChannel, ChannelType, EmbedBuilder } from 'discord.js'; import type { Guild, Message, Snowflake, User } from 'discord.js';
import type { User, Message, TextChannel, Guild, Snowflake } from 'discord.js'; import {
import IDs from '#utils/ids'; CategoryChannel,
import { fetchRoles, addExistingUser } from '#utils/database/dbExistingUser'; ChannelType,
EmbedBuilder,
MessageFlagsBitField,
TextChannel,
} from 'discord.js';
import IDs from '#utils/ids';
import { addExistingUser, fetchRoles } from '#utils/database/dbExistingUser';
import { import {
unRestrict,
checkActive, checkActive,
unRestrict,
unRestrictLegacy, unRestrictLegacy,
} from '#utils/database/moderation/restriction'; } from '#utils/database/moderation/restriction';
@ -69,14 +75,14 @@ export class UnRestrictCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
await interaction.deferReply(); await interaction.deferReply();
const info = await this.unRestrictRun(user?.id, mod.id, guild); const info = await this.unRestrictRun(user.id, mod.id, guild);
await interaction.editReply({ await interaction.editReply({
content: info.message, content: info.message,
@ -108,7 +114,7 @@ export class UnRestrictCommand extends Command {
const channelRun = message.channel; const channelRun = message.channel;
const info = await this.unRestrictRun( const info = await this.unRestrictRun(
user?.id, user.id,
mod.id, mod.id,
guild, guild,
channelRun.id, channelRun.id,
@ -135,7 +141,8 @@ export class UnRestrictCommand extends Command {
let user = guild.client.users.cache.get(userId); let user = guild.client.users.cache.get(userId);
if (user === undefined) { if (user === undefined) {
user = await guild.client.users.fetch(userId); user = await guild.client.users.fetch(userId).catch(() => undefined);
if (user === undefined) { if (user === undefined) {
info.message = 'Error fetching user'; info.message = 'Error fetching user';
return info; return info;
@ -159,12 +166,13 @@ export class UnRestrictCommand extends Command {
if (member === undefined) { if (member === undefined) {
member = await guild.members.fetch(userId).catch(() => undefined); member = await guild.members.fetch(userId).catch(() => undefined);
}
if (member === undefined) { if (member === undefined) {
info.message = "Can't unrestrict the user as they are not on this server"; info.message =
"Can't unrestrict the user as they are not on this server";
return info; return info;
} }
}
// Check if user is in database // Check if user is in database
await addExistingUser(member); await addExistingUser(member);
@ -180,16 +188,20 @@ export class UnRestrictCommand extends Command {
if (await checkActive(userId)) { if (await checkActive(userId)) {
const roles = await fetchRoles(userId); const roles = await fetchRoles(userId);
await member.roles.add(roles); await member.roles.add(roles);
// Unrestricts the user on the database // Unrestricts the user on the database
await unRestrict(userId, modId); await unRestrict(userId, modId);
} else { } else {
let section = 1; let section = 1;
for (let i = 0; i < restrictRoles.length; i += 1) { for (let i = 0; i < restrictRoles.length; i += 1) {
if (member.roles.cache.has(restrictRoles[i])) { if (member.roles.cache.has(restrictRoles[i])) {
section = i + 1; section = i + 1;
} }
} }
await member.roles.add(IDs.roles.nonvegan.nonvegan); await member.roles.add(IDs.roles.nonvegan.nonvegan);
// Unrestricts the user on the database but for restricts done on the old bot // Unrestricts the user on the database but for restricts done on the old bot
await unRestrictLegacy(userId, modId, section); await unRestrictLegacy(userId, modId, section);
} }
@ -198,59 +210,94 @@ export class UnRestrictCommand extends Command {
// Remove vegan restrict channels // Remove vegan restrict channels
if (member.roles.cache.has(IDs.roles.vegan.vegan)) { if (member.roles.cache.has(IDs.roles.vegan.vegan)) {
const category = guild.channels.cache.get(IDs.categories.restricted) as const category = guild.channels.cache.get(IDs.categories.restricted);
| CategoryChannel
| undefined; if (!(category instanceof CategoryChannel)) {
info.message =
'Could not find the restricted category! The channels will have to be deleted manually.';
return info;
}
let topic: string[]; let topic: string[];
if (category !== undefined) {
const textChannels = category.children.cache.filter( const textChannels = category.children.cache.filter(
(c) => c.type === ChannelType.GuildText, (c) => c.type === ChannelType.GuildText,
); );
textChannels.forEach((c) => {
const textChannel = c as TextChannel; for (const channel of textChannels) {
const textChannel = channel[1];
// Checks that the channel is a text channel
if (!(textChannel instanceof TextChannel)) {
continue;
}
// Checks that the channel has a topic
if (textChannel.topic === null) {
continue;
}
// Checks if the channel topic has the user's snowflake // Checks if the channel topic has the user's snowflake
if (textChannel.topic?.includes(userId)) { if (textChannel.topic.includes(userId)) {
if (textChannel.id === channelRun) { if (textChannel.id === channelRun) {
info.runInVeganRestrict = true; info.runInVeganRestrict = true;
} }
topic = textChannel.topic.split(' '); topic = textChannel.topic.split(' ');
const vcId = topic[topic.indexOf(userId) + 1]; const vcId = topic[topic.indexOf(user.id) + 1];
const voiceChannel = guild.channels.cache.get(vcId); let voiceChannel = guild.channels.cache.get(vcId);
if (voiceChannel === undefined) {
const fetchVoiceChannel = await guild.channels
.fetch(vcId)
.catch(() => undefined);
if (fetchVoiceChannel !== null && fetchVoiceChannel !== undefined) {
voiceChannel = fetchVoiceChannel;
}
}
if ( if (
voiceChannel !== undefined && voiceChannel !== undefined &&
// Used for sanitising the channel topic, so another voice channel does not get deleted
voiceChannel.parentId === IDs.categories.restricted voiceChannel.parentId === IDs.categories.restricted
) { ) {
voiceChannel.delete(); await voiceChannel.delete();
} }
textChannel.delete();
await textChannel.delete();
} }
});
} }
} }
info.success = true; info.success = true;
// Log the ban // Log the ban
let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted) as let logChannel = guild.channels.cache.get(IDs.channels.logs.restricted);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch( const fetchLogChannel = await guild.channels.fetch(
IDs.channels.logs.restricted, IDs.channels.logs.restricted,
)) as TextChannel | undefined;
if (logChannel === undefined) {
this.container.logger.error(
'Restrict Error: Could not fetch log channel',
); );
if (fetchLogChannel === null || fetchLogChannel === undefined) {
this.container.logger.error('Unrestrict: Could not fetch log channel');
info.message = `Unrestricted ${user} but could not find the log channel. This has been logged to the database.`; info.message = `Unrestricted ${user} but could not find the log channel. This has been logged to the database.`;
return info; return info;
} else {
logChannel = fetchLogChannel;
} }
} }
if (!logChannel.isSendable()) {
this.container.logger.error(
'Unrestrict: The bot does not have permission to send in the logs channel!',
);
info.message = `Unrestricted ${user} but could not find the log channel. This hasn't been logged in a text channel as the bot does not have permission to send logs!`;
return info;
}
const message = new EmbedBuilder() const message = new EmbedBuilder()
.setColor('#28A745') .setColor('#28A745')
.setAuthor({ .setAuthor({

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Message, TextBasedChannel } from 'discord.js'; import { Message, MessageFlagsBitField, TextBasedChannel } from 'discord.js';
import { ChannelType } from 'discord.js'; import { ChannelType } from 'discord.js';
import { Duration, DurationFormatter } from '@sapphire/time-utilities'; import { Duration, DurationFormatter } from '@sapphire/time-utilities';
import { isNumber } from '#utils/maths'; import { isNumber } from '#utils/maths';
@ -61,8 +61,8 @@ export class SlowmodeCommand extends Command {
if (channel === null) { if (channel === null) {
await interaction.reply({ await interaction.reply({
content: 'Could not fetch channel!', content: 'Could not fetch channel!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js'; import { GuildMember, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
export class SoftMuteCommand extends Command { export class SoftMuteCommand extends Command {
@ -64,8 +64,8 @@ export class SoftMuteCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching the guild!', content: 'Error fetching the guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -77,8 +77,8 @@ export class SoftMuteCommand extends Command {
if (guildMember === undefined) { if (guildMember === undefined) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching user!', content: 'Error fetching user!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -87,7 +87,7 @@ export class SoftMuteCommand extends Command {
await guildMember.roles.remove(IDs.roles.restrictions.softMute); await guildMember.roles.remove(IDs.roles.restrictions.softMute);
await interaction.reply({ await interaction.reply({
content: `Removed soft muted for ${user}`, content: `Removed soft muted for ${user}`,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -96,7 +96,7 @@ export class SoftMuteCommand extends Command {
await interaction.reply({ await interaction.reply({
content: `Soft muted ${user}`, content: `Soft muted ${user}`,
fetchReply: true, withResponse: true,
}); });
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { GuildMember, Message } from 'discord.js'; import { GuildMember, Message, MessageFlagsBitField } from 'discord.js';
import { import {
addMute, addMute,
removeMute, removeMute,
@ -73,8 +73,8 @@ export class VCMuteCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -87,8 +87,8 @@ export class VCMuteCommand extends Command {
if (member === undefined || mod === undefined) { if (member === undefined || mod === undefined) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching user!', content: 'Error fetching user!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -102,8 +102,8 @@ export class VCMuteCommand extends Command {
await interaction.reply({ await interaction.reply({
content: `Removed server mute from ${user}`, content: `Removed server mute from ${user}`,
fetchReply: true, flags: MessageFlagsBitField.Flags.Ephemeral,
ephemeral: true, withResponse: true,
}); });
return; return;
} }
@ -118,8 +118,8 @@ export class VCMuteCommand extends Command {
await addMute(member.id, mod.id, reason); await addMute(member.id, mod.id, reason);
await interaction.reply({ await interaction.reply({
content: `Server muted ${user}`, content: `Server muted ${user}`,
fetchReply: true, flags: MessageFlagsBitField.Flags.Ephemeral,
ephemeral: true, withResponse: true,
}); });
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import { EmbedBuilder, TextChannel } from 'discord.js'; import { EmbedBuilder, MessageFlagsBitField } from 'discord.js';
import type { Message, Guild, User } from 'discord.js'; import type { Message, Guild, User } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { import {
@ -68,15 +68,17 @@ export class DeleteWarningCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
const staffChannel = checkStaff(interaction.channel); const staffChannel = checkStaff(interaction.channel);
await interaction.deferReply({ ephemeral: !staffChannel }); await interaction.deferReply({
flags: staffChannel ? undefined : MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.deleteWarning(warningId, mod, guild); const info = await this.deleteWarning(warningId, mod, guild);
@ -145,25 +147,37 @@ export class DeleteWarningCommand extends Command {
} }
// Log the warnings deletion // Log the warnings deletion
let logChannel = guild.channels.cache.get(IDs.channels.logs.sus) as let logChannel = guild.channels.cache.get(IDs.channels.logs.sus);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch(IDs.channels.logs.sus)) as const fetchLogChannel = await guild.channels
| TextChannel .fetch(IDs.channels.logs.sus)
| undefined; .catch(() => undefined);
if (logChannel === undefined) { if (fetchLogChannel === null || fetchLogChannel === undefined) {
this.container.logger.error( this.container.logger.error(
'Delete Warning Error: Could not fetch log channel', 'Delete Warning: Could not fetch log channel',
); );
info.message = info.message =
`Deleted warning for ${user} (Warning ID: ${warningId} but ` + `Deleted warning for ${user} (Warning ID: ${warningId} but ` +
'could not find the log channel.'; 'could not find the log channel.';
return info; return info;
} else {
logChannel = fetchLogChannel;
} }
} }
if (!logChannel.isSendable()) {
this.container.logger.error(
'Delete Warning: The bot does not have permission to send in the logs channel!',
);
info.message =
`Deleted warning for ${user} (Warning ID: ${warningId} but ` +
"But this hasn't been logged in a text channel as the bot does not have permission to send logs!";
return info;
}
const message = new EmbedBuilder() const message = new EmbedBuilder()
.setColor('#28A745') .setColor('#28A745')
.setAuthor({ .setAuthor({

View File

@ -17,16 +17,17 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import { import {
Args, EmbedBuilder,
Command, Guild,
container, Message,
RegisterBehavior, MessageFlagsBitField,
} from '@sapphire/framework'; Snowflake,
import type { User, Message, Snowflake, Guild, TextChannel } from 'discord.js'; User,
} from 'discord.js';
import { updateUser } from '#utils/database/dbExistingUser'; import { updateUser } from '#utils/database/dbExistingUser';
import { addWarn } from '#utils/database/moderation/warnings'; import { addWarn } from '#utils/database/moderation/warnings';
import { EmbedBuilder } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
export class WarnCommand extends Command { export class WarnCommand extends Command {
@ -76,8 +77,8 @@ export class WarnCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -190,21 +191,32 @@ export class WarnCommand extends Command {
await user.send({ embeds: [dmEmbed] }).catch(() => {}); await user.send({ embeds: [dmEmbed] }).catch(() => {});
// Log the ban // Log the ban
let logChannel = guild.channels.cache.get(IDs.channels.logs.sus) as let logChannel = guild.channels.cache.get(IDs.channels.logs.sus);
| TextChannel
| undefined;
if (logChannel === undefined) { if (logChannel === undefined) {
logChannel = (await guild.channels.fetch(IDs.channels.logs.sus)) as const fetchLogChannel = await guild.channels
| TextChannel .fetch(IDs.channels.logs.sus)
| undefined; .catch(() => undefined);
if (logChannel === undefined) {
container.logger.error('Warn Error: Could not fetch log channel'); if (fetchLogChannel === null || fetchLogChannel === undefined) {
this.container.logger.error('Warn: Could not fetch log channel');
info.message = `Warned ${user} but could not find the log channel. This has been logged to the database.`; info.message = `Warned ${user} but could not find the log channel. This has been logged to the database.`;
return info; return info;
} else {
logChannel = fetchLogChannel;
} }
} }
if (!logChannel.isSendable()) {
this.container.logger.error(
'Warn: The bot does not have permission to send in the logs channel!',
);
info.message = `Warned ${user}, but the bot does not have permission to send in the logs channel!`;
return info;
}
const message = new EmbedBuilder() const message = new EmbedBuilder()
.setColor('#FF6700') .setColor('#FF6700')
.setAuthor({ .setAuthor({

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import { ChannelType, EmbedBuilder } from 'discord.js'; import { ChannelType, EmbedBuilder, MessageFlagsBitField } from 'discord.js';
import type { Message, Guild, User } from 'discord.js'; import type { Message, Guild, User } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { fetchWarnings } from '#utils/database/moderation/warnings'; import { fetchWarnings } from '#utils/database/moderation/warnings';
@ -65,15 +65,17 @@ export class WarningsCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
const staffChannel = checkStaff(interaction.channel); const staffChannel = checkStaff(interaction.channel);
await interaction.deferReply({ ephemeral: !staffChannel }); await interaction.deferReply({
flags: staffChannel ? undefined : MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.warnings(user, guild); const info = await this.warnings(user, guild);

View File

@ -19,7 +19,12 @@
import { Subcommand } from '@sapphire/plugin-subcommands'; import { Subcommand } from '@sapphire/plugin-subcommands';
import { RegisterBehavior } from '@sapphire/framework'; import { RegisterBehavior } from '@sapphire/framework';
import { ChannelType, PermissionsBitField, Snowflake } from 'discord.js'; import {
ChannelType,
MessageFlagsBitField,
PermissionsBitField,
Snowflake,
} from 'discord.js';
import { updateUser } from '#utils/database/dbExistingUser'; import { updateUser } from '#utils/database/dbExistingUser';
import { import {
addStatUser, addStatUser,
@ -190,7 +195,7 @@ export class OutreachCommand extends Subcommand {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Mod or guild was not found!', content: 'Mod or guild was not found!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -200,7 +205,7 @@ export class OutreachCommand extends Subcommand {
if (mod === undefined) { if (mod === undefined) {
await interaction.reply({ await interaction.reply({
content: 'Outreach Leader was not found!', content: 'Outreach Leader was not found!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -208,7 +213,7 @@ export class OutreachCommand extends Subcommand {
if (!mod.roles.cache.has(IDs.roles.staff.outreachLeader)) { if (!mod.roles.cache.has(IDs.roles.staff.outreachLeader)) {
await interaction.reply({ await interaction.reply({
content: 'You need to be an Outreach Leader to run this command!', content: 'You need to be an Outreach Leader to run this command!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -216,7 +221,7 @@ export class OutreachCommand extends Subcommand {
if (await checkActiveEvent()) { if (await checkActiveEvent()) {
await interaction.reply({ await interaction.reply({
content: 'There is already an active event!', content: 'There is already an active event!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -227,7 +232,7 @@ export class OutreachCommand extends Subcommand {
await interaction.reply({ await interaction.reply({
content: 'Created the event!', content: 'Created the event!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
} }
@ -238,7 +243,7 @@ export class OutreachCommand extends Subcommand {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Guild not found!', content: 'Guild not found!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -248,7 +253,7 @@ export class OutreachCommand extends Subcommand {
if (mod === undefined) { if (mod === undefined) {
await interaction.reply({ await interaction.reply({
content: 'Your guild member was not found!', content: 'Your guild member was not found!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
@ -256,12 +261,14 @@ export class OutreachCommand extends Subcommand {
if (!mod.roles.cache.has(IDs.roles.staff.outreachLeader)) { if (!mod.roles.cache.has(IDs.roles.staff.outreachLeader)) {
await interaction.reply({ await interaction.reply({
content: 'You need to be an Outreach Leader to run this command!', content: 'You need to be an Outreach Leader to run this command!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const event = await getCurrentEvent(); const event = await getCurrentEvent();
@ -351,12 +358,14 @@ export class OutreachCommand extends Subcommand {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Guild not found!', content: 'Guild not found!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
if ((await getStatFromLeader(leader.id)) !== null) { if ((await getStatFromLeader(leader.id)) !== null) {
await interaction.editReply( await interaction.editReply(
@ -462,12 +471,14 @@ export class OutreachCommand extends Subcommand {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Could not find guild!', content: 'Could not find guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
let statId: number; let statId: number;
let roleId: Snowflake | undefined; let roleId: Snowflake | undefined;
@ -571,12 +582,14 @@ export class OutreachCommand extends Subcommand {
if (leader === null) { if (leader === null) {
await interaction.reply({ await interaction.reply({
content: 'Could not find your user!', content: 'Could not find your user!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const stat = await getStatFromLeader(leader.id); const stat = await getStatFromLeader(leader.id);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -62,13 +62,15 @@ export class BookClubCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageBookClub(user, mod, guild); const info = await this.manageBookClub(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -63,13 +63,15 @@ export class DebateHostCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageDebateHost(user, mod, guild); const info = await this.manageDebateHost(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -62,13 +62,15 @@ export class GameNightHostCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageGameNight(user, mod, guild); const info = await this.manageGameNight(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -62,13 +62,15 @@ export class GuestCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageGuest(user, mod, guild); const info = await this.manageGuest(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -63,13 +63,15 @@ export class MentorCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageMentor(user, mod, guild); const info = await this.manageMentor(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -62,13 +62,15 @@ export class ModCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageMod(user, mod, guild); const info = await this.manageMod(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -63,13 +63,15 @@ export class RestrictedAccessCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageRestrictedAccess(user, mod, guild); const info = await this.manageRestrictedAccess(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -62,13 +62,15 @@ export class StageHostCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageStageHost(user, mod, guild); const info = await this.manageStageHost(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -63,13 +63,15 @@ export class TrialModCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageMod(user, mod, guild); const info = await this.manageMod(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -62,13 +62,15 @@ export class TrialVerifierCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageTrialVerifier(user, mod, guild); const info = await this.manageTrialVerifier(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -62,13 +62,15 @@ export class VerifierCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageVerifier(user, mod, guild); const info = await this.manageVerifier(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -65,13 +65,15 @@ export class ActivistCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageActivist(user, mod, guild); const info = await this.manageActivist(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -64,13 +64,15 @@ export class ARAVeganCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageVegan(user, mod, guild); const info = await this.manageVegan(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -63,13 +63,15 @@ export class ConvincedCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageConvinced(user, mod, guild); const info = await this.manageConvinced(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -63,7 +63,7 @@ export class PlusCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -63,13 +63,15 @@ export class TrustedCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageTrusted(user, mod, guild); const info = await this.manageTrusted(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -65,13 +65,15 @@ export class VeganCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageVegan(user, mod, guild); const info = await this.manageVegan(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Guild, User, Message } from 'discord.js'; import { Guild, User, Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { roleAddLog, roleRemoveLog } from '#utils/logging/role'; import { roleAddLog, roleRemoveLog } from '#utils/logging/role';
@ -63,13 +63,15 @@ export class VegCuriousCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
const info = await this.manageVegCurious(user, mod, guild); const info = await this.manageVegCurious(user, mod, guild);

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import type { Message } from 'discord.js'; import { Message, MessageFlagsBitField } from 'discord.js';
export class ApplyCommand extends Command { export class ApplyCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) { public constructor(context: Command.LoaderContext, options: Command.Options) {
@ -47,8 +47,8 @@ export class ApplyCommand extends Command {
public async chatInputRun(interaction: Command.ChatInputCommandInteraction) { public async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
await interaction.reply({ await interaction.reply({
content: this.message, content: this.message,
fetchReply: true, flags: MessageFlagsBitField.Flags.Ephemeral,
ephemeral: true, withResponse: true,
}); });
} }

View File

@ -18,7 +18,7 @@
*/ */
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import type { Message } from 'discord.js'; import { Message, MessageFlagsBitField } from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
export class RenameUserCommand extends Command { export class RenameUserCommand extends Command {
@ -47,22 +47,22 @@ export class RenameUserCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await guild.members.fetch(); await guild.members.fetch();
const vegan = await guild.roles.cache.get(IDs.roles.vegan.vegan); const vegan = guild.roles.cache.get(IDs.roles.vegan.vegan);
const notVegan = await guild.roles.cache.get(IDs.roles.nonvegan.nonvegan); const notVegan = guild.roles.cache.get(IDs.roles.nonvegan.nonvegan);
if (vegan === undefined || notVegan === undefined) { if (vegan === undefined || notVegan === undefined) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching roles!', content: 'Error fetching roles!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -71,7 +71,7 @@ export class RenameUserCommand extends Command {
content: content:
`${vegan.name}s: \`${vegan.members.size}\`` + `${vegan.name}s: \`${vegan.members.size}\`` +
`\n${notVegan.name}s: \`${notVegan.members.size}\``, `\n${notVegan.name}s: \`${notVegan.members.size}\``,
fetchReply: true, withResponse: true,
}); });
} }
@ -88,8 +88,8 @@ export class RenameUserCommand extends Command {
await guild.members.fetch(); await guild.members.fetch();
const vegan = await guild.roles.cache.get(IDs.roles.vegan.vegan); const vegan = guild.roles.cache.get(IDs.roles.vegan.vegan);
const notVegan = await guild.roles.cache.get(IDs.roles.nonvegan.nonvegan); const notVegan = guild.roles.cache.get(IDs.roles.nonvegan.nonvegan);
if (vegan === undefined || notVegan === undefined) { if (vegan === undefined || notVegan === undefined) {
await message.react('❌'); await message.react('❌');

View File

@ -19,6 +19,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { MessageFlagsBitField } from 'discord.js';
export class InfoCommand extends Command { export class InfoCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) { public constructor(context: Command.LoaderContext, options: Command.Options) {
@ -66,11 +67,7 @@ export class InfoCommand extends Command {
const option = interaction.options.getString('info', true); const option = interaction.options.getString('info', true);
let ephemeral = interaction.options.getBoolean('visible'); let ephemeral = interaction.options.getBoolean('visible');
if (ephemeral === null) { ephemeral = ephemeral !== true;
ephemeral = true;
} else {
ephemeral = !ephemeral;
}
let message: string; let message: string;
@ -115,7 +112,7 @@ export class InfoCommand extends Command {
await interaction.reply({ await interaction.reply({
content: message, content: message,
ephemeral, flags: ephemeral ? MessageFlagsBitField.Flags.Ephemeral : undefined,
}); });
} }
} }

View File

@ -18,7 +18,13 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { Message, User, Guild, Snowflake } from 'discord.js'; import {
Message,
User,
Guild,
Snowflake,
MessageFlagsBitField,
} from 'discord.js';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { import {
finishVerifyMessages, finishVerifyMessages,
@ -77,8 +83,8 @@ export class VerifyCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
@ -93,7 +99,7 @@ export class VerifyCommand extends Command {
await interaction.reply({ await interaction.reply({
content: verify.message, content: verify.message,
fetchReply: true, withResponse: true,
}); });
} }

View File

@ -20,6 +20,7 @@
import { Command, RegisterBehavior } from '@sapphire/framework'; import { Command, RegisterBehavior } from '@sapphire/framework';
import IDs from '#utils/ids'; import IDs from '#utils/ids';
import { checkVerificationFinish } from '#utils/database/verification'; import { checkVerificationFinish } from '#utils/database/verification';
import { MessageFlagsBitField } from 'discord.js';
export class VerifyTimeoutRemoveCommand extends Command { export class VerifyTimeoutRemoveCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) { public constructor(context: Command.LoaderContext, options: Command.Options) {
@ -60,13 +61,15 @@ export class VerifyTimeoutRemoveCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Error fetching guild!', content: 'Error fetching guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
fetchReply: true, withResponse: true,
}); });
return; return;
} }
await interaction.deferReply({ ephemeral: true }); await interaction.deferReply({
flags: MessageFlagsBitField.Flags.Ephemeral,
});
let member = guild.members.cache.get(user.id); let member = guild.members.cache.get(user.id);

View File

@ -18,7 +18,7 @@
*/ */
import { Args, Command, RegisterBehavior } from '@sapphire/framework'; import { Args, Command, RegisterBehavior } from '@sapphire/framework';
import type { User, Guild, Message } from 'discord.js'; import { User, Guild, Message, MessageFlagsBitField } from 'discord.js';
import { EmbedBuilder } from 'discord.js'; import { EmbedBuilder } from 'discord.js';
import { getRank, xpToNextLevel } from '#utils/database/fun/xp'; import { getRank, xpToNextLevel } from '#utils/database/fun/xp';
@ -55,7 +55,7 @@ export class RankCommand extends Command {
if (guild === null) { if (guild === null) {
await interaction.reply({ await interaction.reply({
content: 'Could not find the guild!', content: 'Could not find the guild!',
ephemeral: true, flags: MessageFlagsBitField.Flags.Ephemeral,
}); });
return; return;
} }

View File

@ -134,11 +134,7 @@ export class FixRolesOnReady extends Listener {
if ( if (
restricted || restricted ||
member.roles.cache.has(IDs.roles.restrictions.restricted1) || member.roles.cache.hasAny(...IDs.roles.restrictions.restricted)
member.roles.cache.has(IDs.roles.restrictions.restricted2) ||
member.roles.cache.has(IDs.roles.restrictions.restricted3) ||
member.roles.cache.has(IDs.roles.restrictions.restricted4) ||
member.roles.cache.has(IDs.roles.restrictions.restrictedVegan)
) { ) {
continue; continue;
} }