summaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-13 06:06:51 -0700
committer8cy <[email protected]>2020-04-13 06:06:51 -0700
commit2a04861aa3fb8b3e22fd3fdcb3ac5aed5eb85756 (patch)
tree4c1289e2eed7ee1f6ef27abea33b5538206be0ef /src/commands
parenttypescript final (diff)
downloads5nical-test.tar.xz
s5nical-test.zip
final final typescript loltest
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/voice/fart.js209
-rw-r--r--src/commands/voice/moan.js30
-rw-r--r--src/commands/voice/squeak.js29
-rw-r--r--src/commands/voice/wahoo.js30
4 files changed, 0 insertions, 298 deletions
diff --git a/src/commands/voice/fart.js b/src/commands/voice/fart.js
deleted file mode 100644
index 394a2d5..0000000
--- a/src/commands/voice/fart.js
+++ /dev/null
@@ -1,209 +0,0 @@
-// TODO: shits broken bc i cant get variables from different scopes
-/*
-const ytdl = require('ytdl-core');
-const { Command } = require('discord.js-commando');
-const { MessageEmbed } = require('discord.js');
-const Youtube = require('simple-youtube-api');
-//const { youtubeAPI } = require('../../config.json');
-const youtube = new Youtube('AIzaSyB9xJENORzZt-GmOGx4WsNCPgKSIxhJcds');
-const emoji = require('emoji-random');
-
-module.exports = class FartVoice extends Command {
- constructor(client) {
- super(client, {
- name: 'fart',
- group: 'voice',
- memberName: 'fart',
- description: 'gives you a random fart',
- guildOnly: true,
- clientPermissions: ['SPEAK', 'CONNECT'],
- examples: ['s5n!fart']
- });
- }
- async run(msg) {
- var fartNum = Math.floor((Math.random() * 8) + 1);
- if (fartNum == 1) {
- var fartMsg = 'you got fart 1, courtesy of sin ' + emoji.random();
- var fartTitle = 'fart 1';
- var fartAudio = '../../assets/audio/farts/1.mp3';
- } else if (fartNum == 2) {
- var fartMsg = 'you got fart 2, courtesy of sin ' + emoji.random();
- var fartTitle = 'fart 2';
- var fartAudio = '../../assets/audio/farts/2.mp3';
- } else if (fartNum == 3) {
- var fartMsg = 'you got fart 3, courtesy of sin ' + emoji.random();
- var fartTitle = 'fart 3';
- var fartAudio = '../../assets/audio/farts/3.mp3';
- } else if (fartNum == 4) {
- var fartMsg = 'you got fart 4, courtesy of sin ' + emoji.random();
- var fartTitle = 'fart 4';
- var fartAudio = '../../assets/audio/farts/4.mp3';
- } else if (fartNum == 5) {
- var fartMsg = 'you got fart 5, courtesy of sin ' + emoji.random();
- var fartTitle = 'fart 5';
- var fartAudio = '../../assets/audio/farts/5.mp3';
- } else if (fartNum == 6) {
- var fartMsg = 'you got fart 6, courtesy of nick ' + emoji.random();
- var fartTitle = 'fart 6';
- var fartAudio = '../../assets/audio/farts/6.mp3';
- } else if (fartNum == 7) {
- var fartMsg = 'you got fart 7, courtesy of nick ' + emoji.random();
- var fartTitle = 'fart 7';
- var fartAudio = '../../assets/audio/farts/7.mp3';
- } else if (fartNum == 8) {
- var fartMsg = 'you got fart 8, courtesy of nick ' + emoji.random();
- var fartTitle = 'fart 8';
- var fartAudio = '../../assets/audio/farts/8.mp3';
- }
-
- const voiceChannel = msg.member.voice.channel;
- if (!voiceChannel) return msg.say('join a channel and try again ' + emoji.random());
-
- const video = await fartAudio;
- // // can be uncommented if you don't want the bot to play live streams
- // if (video.raw.snippet.liveBroadcastContent === 'live') {
- // return msg.say("I don't support live streams!");
- // }
- // // can be uncommented if you don't want the bot to play videos longer than 1 hour
- // if (video.duration.hours !== 0) {
- // return msg.say('I cannot play videos longer than 1 hour');
- // }
- // // can be uncommented if you want to limit the queue
- // if (msg.guild.musicData.queue.length > 10) {
- // return msg.say(
- // 'There are too many songs in the queue already, skip or wait a bit'
- // );
- // }
- msg.guild.musicData.queue.push(
- this.constructSongObj(video, voiceChannel)
- );
- if (
- msg.guild.musicData.isPlaying == false ||
- typeof msg.guild.musicData.isPlaying == 'undefined'
- ) {
- msg.guild.musicData.isPlaying = true;
- return this.playSong(msg.guild.musicData.queue, msg);
- } else if (msg.guild.musicData.isPlaying == true) {
- msg.reply(fartMsg);
- msg.say(fartTitle, 'added to queue ' + emoji.random());
- return
- }
-
- var that = this;
- msg.channel
- .awaitMessages(
- function (msg) {
- return (msg.content > 0 && msg.content < 6) || msg.content === 'exit';
- }, {
- max: 1,
- time: 60000,
- errors: ['time']
- }
- )
- .then(function (response) {
- const videoIndex = parseInt(response.first().content);
- if (response.first().content === 'exit') return songEmbed.delete();
- youtube
- .then(function (video) {
- // // can be uncommented if you don't want the bot to play live streams
- // if (video.raw.snippet.liveBroadcastContent === 'live') {
- // songEmbed.delete();
- // return msg.say("I don't support live streams!");
- // }
-
- // // can be uncommented if you don't want the bot to play videos longer than 1 hour
- // if (video.duration.hours !== 0) {
- // songEmbed.delete();
- // return msg.say('I cannot play videos longer than 1 hour');
- // }
-
- // // can be uncommented if you don't want to limit the queue
- // if (msg.guild.musicData.queue.length > 10) {
- // songEmbed.delete();
- // return msg.say(
- // 'There are too many songs in the queue already, skip or wait a bit'
- // );
- // }
- msg.guild.musicData.queue.push(
- that.constructSongObj(video, voiceChannel)
- );
- if (msg.guild.musicData.isPlaying == false) {
- msg.guild.musicData.isPlaying = true;
- if (songEmbed) {
- songEmbed.delete();
- }
- that.playSong(msg.guild.musicData.queue, msg);
- } else if (msg.guild.musicData.isPlaying == true) {
- if (songEmbed) {
- songEmbed.delete();
- }
- return msg.say(fartTitle, 'added to queue ' + emoji.random());
- }
- })
- .catch(function () {
- if (songEmbed) {
- songEmbed.delete();
- }
- return msg.say(
- 'an error has occured when trying to get the video file ' + emoji.random()
- );
- });
- });
- }
- playSong(queue, msg) {
- const classThis = this; // use classThis instead of 'this' because of lexical scope below
- queue[0].voiceChannel
- .join()
- .then(function (connection) {
- const dispatcher = connection
- .play(
- fartAudio // TODO: broken here
- )
- .on('start', function () {
- msg.guild.musicData.songDispatcher = dispatcher;
- const volume = 100 / 100;
- msg.guild.musicData.volume = volume;
- dispatcher.setVolume(msg.guild.musicData.volume);
- const videoEmbed = new MessageEmbed()
- .setThumbnail(queue[0].thumbnail)
- .setColor(0xF97DAE)
- .addField('now playing:', queue[0].title)
- .addField('duration:', queue[0].duration);
- if (queue[1]) videoEmbed.addField('next song:', queue[1].title);
- msg.say(videoEmbed);
- msg.guild.musicData.nowPlaying = queue[0];
- return queue.shift();
- })
- .on('finish', function () {
- if (queue.length >= 1) {
- return classThis.playSong(queue, msg);
- } else {
- msg.guild.musicData.isPlaying = false;
- msg.guild.musicData.nowPlaying = null;
- msg.guild.musicData.songDispatcher = null;
- return msg.guild.me.voice.channel.leave();
- }
- })
- .on('error', function (e) {
- msg.say('can\'t play song ' + emoji.random());
- console.error(e);
- msg.guild.musicData.queue.length = 0;
- msg.guild.musicData.isPlaying = false;
- msg.guild.musicData.nowPlaying = null;
- msg.guild.musicData.songDispatcher = null;
- return msg.guild.me.voice.channel.leave();
- });
- })
- .catch(function (e) {
- console.error(e);
- return msg.guild.me.voice.channel.leave();
- });
- }
- constructSongObj(video, voiceChannel) {
- return { // TODO: and broken here
- url: 'fart',
- title: 'fart 1',
- voiceChannel
- };
- }
-}; \ No newline at end of file
diff --git a/src/commands/voice/moan.js b/src/commands/voice/moan.js
deleted file mode 100644
index 03824e3..0000000
--- a/src/commands/voice/moan.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const { Command } = require('discord.js-commando');
-const emoji = require('emoji-random');
-
-module.exports = class MoanVoice extends Command {
- constructor(client) {
- super(client, {
- name: 'moan',
- aliases: ['uhhhh'],
- group: 'voice',
- memberName: 'moan',
- description: 'uhhhh',
- guildOnly: true,
- examples: ['s5n!moan', 's5n!uhhhh']
- });
- }
- async run(msg) {
- if (msg.member.voice.channel && !msg.guild.voice) {
- const connection = await msg.member.voice.channel.join();
- const dispatcher = connection.play('./assets/audio/uhhhh.wav');
-
- dispatcher.on('finish', () => {
- connection.disconnect();
- });
- } else if (msg.guild.voice) {
- msg.reply('i\'m already playing that lol ' + emoji.random());
- } else {
- msg.reply('you need to join a voice channel first silly ' + emoji.random());
- }
- }
-}; \ No newline at end of file
diff --git a/src/commands/voice/squeak.js b/src/commands/voice/squeak.js
deleted file mode 100644
index 9d2b6a3..0000000
--- a/src/commands/voice/squeak.js
+++ /dev/null
@@ -1,29 +0,0 @@
-const { Command } = require('discord.js-commando');
-const emoji = require('emoji-random');
-
-module.exports = class SqueakVoice extends Command {
- constructor(client) {
- super(client, {
- name: 'squeak',
- group: 'voice',
- memberName: 'squeak',
- description: 'squeak',
- guildOnly: true,
- examples: ['s5n!queak']
- });
- }
- async run(msg) {
- if (msg.member.voice.channel && !msg.guild.voice) {
- const connection = await msg.member.voice.channel.join();
- const dispatcher = connection.play('./assets/audio/squeak.wav');
-
- dispatcher.on('finish', () => {
- connection.disconnect();
- });
- } else if (msg.guild.voice) {
- msg.reply('i\'m already playing that lol ' + emoji.random());
- } else {
- msg.reply('you need to join a voice channel first silly ' + emoji.random());
- }
- }
-}; \ No newline at end of file
diff --git a/src/commands/voice/wahoo.js b/src/commands/voice/wahoo.js
deleted file mode 100644
index a791795..0000000
--- a/src/commands/voice/wahoo.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const { Command } = require('discord.js-commando');
-const emoji = require('emoji-random');
-
-module.exports = class WahooVoice extends Command {
- constructor(client) {
- super(client, {
- name: 'wahoo',
- aliases: ['mario'],
- group: 'voice',
- memberName: 'wahoo',
- description: 'wahoo',
- guildOnly: true,
- examples: ['s5n!wahoo', 's5n!mario']
- });
- }
- async run(msg) {
- if (msg.member.voice.channel && !msg.guild.voice) {
- const connection = await msg.member.voice.channel.join();
- const dispatcher = connection.play('../../assets/audio/wahoo.mp3');
-
- dispatcher.on('finish', () => {
- connection.disconnect();
- });
- } else if (msg.guild.voice) {
- msg.reply('i\'m already playing that lol ' + emoji.random());
- } else {
- msg.reply('you need to join a voice channel first silly ' + emoji.random());
- }
- }
-}; \ No newline at end of file