mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Soundboard
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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',
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
<li><a href="https://cheerio.js.org">cheerio</a></li>
|
||||
<li><a href="http://docs.sequelizejs.com">sequelize</a></li>
|
||||
<li><a href="https://github.com/brianc/node-postgres">pg</a></li>
|
||||
<li><a hred="https://github.com/iCrawl/tsubaki">tsubaki</a></li>
|
||||
<li><a href="https://github.com/iCrawl/tsubaki">tsubaki</a></li>
|
||||
<li><a href="https://github.com/Rantanen/node-opus">node-opus</a></li>
|
||||
</ul>
|
||||
<h2>APIs</h2>
|
||||
<ul>
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<li>Moderation Commands including Ban/Softban/Kick/Warn/Unban, Lockdown, and Prune, with Customizable Logging!</li>
|
||||
<li>Currency and Temperature Conversion!</li>
|
||||
<li>Tons of Secret Easter Eggs to discover!</li>
|
||||
<li>Soundboard!</li>
|
||||
<li>Calculator!</li>
|
||||
<li>Strawpoll Generation!</li>
|
||||
<li>Events that Happened today in history!</li>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<li>Moderation Commands including Ban/Softban/Kick/Warn/Unban, Lockdown, and Prune, with Customizable Logging!</li>
|
||||
<li>Currency and Temperature Conversion!</li>
|
||||
<li>Tons of Secret Easter Eggs to discover!</li>
|
||||
<li>Soundboard!</li>
|
||||
<li>Calculator!</li>
|
||||
<li>Strawpoll Generation!</li>
|
||||
<li>Events that Happened today in history!</li>
|
||||
@@ -76,7 +77,8 @@
|
||||
<li><a href="https://cheerio.js.org">cheerio</a></li>
|
||||
<li><a href="http://docs.sequelizejs.com">sequelize</a></li>
|
||||
<li><a href="https://github.com/brianc/node-postgres">pg</a></li>
|
||||
<li><a hred="https://github.com/iCrawl/tsubaki">tsubaki</a></li>
|
||||
<li><a href="https://github.com/iCrawl/tsubaki">tsubaki</a></li>
|
||||
<li><a href="https://github.com/Rantanen/node-opus">node-opus</a></li>
|
||||
</ul>
|
||||
<h2>APIs</h2>
|
||||
<ul>
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "19.2.3",
|
||||
"version": "19.3.0",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
@@ -41,6 +41,7 @@
|
||||
"mathjs": "^3.12.2",
|
||||
"moment": "^2.18.1",
|
||||
"moment-duration-format": "^1.3.0",
|
||||
"node-opus": "^0.2.6",
|
||||
"pg": "^6.1.5",
|
||||
"sequelize": "^3.30.4",
|
||||
"superagent": "^3.5.2",
|
||||
|
||||
Reference in New Issue
Block a user