mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 05:51:35 +02:00
Unknown Command Command
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const meant = require('meant');
|
||||||
|
const { stripIndents } = require('common-tags');
|
||||||
|
|
||||||
|
module.exports = class UnknownCommandCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'unknown-command',
|
||||||
|
group: 'util',
|
||||||
|
memberName: 'unknown-command',
|
||||||
|
description: 'Displays help information for when an unknown command is used.',
|
||||||
|
unknown: true,
|
||||||
|
hidden: true,
|
||||||
|
guarded: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(msg) {
|
||||||
|
const commands = this.client.registry.commands.map(c => c.name);
|
||||||
|
const command = msg.content.match(this.client.dispatcher._commandPatterns[this.client.commandPrefix])[2];
|
||||||
|
const didYouMean = meant(command, commands);
|
||||||
|
const inGuild = msg.guild ? undefined : null;
|
||||||
|
return msg.reply(stripIndents`
|
||||||
|
Unknown command. Use ${msg.anyUsage('help', inGuild, inGuild)} to view the command list.
|
||||||
|
|
||||||
|
${didYouMean && didYouMean.length ? `Did You Mean:\n${didYouMean.join('\n')}` : ''}
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
};
|
||||||
+2
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "111.0.3",
|
"version": "111.1.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"gifencoder": "^2.0.1",
|
"gifencoder": "^2.0.1",
|
||||||
"mathjs": "^6.6.1",
|
"mathjs": "^6.6.1",
|
||||||
|
"meant": "^1.0.1",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"moment-duration-format": "^2.3.2",
|
"moment-duration-format": "^2.3.2",
|
||||||
"moment-timezone": "^0.5.28",
|
"moment-timezone": "^0.5.28",
|
||||||
|
|||||||
Reference in New Issue
Block a user