/[sudobot]/trunk/src/commands/utils/AFKCommand.ts
ViewVC logotype

Contents of /trunk/src/commands/utils/AFKCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 304 - (show annotations)
Mon Jul 29 17:29:27 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 925 byte(s)
refactor: make the AFK system more detailed (#69)
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 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26