diff --git a/README.md b/README.md index 224250e6..58a04302 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You can add XiaoBot to your server with [this link](https://discordapp.com/oauth You can join the home server with [this link](https://discord.gg/fqQF8mc). ## Modules -[discord.js](https://discord.js.org), [commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://visionmedia.github.io/superagent), [mathjs](http://mathjs.org), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [canvas](https://github.com/Automattic/node-canvas), [cheerio](https://cheerio.js.org), [sequelize](http://docs.sequelizejs.com), [pg](https://github.com/brianc/node-postgres), [tsubaki](https://github.com/iCrawl/tsubaki) +[discord.js](https://discord.js.org), [commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://visionmedia.github.io/superagent), [mathjs](http://mathjs.org), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [canvas](https://github.com/Automattic/node-canvas), [cheerio](https://cheerio.js.org), [sequelize](http://docs.sequelizejs.com), [pg](https://github.com/brianc/node-postgres), [tsubaki](https://github.com/iCrawl/tsubaki), [node-opus](https://github.com/Rantanen/node-opus) ## APIs [Wattpad](https://developer.wattpad.com), [Wordnik](http://developer.wordnik.com), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link), [YuGiOh](http://docs.yugiohprices.apiary.io), [YouTube](https://developers.google.com/youtube), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com), [Yahoo Weather](https://developer.yahoo.com/weather), [Google Maps](https://developers.google.com/maps), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [rrrather](http://www.rrrather.com/botapi), [SoundCloud](https://developers.soundcloud.com), [random.cat](http://random.cat), [random.dog](https://random.dog), [fixer.io](http://fixer.io), [konachan](https://konachan.net), [cleverbot.io](https://cleverbot.io) diff --git a/assets/json/soundboard.json b/assets/json/soundboard.json new file mode 100644 index 00000000..a1c84124 --- /dev/null +++ b/assets/json/soundboard.json @@ -0,0 +1,42 @@ +{ + names: [ + "airhorn", + "cat", + "doh", + "dun dun dun", + "eat my shorts", + "glados bird", + "it's a trap", + "mario death", + "no this is patrick", + "pikachu", + "pokemon center", + "space", + "spongebob", + "ugly barnacle", + "vader", + "woohoo", + "wumbo", + "zelda chest" + ], + paths: { + "airhorn": "airhorn.mp3", + "cat": "cat.mp3", + "doh": "doh.mp3", + "dun dun dun": "dun-dun-dun.mp3", + "eat my shorts": "eat-my-shorts.mp3", + "glados bird": "glados-bird.mp3", + "it's a trap": "its-a-trap.mp3", + "mario death": "mario-death.mp3", + "no this is patrick": "no-this-is-patrick.mp3", + "pikachu": "pikachu.mp3", + "pokemon center": "pokemon-center.mp3", + "space": "space.mp3", + "spongebob": "spongebob.mp3", + "ugly barnacle": "ugly-barnacle.mp3", + "vader": "vader.mp3", + "woohoo": "woohoo.mp3", + "wumbo": "wumbo.mp3", + "zelda chest": "zelda-chest.mp3" + } +} diff --git a/assets/sounds/airhorn.mp3 b/assets/sounds/airhorn.mp3 new file mode 100644 index 00000000..88fd671d Binary files /dev/null and b/assets/sounds/airhorn.mp3 differ diff --git a/assets/sounds/cat.mp3 b/assets/sounds/cat.mp3 new file mode 100644 index 00000000..79484ed9 Binary files /dev/null and b/assets/sounds/cat.mp3 differ diff --git a/assets/sounds/doh.mp3 b/assets/sounds/doh.mp3 new file mode 100644 index 00000000..07634a1f Binary files /dev/null and b/assets/sounds/doh.mp3 differ diff --git a/assets/sounds/dun-dun-dun.mp3 b/assets/sounds/dun-dun-dun.mp3 new file mode 100644 index 00000000..c3037f8b Binary files /dev/null and b/assets/sounds/dun-dun-dun.mp3 differ diff --git a/assets/sounds/eat-my-shorts.mp3 b/assets/sounds/eat-my-shorts.mp3 new file mode 100644 index 00000000..537a5c02 Binary files /dev/null and b/assets/sounds/eat-my-shorts.mp3 differ diff --git a/assets/sounds/glados-bird.mp3 b/assets/sounds/glados-bird.mp3 new file mode 100644 index 00000000..41d850ab Binary files /dev/null and b/assets/sounds/glados-bird.mp3 differ diff --git a/assets/sounds/its-a-trap.mp3 b/assets/sounds/its-a-trap.mp3 new file mode 100644 index 00000000..3d9597dc Binary files /dev/null and b/assets/sounds/its-a-trap.mp3 differ diff --git a/assets/sounds/mario-death.mp3 b/assets/sounds/mario-death.mp3 new file mode 100644 index 00000000..5d97899b Binary files /dev/null and b/assets/sounds/mario-death.mp3 differ diff --git a/assets/sounds/no-this-is-patrick.mp3 b/assets/sounds/no-this-is-patrick.mp3 new file mode 100644 index 00000000..0ca29e01 Binary files /dev/null and b/assets/sounds/no-this-is-patrick.mp3 differ diff --git a/assets/sounds/pikachu.mp3 b/assets/sounds/pikachu.mp3 new file mode 100644 index 00000000..8e817ceb Binary files /dev/null and b/assets/sounds/pikachu.mp3 differ diff --git a/assets/sounds/pokemon-center.mp3 b/assets/sounds/pokemon-center.mp3 new file mode 100644 index 00000000..bca7c07c Binary files /dev/null and b/assets/sounds/pokemon-center.mp3 differ diff --git a/assets/sounds/space.mp3 b/assets/sounds/space.mp3 new file mode 100644 index 00000000..0a3ad350 Binary files /dev/null and b/assets/sounds/space.mp3 differ diff --git a/assets/sounds/spongebob.mp3 b/assets/sounds/spongebob.mp3 new file mode 100644 index 00000000..6917a08f Binary files /dev/null and b/assets/sounds/spongebob.mp3 differ diff --git a/assets/sounds/ugly-barnacle.mp3 b/assets/sounds/ugly-barnacle.mp3 new file mode 100644 index 00000000..3f9d075f Binary files /dev/null and b/assets/sounds/ugly-barnacle.mp3 differ diff --git a/assets/sounds/vader.mp3 b/assets/sounds/vader.mp3 new file mode 100644 index 00000000..12f158d8 Binary files /dev/null and b/assets/sounds/vader.mp3 differ diff --git a/assets/sounds/woohoo.mp3 b/assets/sounds/woohoo.mp3 new file mode 100644 index 00000000..d4a52976 Binary files /dev/null and b/assets/sounds/woohoo.mp3 differ diff --git a/assets/sounds/wumbo.mp3 b/assets/sounds/wumbo.mp3 new file mode 100644 index 00000000..f83b258d Binary files /dev/null and b/assets/sounds/wumbo.mp3 differ diff --git a/assets/sounds/zelda-chest.mp3 b/assets/sounds/zelda-chest.mp3 new file mode 100644 index 00000000..30d70ded Binary files /dev/null and b/assets/sounds/zelda-chest.mp3 differ diff --git a/commands/random/soundboard.js b/commands/random/soundboard.js new file mode 100644 index 00000000..b073dcc6 --- /dev/null +++ b/commands/random/soundboard.js @@ -0,0 +1,54 @@ +const { Command } = require('discord.js-commando'); +const { names, paths } = require('../../assets/json/soundboard'); +const path = require('path'); + +module.exports = class SoundboardCommand extends Command { + constructor(client) { + super(client, { + name: 'soundboard', + group: 'random', + memberName: 'soundboard', + description: 'Plays a sound in your voice channel.', + details: `**Sounds:** ${names.join(', ')}`, + guildOnly: true, + args: [ + { + key: 'sound', + prompt: 'What sound would you like to play?', + type: 'string', + validate: sound => { + if (names.includes(sound.toLowerCase())) return true; + return 'Invalid Sound. Use `help soundboard` for a list of sounds.'; + }, + parse: sound => sound.toLowerCase() + } + ] + }); + } + + async run(msg, args) { + if (!msg.channel.permissionsFor(this.client.user).hasPermission('CONNECT')) + return msg.say('This Command requires the `Connect` Permission.'); + if (!msg.channel.permissionsFor(this.client.user).hasPermission('SPEAK')) + return msg.say('This Command requires the `Speak` Permission.'); + if (!msg.channel.permissionsFor(this.client.user).hasPermission('ADD_REACTIONS')) + return msg.say('This Command requires the `Add Reactions` Permission.'); + const voiceChannel = msg.member.voiceChannel; + if (!voiceChannel) return msg.say('Please enter a Voice Channel first.'); + const alreadyConnected = this.client.voiceConnections.get(voiceChannel.guild.id); + if (alreadyConnected) return msg.say('I am already playing a sound.'); + const { sound } = args; + try { + const connection = await voiceChannel.join(); + msg.react('🔊'); + const dispatcher = connection.playStream(path.join(__dirname, '..', '..', 'assets', 'sounds', paths[sound])); + dispatcher.on('end', () => { + voiceChannel.leave(); + msg.react('✅'); + return null; + }); + } catch (err) { + return msg.say(err); + } + } +}; diff --git a/commands/util/info.js b/commands/util/info.js index c7123443..2bf4b3c1 100644 --- a/commands/util/info.js +++ b/commands/util/info.js @@ -59,7 +59,8 @@ module.exports = class InfoCommand extends Command { [cheerio](https://cheerio.js.org), [sequelize](http://docs.sequelizejs.com), [pg](https://github.com/brianc/node-postgres), - [tsubaki](https://github.com/iCrawl/tsubaki) + [tsubaki](https://github.com/iCrawl/tsubaki), + [node-opus](https://github.com/Rantanen/node-opus) ` ) .addField('APIs', diff --git a/html/carbondesc.html b/html/carbondesc.html index 55c11d9c..c64813f9 100644 --- a/html/carbondesc.html +++ b/html/carbondesc.html @@ -29,7 +29,8 @@