From b5793611d57a734d75b6a0845c441f33d144a5c0 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Wed, 4 Aug 2021 19:32:39 -0400 Subject: misc --- src/commands/utilities/hash.ts | 2 +- src/commands/utilities/youtube.ts | 59 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/commands/utilities/youtube.ts (limited to 'src/commands/utilities') diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index 633a263..16ace93 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -3,7 +3,7 @@ import got from 'got'; import { BushCommand, BushMessage } from '../../lib'; export default class HashCommand extends BushCommand { - constructor() { + public constructor() { super('hash', { aliases: ['hash'], category: 'utilities', diff --git a/src/commands/utilities/youtube.ts b/src/commands/utilities/youtube.ts new file mode 100644 index 0000000..0198173 --- /dev/null +++ b/src/commands/utilities/youtube.ts @@ -0,0 +1,59 @@ +import { VoiceChannel } from 'discord.js'; +import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; + +export default class YouTubeCommand extends BushCommand { + constructor() { + super('youtube', { + aliases: ['youtube', 'yt'], + category: 'utilities', + description: { + content: "Allows the user to have access to discord's in-app YouTube experiment.", + usage: 'yt ', + examples: ['yt 785281831788216364'] + }, + args: [ + { + id: 'channel', + type: 'voiceChannel', + prompt: { + start: 'What channel would you like to use?', + retry: '{error} Choose a valid voice channel' + } + } + ], + slash: true, + slashOptions: [ + { + name: 'channel', + description: 'What channel would you like to use?', + type: 'CHANNEL', + required: true + } + ], + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES'] + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, args: { channel: VoiceChannel }): Promise { + if (!args.channel?.id || args.channel?.type != 'GUILD_VOICE') + return await message.util.reply(`${util.emojis.error} Choose a valid voice channel`); + + // @ts-ignore: jank typings + // prettier-ignore + const invite = await this.client.api.channels(args.channel.id).invites.post({ + data: { + validate: null, + max_age: 604800, + max_uses: 0, + target_type: 2, + target_application_id: '755600276941176913', + temporary: false + } + }) + .catch(() => {}); + if (!invite || !invite.code) + return await message.util.reply(`${this.client.util.emojis.error} An error occurred while generating your invite.`); + else return await message.util.send(`https://discord.gg/${invite.code}`); + } +} -- cgit