summaryrefslogtreecommitdiff
path: root/src/bot/commands/owner/say.ts
blob: 31eb78c33edd15697c0a6798831bb66b4d000b20 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Command } from 'discord-akairo';
import { Message } from 'discord.js';

export default class SayCommand extends Command {
	public constructor() {
		super('say', {
			aliases: ['say'],
			clientPermissions: ['SEND_MESSAGES', 'MANAGE_MESSAGES'],
			description: {
				content: "Speak as the bot.",
			},
			category: 'owner',
			ownerOnly: true,
            args: [
                {
                    id: 'message',
                    match: 'text',
                }
            ]
		});
	}

	public async exec(msg: Message, { message }: { message: any }): Promise<Message | Message[]> {
		msg.delete();
        
        let owners = process.env.OWNERS!.split(',');
        if (!owners.includes(msg.author.id)) return msg.author.send('You are missing permissions to use this command!');
        if (!message) return msg.author.send('You did not specify what you want me to say!');

		return msg.util!.send(message);
	}
}