From d69631cef6012ed6f9dd1dbba5add2ad424e66b4 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 3 Dec 2020 09:28:09 -0500 Subject: [PATCH] Make sure to delete phone call when an error occurs --- commands/phone/admin-phone.js | 2 ++ commands/phone/phone.js | 2 ++ package.json | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/phone/admin-phone.js b/commands/phone/admin-phone.js index 8d6e00bc..4f09a8aa 100644 --- a/commands/phone/admin-phone.js +++ b/commands/phone/admin-phone.js @@ -32,6 +32,8 @@ module.exports = class AdminPhoneCommand extends Command { await this.client.phone.get(id).start(); return null; } catch { + const id = `${msg.guild ? msg.channel.id : msg.author.id}:${channel.id}`; + this.client.phone.delete(id); return msg.reply('Failed to start the call. Try again later!'); } } diff --git a/commands/phone/phone.js b/commands/phone/phone.js index 7f5b327a..3c39fa3a 100644 --- a/commands/phone/phone.js +++ b/commands/phone/phone.js @@ -80,6 +80,8 @@ module.exports = class PhoneCommand extends Command { await this.client.phone.get(id).start(); return null; } catch { + const id = `${msg.guild ? msg.channel.id : msg.author.id}:${channel.id}`; + this.client.phone.delete(id); return msg.reply('Failed to start the call. Try again later!'); } } diff --git a/package.json b/package.json index bb9fc4e2..b1c4bf73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "123.1.0", + "version": "123.1.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {