1 |
import { Util, CommandInteraction, GuildMember, Interaction, Message, MessageAttachment } from 'discord.js'; |
2 |
import BaseCommand from '../../utils/structures/BaseCommand'; |
3 |
import DiscordClient from '../../client/Client'; |
4 |
import CommandOptions from '../../types/CommandOptions'; |
5 |
import InteractionOptions from '../../types/InteractionOptions'; |
6 |
|
7 |
export default class AFKCommand extends BaseCommand { |
8 |
supportsInteractions = true; |
9 |
|
10 |
constructor() { |
11 |
super('afk', 'utils', []); |
12 |
} |
13 |
|
14 |
async run(client: DiscordClient, message: Message | CommandInteraction, options: CommandOptions | InteractionOptions) { |
15 |
let status = options.isInteraction ? options.options.getString("reason") ?? undefined : options.args.join(" "); |
16 |
|
17 |
if (message instanceof Message) { |
18 |
status = status?.trim() === '' ? undefined : status; |
19 |
} |
20 |
|
21 |
await client.afkEngine.toggle(message, true, status); |
22 |
} |
23 |
} |