feat(arabot): add DMs when given role

This commit is contained in:
smyalygames 2023-01-15 14:00:39 +00:00
parent 5879c1a610
commit be0b57890d
4 changed files with 20 additions and 4 deletions

View File

@ -51,10 +51,11 @@ class BookClubCommand extends Command {
// TODO add database updates
// Get the arguments
const user = interaction.options.getUser('user');
const mod = interaction.member;
const { guild } = interaction;
// Checks if all the variables are of the right type
if (user === null || guild === null) {
if (user === null || mod === null || guild === null) {
await interaction.reply({
content: 'Error fetching user!',
ephemeral: true,
@ -93,6 +94,9 @@ class BookClubCommand extends Command {
content: `Gave ${user} the ${bookClub.name} role!`,
fetchReply: true,
});
await user.send(`You have been given the ${bookClub.name} role by ${mod}!`)
.catch(() => {});
}
public async messageRun(message: Message, args: Args) {

View File

@ -51,10 +51,11 @@ class DebateHostCommand extends Command {
// TODO add database updates
// Get the arguments
const user = interaction.options.getUser('user');
const mod = interaction.member;
const { guild } = interaction;
// Checks if all the variables are of the right type
if (user === null || guild === null) {
if (user === null || mod === null || guild === null) {
await interaction.reply({
content: 'Error fetching user!',
ephemeral: true,
@ -93,6 +94,9 @@ class DebateHostCommand extends Command {
content: `Gave ${user} the ${debate.name} role!`,
fetchReply: true,
});
await user.send(`You have been given the ${debate.name} role by ${mod}!`)
.catch(() => {});
}
public async messageRun(message: Message, args: Args) {

View File

@ -51,10 +51,11 @@ class GameNightHostCommand extends Command {
// TODO add database updates
// Get the arguments
const user = interaction.options.getUser('user');
const mod = interaction.member;
const { guild } = interaction;
// Checks if all the variables are of the right type
if (user === null || guild === null) {
if (user === null || mod === null || guild === null) {
await interaction.reply({
content: 'Error fetching user!',
ephemeral: true,
@ -93,6 +94,9 @@ class GameNightHostCommand extends Command {
content: `Gave ${user} the ${game.name} role!`,
fetchReply: true,
});
await user.send(`You have been given the ${game.name} role by ${mod}!`)
.catch(() => {});
}
public async messageRun(message: Message, args: Args) {

View File

@ -51,10 +51,11 @@ class StageHostCommand extends Command {
// TODO add database updates
// Get the arguments
const user = interaction.options.getUser('user');
const mod = interaction.member;
const { guild } = interaction;
// Checks if all the variables are of the right type
if (user === null || guild === null) {
if (user === null || mod === null || guild === null) {
await interaction.reply({
content: 'Error fetching user!',
ephemeral: true,
@ -93,6 +94,9 @@ class StageHostCommand extends Command {
content: `Gave ${user} the ${stageHost.name} role!`,
fetchReply: true,
});
await user.send(`You have been given the ${stageHost.name} role by ${mod}!`)
.catch(() => {});
}
public async messageRun(message: Message, args: Args) {