11 |
import PunishmentType from '../../types/PunishmentType'; |
import PunishmentType from '../../types/PunishmentType'; |
12 |
import ModerationEmbed from '../../utils/ModerationEmbed'; |
import ModerationEmbed from '../../utils/ModerationEmbed'; |
13 |
|
|
14 |
export default class BeanCommand extends BaseCommand { |
export default class ShotCommand extends BaseCommand { |
15 |
supportsInteractions: boolean = true; |
supportsInteractions: boolean = true; |
16 |
supportsContextMenu: boolean = true; |
supportsContextMenu: boolean = true; |
17 |
|
|
18 |
constructor() { |
constructor() { |
19 |
super('bean', 'moderation', ['Bean']); |
super('shot', 'moderation', ['Shot']); |
20 |
} |
} |
21 |
|
|
22 |
async run(client: DiscordClient, msg: Message | CommandInteraction | ContextMenuInteraction, options: CommandOptions | InteractionOptions) { |
async run(client: DiscordClient, msg: Message | CommandInteraction | ContextMenuInteraction, options: CommandOptions | InteractionOptions) { |
88 |
|
|
89 |
try { |
try { |
90 |
await Punishment.create({ |
await Punishment.create({ |
91 |
type: PunishmentType.BEAN, |
type: PunishmentType.SHOT, |
92 |
user_id: user.id, |
user_id: user.id, |
93 |
guild_id: msg.guild!.id, |
guild_id: msg.guild!.id, |
94 |
mod_id: msg.member!.user.id, |
mod_id: msg.member!.user.id, |
96 |
reason |
reason |
97 |
}); |
}); |
98 |
|
|
99 |
await History.create(user.id, msg.guild!, 'bean', msg.member!.user.id, typeof reason === 'undefined' ? null : reason); |
// await History.create(user.id, msg.guild!, 'bean', msg.member!.user.id, typeof reason === 'undefined' ? null : reason); |
100 |
|
|
101 |
try { |
try { |
102 |
await user.send({ |
await user.send({ |
104 |
new MessageEmbed() |
new MessageEmbed() |
105 |
.setAuthor({ |
.setAuthor({ |
106 |
iconURL: <string> msg.guild!.iconURL(), |
iconURL: <string> msg.guild!.iconURL(), |
107 |
name: `\tYou have been beaned in ${msg.guild!.name}` |
name: `\tYou got a shot in ${msg.guild!.name}` |
108 |
}) |
}) |
109 |
.addFields([ |
.addFields([ |
110 |
{ |
{ |
120 |
dm = false; |
dm = false; |
121 |
} |
} |
122 |
|
|
123 |
await client.logger.logBeaned(user, typeof reason === 'undefined' ? '*No reason provided*' : reason, msg.member!.user as User); |
// await client.logger.logBeaned(user, typeof reason === 'undefined' ? '*No reason provided*' : reason, msg.member!.user as User); |
124 |
} |
} |
125 |
catch (e) { |
catch (e) { |
126 |
console.log(e); |
console.log(e); |
127 |
} |
} |
128 |
|
|
129 |
/*await msg.reply({ |
await msg.reply({ |
130 |
embeds: [ |
embeds: [ |
131 |
new MessageEmbed() |
new MessageEmbed() |
132 |
.setAuthor({ |
.setAuthor({ |
133 |
name: user.user.tag, |
name: user.user.tag, |
134 |
iconURL: user.user.displayAvatarURL(), |
iconURL: user.user.displayAvatarURL(), |
135 |
}) |
}) |
136 |
.setDescription(user.user.tag + " has been beaned." + (!dm ? "\nThey have DMs disabled. They will not know that they have been beaned." : '')) |
.setDescription(user.user.tag + " got a shot." + (!dm ? "\nThey have DMs disabled. They will not know that they got a shot." : '')) |
137 |
.addFields([ |
.addFields([ |
138 |
{ |
{ |
139 |
name: "Beaned by", |
name: "Given by", |
140 |
value: (msg.member!.user as User).tag |
value: (msg.member!.user as User).tag |
141 |
}, |
}, |
142 |
{ |
{ |
145 |
} |
} |
146 |
]) |
]) |
147 |
] |
] |
|
});*/ |
|
|
|
|
|
await msg.reply({ |
|
|
embeds: [ |
|
|
new ModerationEmbed(user.user, msg.member!.user as User, { |
|
|
description: `${user.user.tag} has been beaned.` |
|
|
}) |
|
|
.setReason(reason) |
|
|
] |
|
148 |
}); |
}); |
149 |
} |
} |
150 |
} |
} |