diff options
| author | 8cy <[email protected]> | 2020-07-07 03:55:21 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-07-07 03:55:21 -0700 |
| commit | 385b0960abdc8bb13172330a973dafd56560cf8d (patch) | |
| tree | 86e85d23404a5170ffbf870a6faeba77b3430e0e /src/commands/voice | |
| parent | add fanart for emma :star2: (diff) | |
| download | dep-core-385b0960abdc8bb13172330a973dafd56560cf8d.tar.xz dep-core-385b0960abdc8bb13172330a973dafd56560cf8d.zip | |
big cool :star:
- add commenting to bot.ts
- add types to most of the voice commands
- add art and verify cmd for emma
- add roastwilly cmd
- fix rp cmd formatting
Diffstat (limited to 'src/commands/voice')
| -rw-r--r-- | src/commands/voice/abee.ts | 1 | ||||
| -rw-r--r-- | src/commands/voice/itemshop.ts | 4 | ||||
| -rw-r--r-- | src/commands/voice/join.ts | 6 | ||||
| -rw-r--r-- | src/commands/voice/leave.ts | 17 | ||||
| -rw-r--r-- | src/commands/voice/loop.ts | 20 | ||||
| -rw-r--r-- | src/commands/voice/minecraft.ts | 1 | ||||
| -rw-r--r-- | src/commands/voice/pause.ts | 15 | ||||
| -rw-r--r-- | src/commands/voice/play.ts | 1 | ||||
| -rw-r--r-- | src/commands/voice/psycho.ts | 1 | ||||
| -rw-r--r-- | src/commands/voice/queue.ts | 9 | ||||
| -rw-r--r-- | src/commands/voice/remove.ts | 17 | ||||
| -rw-r--r-- | src/commands/voice/resume.ts | 14 | ||||
| -rw-r--r-- | src/commands/voice/shuffle.ts | 20 | ||||
| -rw-r--r-- | src/commands/voice/skip.ts | 15 | ||||
| -rw-r--r-- | src/commands/voice/skipall.ts | 17 | ||||
| -rw-r--r-- | src/commands/voice/skipto.ts | 20 | ||||
| -rw-r--r-- | src/commands/voice/volume.ts | 21 |
17 files changed, 124 insertions, 75 deletions
diff --git a/src/commands/voice/abee.ts b/src/commands/voice/abee.ts index cca429f..2a838f0 100644 --- a/src/commands/voice/abee.ts +++ b/src/commands/voice/abee.ts @@ -1,3 +1,4 @@ +//@ts-nocheck import ytdl from 'ytdl-core'; import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; diff --git a/src/commands/voice/itemshop.ts b/src/commands/voice/itemshop.ts index e06403f..ad5df7b 100644 --- a/src/commands/voice/itemshop.ts +++ b/src/commands/voice/itemshop.ts @@ -1,4 +1,4 @@ -import ytdl from 'ytdl-core'; +/* import ytdl from 'ytdl-core'; import { Command, CommandoMessage } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; import Youtube from 'simple-youtube-api'; @@ -210,4 +210,4 @@ module.exports = class ABeeVoice extends Command { }`; return duration; } -};
\ No newline at end of file +}; */
\ No newline at end of file diff --git a/src/commands/voice/join.ts b/src/commands/voice/join.ts index 07e00db..f1b761d 100644 --- a/src/commands/voice/join.ts +++ b/src/commands/voice/join.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class JoinVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'join', group: 'voice', @@ -17,6 +18,7 @@ module.exports = class JoinVoice extends Command { } }); } + //@ts-ignore run(msg: CommandoMessage) { msg.reply(`\`uwu!join\` has been depricated in favour of a simpler user expirience. Uwufier will now join your channel whenever you request to play something with \`uwu!play\`! ${emoji.random()}`) } diff --git a/src/commands/voice/leave.ts b/src/commands/voice/leave.ts index 9ad9984..28c6250 100644 --- a/src/commands/voice/leave.ts +++ b/src/commands/voice/leave.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class LeaveVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'leave', aliases: ['end', 'stop'], @@ -19,19 +20,23 @@ module.exports = class LeaveVoice extends Command { }, }); } + //@ts-ignore run(msg: CommandoMessage) { var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } + //@ts-ignore if (!msg.guild.musicData.queue) return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); + //@ts-ignore msg.guild.musicData.songDispatcher.end(); + //@ts-ignore msg.guild.musicData.queue.length = 0; return; } diff --git a/src/commands/voice/loop.ts b/src/commands/voice/loop.ts index eb289a4..a12c4e8 100644 --- a/src/commands/voice/loop.ts +++ b/src/commands/voice/loop.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class LoopVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'loop', aliases: ['repeat'], @@ -19,19 +20,20 @@ module.exports = class LoopVoice extends Command { }, }); } + //@ts-ignore run(msg: CommandoMessage) { var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } - msg.say( - `${msg.guild.musicData.nowPlaying.title} added to queue. ` + emoji.random() - ); + //@ts-ignore + msg.say(`${msg.guild.musicData.nowPlaying.title} added to queue. ` + emoji.random()); + //@ts-ignore msg.guild.musicData.queue.unshift(msg.guild.musicData.nowPlaying); return; } diff --git a/src/commands/voice/minecraft.ts b/src/commands/voice/minecraft.ts index 26175d3..742ddde 100644 --- a/src/commands/voice/minecraft.ts +++ b/src/commands/voice/minecraft.ts @@ -1,3 +1,4 @@ +//@ts-nocheck import ytdl from 'ytdl-core'; import { Command, CommandoMessage } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; diff --git a/src/commands/voice/pause.ts b/src/commands/voice/pause.ts index 1f23661..500a320 100644 --- a/src/commands/voice/pause.ts +++ b/src/commands/voice/pause.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class PauseVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'pause', group: 'voice', @@ -18,19 +19,21 @@ module.exports = class PauseVoice extends Command { }, }); } + //@ts-ignore run(msg: CommandoMessage) { var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } msg.say('Song paused :pause_button:'); + //@ts-ignore msg.guild.musicData.songDispatcher.pause(); } };
\ No newline at end of file diff --git a/src/commands/voice/play.ts b/src/commands/voice/play.ts index 398b431..97858a3 100644 --- a/src/commands/voice/play.ts +++ b/src/commands/voice/play.ts @@ -1,3 +1,4 @@ +//@ts-nocheck import ytdl from 'ytdl-core'; import { Command, CommandoMessage } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; diff --git a/src/commands/voice/psycho.ts b/src/commands/voice/psycho.ts index 8df19f8..e8f14bc 100644 --- a/src/commands/voice/psycho.ts +++ b/src/commands/voice/psycho.ts @@ -1,3 +1,4 @@ +//@ts-nocheck import ytdl from 'ytdl-core'; import { Command, CommandoMessage } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; diff --git a/src/commands/voice/queue.ts b/src/commands/voice/queue.ts index 3516a2e..f8afedd 100644 --- a/src/commands/voice/queue.ts +++ b/src/commands/voice/queue.ts @@ -1,9 +1,10 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed }from 'discord.js'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class QueueVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'queue', aliases: [ @@ -38,9 +39,12 @@ module.exports = class QueueVoice extends Command { }); } run(msg: CommandoMessage) { + //@ts-ignore if (msg.guild.musicData.queue.length == 0) return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); + //@ts-ignore const titleArray = []; + //@ts-ignore msg.guild.musicData.queue.map(obj => { titleArray.push(obj.title); }); @@ -48,6 +52,7 @@ module.exports = class QueueVoice extends Command { .setColor(0xFFCC4D) .setTitle('Music Queue ' + emoji.random()); for (let i = 0; i < titleArray.length; i++) { + //@ts-ignore queueEmbed.addField(``, `**${i + 1}**: ` + `${titleArray[i]}`); } return msg.say(queueEmbed); diff --git a/src/commands/voice/remove.ts b/src/commands/voice/remove.ts index 41c8cbf..993a368 100644 --- a/src/commands/voice/remove.ts +++ b/src/commands/voice/remove.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class RemoveVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'remove', group: 'voice', @@ -25,20 +26,22 @@ module.exports = class RemoveVoice extends Command { }, }); } - run(msg: CommandoMessage, { songNumber }) { + run(msg: CommandoMessage, { songNumber }: any) { + //@ts-ignore if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) { return msg.reply('Please enter a valid song. ' + emoji.random()); } var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } + //@ts-ignore msg.guild.musicData.queue.splice(songNumber - 1, 1); return msg.say(`Removed song **#${songNumber}** from current queue. ` + emoji.random()); } diff --git a/src/commands/voice/resume.ts b/src/commands/voice/resume.ts index ffe150b..208fba5 100644 --- a/src/commands/voice/resume.ts +++ b/src/commands/voice/resume.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class ResumeVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'resume', group: 'voice', @@ -22,15 +23,16 @@ module.exports = class ResumeVoice extends Command { var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join a channel and try again. ') + emoji.random(); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } msg.say('Song resumed :play_pause:'); + //@ts-ignore msg.guild.musicData.songDispatcher.resume(); } };
\ No newline at end of file diff --git a/src/commands/voice/shuffle.ts b/src/commands/voice/shuffle.ts index bce34ac..7429f27 100644 --- a/src/commands/voice/shuffle.ts +++ b/src/commands/voice/shuffle.ts @@ -1,9 +1,10 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class ShuffleVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'shuffle', group: 'voice', @@ -23,19 +24,23 @@ module.exports = class ShuffleVoice extends Command { var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } + //@ts-ignore if (msg.guild.musicData.queue.length < 1) return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); + //@ts-ignore shuffleQueue(msg.guild.musicData.queue); + //@ts-ignore const titleArray = []; + //@ts-ignore msg.guild.musicData.queue.map(obj => { titleArray.push(obj.title); }); @@ -43,13 +48,14 @@ module.exports = class ShuffleVoice extends Command { .setColor(0xF97DAE) .setTitle('New Music Queue ' + emoji.random()); for (let i = 0; i < titleArray.length; i++) { + //@ts-ignore queueEmbed.addField(`${i + 1}:`, `${titleArray[i]}`); } return msg.say(queueEmbed); } }; -function shuffleQueue(queue) { +function shuffleQueue(queue: any) { for (let i = queue.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [queue[i], queue[j]] = [queue[j], queue[i]]; diff --git a/src/commands/voice/skip.ts b/src/commands/voice/skip.ts index 1cbe630..b4cef15 100644 --- a/src/commands/voice/skip.ts +++ b/src/commands/voice/skip.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class SkipVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'skip', group: 'voice', @@ -18,16 +19,18 @@ module.exports = class SkipVoice extends Command { }, }); } + //@ts-ignore run(msg: CommandoMessage) { const voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } + //@ts-ignore msg.guild.musicData.songDispatcher.end(); } };
\ No newline at end of file diff --git a/src/commands/voice/skipall.ts b/src/commands/voice/skipall.ts index 7d8b113..c7e0333 100644 --- a/src/commands/voice/skipall.ts +++ b/src/commands/voice/skipall.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class SkipAllVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'skipall', aliases: [ @@ -29,19 +30,23 @@ module.exports = class SkipAllVoice extends Command { }, }); } + //@ts-ignore run(msg: CommandoMessage) { var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } + //@ts-ignore if (!msg.guild.musicData.queue) return msg.say('There aren\'t any songs in the current queue. ' + emoji.random()); + //@ts-ignore msg.guild.musicData.songDispatcher.end(); + //@ts-ignore msg.guild.musicData.queue.length = 0; // clear queue return; } diff --git a/src/commands/voice/skipto.ts b/src/commands/voice/skipto.ts index d11d200..ee4a7ba 100644 --- a/src/commands/voice/skipto.ts +++ b/src/commands/voice/skipto.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class SkipToVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'skipto', group: 'voice', @@ -23,24 +24,29 @@ module.exports = class SkipToVoice extends Command { }, }); } - run(msg: CommandoMessage, { songNumber }) { + //@ts-ignore + run(msg: CommandoMessage, { songNumber }: any) { + //@ts-ignore if (songNumber < 1 && songNumber >= msg.guild.musicData.queue.length) { return msg.reply('Please enter a valid song. ' + emoji.random()); } var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } + //@ts-ignore if (msg.guild.musicData.queue < 1) return msg.reply('There aren\'t any songs in the current queue. ' + emoji.random()); + //@ts-ignore msg.guild.musicData.queue.splice(0, songNumber - 1); + //@ts-ignore msg.guild.musicData.songDispatcher.end(); return; } diff --git a/src/commands/voice/volume.ts b/src/commands/voice/volume.ts index 4851ee7..5678101 100644 --- a/src/commands/voice/volume.ts +++ b/src/commands/voice/volume.ts @@ -1,8 +1,9 @@ -import { Command, CommandoMessage } from 'discord.js-commando'; +import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando'; +//@ts-ignore import emoji from 'emoji-random'; module.exports = class VolumeVoice extends Command { - constructor(client) { + constructor(client: CommandoClient) { super(client, { name: 'volume', aliases: ['vol'], @@ -15,7 +16,7 @@ module.exports = class VolumeVoice extends Command { key: 'wantedVol', prompt: 'What would volume you like? (1 to 200)', type: 'integer', - validate: wantedVol => wantedVol >= 1 && wantedVol <= 200 + validate: (wantedVol: number) => wantedVol >= 1 && wantedVol <= 200 } ], examples: [ @@ -30,20 +31,22 @@ module.exports = class VolumeVoice extends Command { }, }); } - run(msg: CommandoMessage, { wantedVol }) { + run(msg: CommandoMessage, { wantedVol }: any) { var voiceChannel = msg.member.voice.channel; if (!voiceChannel) return msg.reply('Please join a channel and try again. ' + emoji.random()); - if ( - typeof msg.guild.musicData.songDispatcher == 'undefined' || - msg.guild.musicData.songDispatcher == null - ) { + //@ts-ignore + if (typeof msg.guild.musicData.songDispatcher == 'undefined' || + //@ts-ignore + msg.guild.musicData.songDispatcher == null) { return msg.reply('There isn\'t any audio playing right now. ' + emoji.random()); } const volume = wantedVol / 100; + //@ts-ignore msg.guild.musicData.volume = volume; + //@ts-ignore msg.guild.musicData.songDispatcher.setVolume(volume); - msg.reply(`Volume is now: **${wantedVol}%**. ` + emoji.random()); + return msg.reply(`Volume is now: **${wantedVol}%**. ` + emoji.random()); } };
\ No newline at end of file |