mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Add option to not send typing status
This commit is contained in:
@@ -6,7 +6,8 @@ module.exports = class NoopCommand extends Command {
|
|||||||
name: 'noop',
|
name: 'noop',
|
||||||
aliases: ['no-op', 'nop'],
|
aliases: ['no-op', 'nop'],
|
||||||
group: 'other',
|
group: 'other',
|
||||||
description: 'Does nothing.'
|
description: 'Does nothing.',
|
||||||
|
sendTyping: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ module.exports = class HiCommand extends Command {
|
|||||||
name: 'hi',
|
name: 'hi',
|
||||||
aliases: ['hello', 'hey', 'hoi', 'hola'],
|
aliases: ['hello', 'hey', 'hoi', 'hola'],
|
||||||
group: 'single',
|
group: 'single',
|
||||||
description: 'Hello.'
|
description: 'Hello.',
|
||||||
|
sendTyping: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -71,9 +71,9 @@ module.exports = class CommandClient extends Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.dispatcher.isCommand(msg)) return;
|
if (!this.dispatcher.isCommand(msg)) return;
|
||||||
await msg.channel.sendTyping();
|
|
||||||
const parsed = await this.dispatcher.parseMessage(msg);
|
const parsed = await this.dispatcher.parseMessage(msg);
|
||||||
if (parsed.error) {
|
if (parsed.error) {
|
||||||
|
await msg.channel.sendTyping();
|
||||||
const helpUsage = this.registry.commands.get('help').usage(parsed.command.name);
|
const helpUsage = this.registry.commands.get('help').usage(parsed.command.name);
|
||||||
await msg.reply(stripIndents`
|
await msg.reply(stripIndents`
|
||||||
${parsed.error}
|
${parsed.error}
|
||||||
@@ -84,6 +84,7 @@ module.exports = class CommandClient extends Client {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { command, args } = parsed;
|
const { command, args } = parsed;
|
||||||
|
if (command.sendTyping) await msg.channel.sendTyping();
|
||||||
if (msg.guild && command.clientPermissions.length) {
|
if (msg.guild && command.clientPermissions.length) {
|
||||||
for (const permission of command.clientPermissions) {
|
for (const permission of command.clientPermissions) {
|
||||||
if (msg.channel.permissionsFor(this.user).has(permission)) continue;
|
if (msg.channel.permissionsFor(this.user).has(permission)) continue;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ module.exports = class Command {
|
|||||||
this.guarded = options.guarded || false;
|
this.guarded = options.guarded || false;
|
||||||
this.unknown = options.unknown || false;
|
this.unknown = options.unknown || false;
|
||||||
this.throttling = options.throttling || { usages: 2, duration: 5 };
|
this.throttling = options.throttling || { usages: 2, duration: 5 };
|
||||||
|
this.sendTyping = typeof options.sendTyping === 'undefined' ? true : Boolean(options.sendTyping);
|
||||||
this.credit = options.credit || [];
|
this.credit = options.credit || [];
|
||||||
this.credit.push({
|
this.credit.push({
|
||||||
name: 'Lily is Silly',
|
name: 'Lily is Silly',
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "152.4.9",
|
"version": "152.4.10",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user