mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Merge soundboard and airhorn, aliases, improve command formats
This commit is contained in:
@@ -15,7 +15,7 @@ You can invite the bot to your server using
|
||||
Be sure to also join the [home server](https://discord.gg/sbMe32W) for
|
||||
information and support.
|
||||
|
||||
## Commands (303)
|
||||
## Commands (302)
|
||||
### Utility:
|
||||
|
||||
* **prefix**: Shows or sets the command prefix.
|
||||
@@ -217,7 +217,6 @@ information and support.
|
||||
|
||||
### Voice Channel:
|
||||
|
||||
* **airhorn**: Plays an airhorn sound in your voice channel.
|
||||
* **leave-voice-channel**: Leaves a voice channel, in case the bot gets stuck.
|
||||
* **soundboard**: Plays a sound in your voice channel.
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"airhorn": "airhorn.mp3",
|
||||
"alarm": "alarm.mp3",
|
||||
"ayaya": "ayaya.mp3",
|
||||
"car crash": "car-crash.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.
@@ -33,8 +33,7 @@ module.exports = class NekoAtsumePasswordCommand extends Command {
|
||||
The current Neko Atsume password is **${data.password}**.
|
||||
It will expire in **${duration(data.expires - data.date)}**.
|
||||
|
||||
${data.gold} ${this.goldFish}
|
||||
${data.silver} ${this.silverFish}
|
||||
${data.gold} ${this.goldFish} ${data.silver} ${this.silverFish}
|
||||
`);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = class RedditCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'reddit',
|
||||
aliases: ['subreddit'],
|
||||
aliases: ['subreddit', 'r/'],
|
||||
group: 'random',
|
||||
memberName: 'reddit',
|
||||
description: 'Responds with a random post from a subreddit.',
|
||||
|
||||
@@ -10,6 +10,7 @@ module.exports = class FlickrCommand extends Command {
|
||||
group: 'search',
|
||||
memberName: 'flickr',
|
||||
description: 'Searches Flickr for your query.',
|
||||
nsfw: true,
|
||||
args: [
|
||||
{
|
||||
key: 'query',
|
||||
|
||||
@@ -5,7 +5,7 @@ module.exports = class Rule34Command extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rule34',
|
||||
aliases: ['rule34-image'],
|
||||
aliases: ['rule34-image', 'r34'],
|
||||
group: 'search',
|
||||
memberName: 'rule34',
|
||||
description: 'Responds with an image from Rule34, with optional query.',
|
||||
|
||||
@@ -6,7 +6,7 @@ module.exports = class WikihowCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'wikihow',
|
||||
aliases: ['wikihow-article', 'how-to'],
|
||||
aliases: ['wikihow-article', 'how-to', 'how'],
|
||||
group: 'search',
|
||||
memberName: 'wikihow',
|
||||
description: 'Searches Wikihow for your query.',
|
||||
@@ -15,7 +15,7 @@ module.exports = class WikihowCommand extends Command {
|
||||
key: 'query',
|
||||
prompt: 'What article would you like to search for?',
|
||||
type: 'string',
|
||||
parse: query => query.replace(/^(how to)/i, '')
|
||||
parse: query => query.replace(/^((how )?to)/i, '')
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const sounds = fs.readdirSync(path.join(__dirname, '..', '..', 'assets', 'sounds', 'airhorn'));
|
||||
|
||||
module.exports = class AirhornCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'airhorn',
|
||||
group: 'voice',
|
||||
memberName: 'airhorn',
|
||||
description: 'Plays an airhorn sound in your voice channel.',
|
||||
guildOnly: true,
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const channel = msg.member.voiceChannel;
|
||||
if (!channel) return msg.reply('Please enter a voice channel first.');
|
||||
if (!channel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK'])) {
|
||||
return msg.reply('Missing the "Connect" or "Speak" permission for the voice channel.');
|
||||
}
|
||||
if (!channel.joinable) return msg.reply('Your voice channel is not joinable.');
|
||||
if (this.client.voiceConnections.has(channel.guild.id)) return msg.reply('I am already playing a sound.');
|
||||
try {
|
||||
const connection = await channel.join();
|
||||
const airhorn = sounds[Math.floor(Math.random() * sounds.length)];
|
||||
const dispatcher = connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', 'airhorn', airhorn));
|
||||
dispatcher.once('finish', () => channel.leave());
|
||||
dispatcher.once('error', () => channel.leave());
|
||||
return null;
|
||||
} catch (err) {
|
||||
channel.leave();
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
};
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "80.1.2",
|
||||
"version": "81.0.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
@@ -48,8 +48,8 @@
|
||||
"zlib-sync": "^0.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^5.0.0",
|
||||
"eslint-config-amber": "^1.0.2",
|
||||
"eslint": "^5.0.1",
|
||||
"eslint-config-amber": "^1.0.3",
|
||||
"eslint-plugin-json": "^1.2.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
||||
Reference in New Issue
Block a user