mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Soundboard Random by Default
This commit is contained in:
@@ -22,11 +22,12 @@ module.exports = class SoundboardCommand extends Command {
|
|||||||
key: 'sound',
|
key: 'sound',
|
||||||
prompt: 'What sound would you like to play?',
|
prompt: 'What sound would you like to play?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
default: sounds[Math.floor(Math.random() * sounds.length)],
|
||||||
validate: sound => {
|
validate: sound => {
|
||||||
if (sounds.includes(sound.toLowerCase())) return true;
|
if (sounds.includes(sound.toLowerCase())) return true;
|
||||||
return 'Invalid Sound. Use `help soundboard` for a list of sounds.';
|
return 'Invalid Sound. Use `help soundboard` for a list of sounds.';
|
||||||
},
|
},
|
||||||
parse: sound => sound.toLowerCase()
|
parse: sound => path.join(__dirname, '..', '..', 'assets', 'sounds', `${sound.toLowerCase()}.mp3`)
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -43,7 +44,7 @@ module.exports = class SoundboardCommand extends Command {
|
|||||||
if (this.client.voiceConnections.has(channel.guild.id)) return msg.say('I am already playing a sound.');
|
if (this.client.voiceConnections.has(channel.guild.id)) return msg.say('I am already playing a sound.');
|
||||||
const connection = await channel.join();
|
const connection = await channel.join();
|
||||||
await msg.react('🔊');
|
await msg.react('🔊');
|
||||||
const dispatcher = connection.playFile(path.join(__dirname, '..', '..', 'assets', 'sounds', `${sound}.mp3`));
|
const dispatcher = connection.playFile(sound, { volume: 0.25 });
|
||||||
dispatcher.once('end', () => {
|
dispatcher.once('end', () => {
|
||||||
channel.leave();
|
channel.leave();
|
||||||
msg.react('✅');
|
msg.react('✅');
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "31.1.3",
|
"version": "31.1.4",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user