1 |
import { BanOptions, CommandInteraction, ContextMenuInteraction, GuildMember, Interaction, Message, User } from 'discord.js'; |
import { CommandInteraction, ContextMenuInteraction, GuildMember, Message, User } from 'discord.js'; |
2 |
import BaseCommand from '../../utils/structures/BaseCommand'; |
import BaseCommand from '../../utils/structures/BaseCommand'; |
3 |
import DiscordClient from '../../client/Client'; |
import DiscordClient from '../../client/Client'; |
4 |
import CommandOptions from '../../types/CommandOptions'; |
import CommandOptions from '../../types/CommandOptions'; |
32 |
let user: GuildMember; |
let user: GuildMember; |
33 |
let dm = true; |
let dm = true; |
34 |
let reason: string | undefined; |
let reason: string | undefined; |
35 |
|
|
36 |
if (options.isInteraction) { |
if (options.isInteraction) { |
37 |
user = await <GuildMember> (msg instanceof ContextMenuInteraction ? options.options.getMember('user') : options.options.getMember('member')); |
user = await <GuildMember> (msg instanceof ContextMenuInteraction ? options.options.getMember('user') : options.options.getMember('member')); |
38 |
|
|
83 |
} |
} |
84 |
} |
} |
85 |
|
|
86 |
|
if (user.id === client.user?.id) { |
87 |
|
await msg.reply({ |
88 |
|
content: "Oh no no no... wait wait, you can't just do that with me!?!? Can you?", |
89 |
|
files: ['https://tenor.com/view/are-you-even-capable-vera-bennett-wentworth-can-you-handle-this-are-you-qualified-gif-22892513.gif'] |
90 |
|
}); |
91 |
|
|
92 |
|
return; |
93 |
|
} |
94 |
|
|
95 |
|
const anonymous = options.isInteraction ? options.options.getBoolean('anonymous') ?? false : false; |
96 |
|
|
97 |
try { |
try { |
98 |
await Punishment.create({ |
await Punishment.create({ |
99 |
type: PunishmentType.SHOT, |
type: PunishmentType.SHOT, |
119 |
{ |
{ |
120 |
name: "Reason", |
name: "Reason", |
121 |
value: typeof reason === 'undefined' ? '*No reason provided*' : reason |
value: typeof reason === 'undefined' ? '*No reason provided*' : reason |
122 |
} |
}, |
123 |
|
...(!anonymous ? [{ |
124 |
|
name: "💉 Doctor", |
125 |
|
value: `${(msg.member?.user as User).tag}` |
126 |
|
}] : []) |
127 |
]) |
]) |
128 |
] |
] |
129 |
}); |
}); |
149 |
.setDescription(user.user.tag + " got a shot." + (!dm ? "\nThey have DMs disabled. They will not know that they got a shot." : '')) |
.setDescription(user.user.tag + " got a shot." + (!dm ? "\nThey have DMs disabled. They will not know that they got a shot." : '')) |
150 |
.addFields([ |
.addFields([ |
151 |
{ |
{ |
152 |
name: "Given by", |
name: "💉 Doctor", |
153 |
value: (msg.member!.user as User).tag |
value: (msg.member!.user as User).tag |
154 |
}, |
}, |
155 |
{ |
{ |