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' ] ,
2019-01-21 22:13:02 +01:00
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-21 22:13:02 +01:00
}
] ,
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
2019-01-21 22:13:02 +01: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!' ) ;
}
2019-09-12 21:09:48 +02:00
} else {
2019-09-12 21:13:39 +02:00
let invMessage = ` You can add me from here: https://discordapp.com/oauth2/authorize?client_id= ${ this . client . user . id } &scope=bot&permissions=0 \n You can also join my support server over here: ${ supportServer } come and say hi :) ` ;
if ( args . here ) {
message . channel . send ( invMessage ) ;
} else {
2020-07-16 09:46:08 +02:00
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-21 22:13:02 +01:00
}
2019-01-02 08:09:45 +01:00
}
2018-12-30 01:20:24 +01:00
}
module . exports = InviteCommand ;