Haha-Yes/commands/utility/invite.js

54 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2018-12-30 01:20:24 +01:00
const { Command } = require('discord-akairo');
2018-12-25 19:17:07 +01:00
const { supportServer } = require('../../config.json');
2018-12-30 01:20:24 +01:00
class InviteCommand extends Command {
2019-01-02 08:09:45 +01:00
constructor() {
super('invite', {
aliases: ['invite'],
category: 'utility',
2019-11-09 12:04:01 +01:00
clientPermissions: ['SEND_MESSAGES'],
args: [
{
id: 'here',
2019-06-23 03:41:59 +02:00
match: 'flag',
flag: '--here'
2019-09-12 21:11:39 +02:00
},
{
id: 'member',
type: 'user'
}
],
2019-01-02 08:09:45 +01:00
description: {
2019-09-12 21:15:59 +02:00
content: 'Send invite link for the bot and support server\nCan also show the invite for other bot if you mention him',
2018-12-30 01:20:24 +01:00
usage: '',
examples: ['']
}
2019-01-02 08:09:45 +01:00
});
}
2018-09-07 19:07:10 +02:00
async exec(message, args) {
2019-09-12 21:11:39 +02:00
if (args.member) {
if (args.member.bot) {
2019-09-12 21:17:01 +02:00
return message.channel.send(`You can add the bot you mentioned with this link: https://discordapp.com/oauth2/authorize?client_id=${args.member.id}&scope=bot&permissions=0\n\`Note: The invite might not work if the bot is not public\``);
2019-09-12 21:11:39 +02:00
} else {
return message.channel.send('Sorry, the user you mentioned is not a bot!');
}
} else {
2021-02-11 15:27:07 +01:00
let invMessage = `You can add me from here: https://discord.com/oauth2/authorize?client_id=${this.client.user.id}&scope=bot&permissions=0\nYou can also join my support server over here: ${supportServer} come and say hi :)`;
2019-09-12 21:13:39 +02:00
if (args.here) {
message.channel.send(invMessage);
} else {
return message.author.send(invMessage)
.catch(() => {
return message.channel.send('I could not dm you! Do you have dm enabled or haven\'t blocked me?');
})
.then(() => {
return message.channel.send('Check your dm');
});
2019-09-12 21:13:39 +02:00
}
}
2019-01-02 08:09:45 +01:00
}
2018-12-30 01:20:24 +01:00
}
2021-02-11 15:27:07 +01:00
module.exports = InviteCommand;