diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-08-04 19:32:39 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-08-04 19:32:39 -0400 |
commit | b5793611d57a734d75b6a0845c441f33d144a5c0 (patch) | |
tree | 1deb4dc4cd0e1e575b1bc32ed0ae50085c7a3ecf /src/commands/utilities | |
parent | 41c532de2c7786b2bb8ba5d78f092fed3cc6b63a (diff) | |
download | tanzanite-b5793611d57a734d75b6a0845c441f33d144a5c0.tar.gz tanzanite-b5793611d57a734d75b6a0845c441f33d144a5c0.tar.bz2 tanzanite-b5793611d57a734d75b6a0845c441f33d144a5c0.zip |
misc
Diffstat (limited to 'src/commands/utilities')
-rw-r--r-- | src/commands/utilities/hash.ts | 2 | ||||
-rw-r--r-- | src/commands/utilities/youtube.ts | 59 |
2 files changed, 60 insertions, 1 deletions
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 <channel>', + 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<unknown> { + 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}`); + } +} |