summaryrefslogtreecommitdiff
path: root/src/commands/bot/guildbackdoor.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/bot/guildbackdoor.ts')
-rw-r--r--src/commands/bot/guildbackdoor.ts54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/commands/bot/guildbackdoor.ts b/src/commands/bot/guildbackdoor.ts
new file mode 100644
index 0000000..1282cdd
--- /dev/null
+++ b/src/commands/bot/guildbackdoor.ts
@@ -0,0 +1,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())
+ }
+}; \ No newline at end of file