From d2d877832b1e579d60ae6b8d21c299a547cb3770 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Wed, 28 Oct 2020 20:30:12 -0400 Subject: [PATCH] Add loading icon during voice commands --- .env.example | 1 + commands/voice/dec-talk.js | 4 ++++ commands/voice/vocodes.js | 3 +++ package.json | 2 +- 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index a0d83a4d..aa893d0b 100644 --- a/.env.example +++ b/.env.example @@ -26,6 +26,7 @@ FLANKER_EMOJI_ID= FRONT_LINE_EMOJI_ID= SUPPORT_EMOJI_ID= DAMAGE_EMOJI_ID= +LOADING_EMOJI_ID= # Dating info DATING_OFF= diff --git a/commands/voice/dec-talk.js b/commands/voice/dec-talk.js index 967bfcc7..8780765a 100644 --- a/commands/voice/dec-talk.js +++ b/commands/voice/dec-talk.js @@ -1,5 +1,6 @@ const Command = require('../../structures/Command'); const request = require('node-superfetch'); +const { LOADING_EMOJI_ID } = process.env; module.exports = class DECTalkCommand extends Command { constructor(client) { @@ -52,6 +53,9 @@ module.exports = class DECTalkCommand extends Command { return msg.reply(`I am not in a voice channel. Use ${usage} to fix that!`); } try { + if (msg.channel.permissionsFor(this.client.user).has(['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'])) { + await msg.react(LOADING_EMOJI_ID); + } const { url } = await request .get('http://tts.cyzon.us/tts') .query({ text }); diff --git a/commands/voice/vocodes.js b/commands/voice/vocodes.js index 605844e7..b1cbcf83 100644 --- a/commands/voice/vocodes.js +++ b/commands/voice/vocodes.js @@ -51,6 +51,9 @@ module.exports = class VocodesCommand extends Command { return msg.reply(`I am not in a voice channel. Use ${usage} to fix that!`); } try { + if (msg.channel.permissionsFor(this.client.user).has(['ADD_REACTIONS', 'READ_MESSAGE_HISTORY'])) { + await msg.react(LOADING_EMOJI_ID); + } const { body } = await request .post('https://mumble.stream/speak_spectrogram') .send({ diff --git a/package.json b/package.json index 3466df97..30607bab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.34.1", + "version": "119.34.2", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {