From c64e919c14548cec1ba912ab48ece03b295bc89b Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 13 Apr 2025 14:28:21 -0400 Subject: [PATCH] Add option to not send typing status --- commands/other/noop.js | 3 ++- commands/single/hi.js | 3 ++- framework/Client.js | 3 ++- framework/Command.js | 1 + package.json | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/commands/other/noop.js b/commands/other/noop.js index 7055b32f..771e1953 100644 --- a/commands/other/noop.js +++ b/commands/other/noop.js @@ -6,7 +6,8 @@ module.exports = class NoopCommand extends Command { name: 'noop', aliases: ['no-op', 'nop'], group: 'other', - description: 'Does nothing.' + description: 'Does nothing.', + sendTyping: false }); } diff --git a/commands/single/hi.js b/commands/single/hi.js index dbfc82a9..545708d6 100644 --- a/commands/single/hi.js +++ b/commands/single/hi.js @@ -6,7 +6,8 @@ module.exports = class HiCommand extends Command { name: 'hi', aliases: ['hello', 'hey', 'hoi', 'hola'], group: 'single', - description: 'Hello.' + description: 'Hello.', + sendTyping: false }); } diff --git a/framework/Client.js b/framework/Client.js index 05b19892..78ddf107 100644 --- a/framework/Client.js +++ b/framework/Client.js @@ -71,9 +71,9 @@ module.exports = class CommandClient extends Client { } if (!this.dispatcher.isCommand(msg)) return; - await msg.channel.sendTyping(); const parsed = await this.dispatcher.parseMessage(msg); if (parsed.error) { + await msg.channel.sendTyping(); const helpUsage = this.registry.commands.get('help').usage(parsed.command.name); await msg.reply(stripIndents` ${parsed.error} @@ -84,6 +84,7 @@ module.exports = class CommandClient extends Client { return; } const { command, args } = parsed; + if (command.sendTyping) await msg.channel.sendTyping(); if (msg.guild && command.clientPermissions.length) { for (const permission of command.clientPermissions) { if (msg.channel.permissionsFor(this.user).has(permission)) continue; diff --git a/framework/Command.js b/framework/Command.js index dab8b9e1..66a105d7 100644 --- a/framework/Command.js +++ b/framework/Command.js @@ -21,6 +21,7 @@ module.exports = class Command { this.guarded = options.guarded || false; this.unknown = options.unknown || false; this.throttling = options.throttling || { usages: 2, duration: 5 }; + this.sendTyping = typeof options.sendTyping === 'undefined' ? true : Boolean(options.sendTyping); this.credit = options.credit || []; this.credit.push({ name: 'Lily is Silly', diff --git a/package.json b/package.json index 3b971f13..6ae76dcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "152.4.9", + "version": "152.4.10", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {