mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-07-07 13:40:59 +02:00
feat(arabot): make ephemeral in list based on staff channel
This commit is contained in:
parent
d90b89d4ac
commit
275da768dd
@ -19,9 +19,13 @@
|
|||||||
|
|
||||||
import { Command, RegisterBehavior, Args } from '@sapphire/framework';
|
import { Command, RegisterBehavior, Args } from '@sapphire/framework';
|
||||||
import {
|
import {
|
||||||
MessageEmbed, MessageActionRow, MessageButton, Constants, ButtonInteraction,
|
MessageEmbed,
|
||||||
|
MessageActionRow,
|
||||||
|
MessageButton,
|
||||||
|
Constants,
|
||||||
|
ButtonInteraction,
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import type { Message, GuildMember } from 'discord.js';
|
import type { Message, GuildMember, TextChannel } from 'discord.js';
|
||||||
import { isMessageInstance } from '@sapphire/discord.js-utilities';
|
import { isMessageInstance } from '@sapphire/discord.js-utilities';
|
||||||
import { addExistingUser, userExists } from '../../utils/database/dbExistingUser';
|
import { addExistingUser, userExists } from '../../utils/database/dbExistingUser';
|
||||||
import {
|
import {
|
||||||
@ -31,6 +35,7 @@ import {
|
|||||||
deactivateNote,
|
deactivateNote,
|
||||||
deactivateAllNotes,
|
deactivateAllNotes,
|
||||||
} from '../../utils/database/sus';
|
} from '../../utils/database/sus';
|
||||||
|
import { checkStaff } from '../../utils/checker';
|
||||||
import IDs from '../../utils/ids';
|
import IDs from '../../utils/ids';
|
||||||
|
|
||||||
// TODO add a check when they join the server to give the user the sus role again
|
// TODO add a check when they join the server to give the user the sus role again
|
||||||
@ -186,6 +191,15 @@ class SusCommand extends Command {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let staffChannel = false;
|
||||||
|
let { channel } = interaction;
|
||||||
|
if (channel !== null) {
|
||||||
|
if (channel.type === 'GUILD_TEXT') {
|
||||||
|
channel = channel as TextChannel;
|
||||||
|
staffChannel = checkStaff(channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Gets the sus notes from the database
|
// Gets the sus notes from the database
|
||||||
const notes = await findNotes(user.id, true);
|
const notes = await findNotes(user.id, true);
|
||||||
|
|
||||||
@ -223,7 +237,7 @@ class SusCommand extends Command {
|
|||||||
// Sends the notes to the user
|
// Sends the notes to the user
|
||||||
await interaction.reply({
|
await interaction.reply({
|
||||||
embeds: [noteEmbed],
|
embeds: [noteEmbed],
|
||||||
ephemeral: true,
|
ephemeral: !staffChannel,
|
||||||
fetchReply: true,
|
fetchReply: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user