diff --git a/commands/phone/phone-info.js b/commands/phone/phone-info.js index a7c50905..df735c28 100644 --- a/commands/phone/phone-info.js +++ b/commands/phone/phone-info.js @@ -1,7 +1,5 @@ const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); -const moment = require('moment'); -require('moment-duration-format'); module.exports = class PhoneInfoCommand extends Command { constructor(client) { @@ -28,7 +26,7 @@ module.exports = class PhoneInfoCommand extends Command { .addField('❯ Recipient Channel', `#${otherChannel.name}`, true) .addField('❯ Recipient Server', otherChannel.guild.name, true) .addField('❯ Recipient ID', otherChannel.id, true) - .addField('❯ Call Duration', moment.duration(Date.now() - call.timeStarted).format('hh[h]mm[m]ss[s]'), true) + .addField('❯ Call Duration', call.durationDisplay, true) .addField('❯ Admin Call?', call.ownerOrigin ? 'Yes' : 'No', true) .addField('❯ Started By', call.startUser.tag, true); return msg.embed(embed); diff --git a/package.json b/package.json index 41f4133c..0df358cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.11.0", + "version": "119.11.1", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/structures/phone/PhoneCall.js b/structures/phone/PhoneCall.js index b5e1a01c..25db2710 100644 --- a/structures/phone/PhoneCall.js +++ b/structures/phone/PhoneCall.js @@ -1,4 +1,6 @@ const { stripIndents } = require('common-tags'); +const moment = require('moment'); +require('moment-duration-format'); const { shorten, stripInvites, verify } = require('../../util/Util'); module.exports = class PhoneCall { @@ -48,8 +50,8 @@ module.exports = class PhoneCall { this.active = false; clearTimeout(this.timeout); if (nonQuitter === 'time') { - await this.origin.send('☎️ Call ended due to inactivity.'); - await this.recipient.send('☎️ Call ended due to inactivity.'); + await this.origin.send(`☎️ Call ended due to inactivity. _(Lasted ${this.durationDisplay})_`); + await this.recipient.send(`☎️ Call ended due to inactivity. _(Lasted ${this.durationDisplay})_`); } else if (nonQuitter === 'declined') { const canVoicemail = this.recipient.topic && !this.recipient.topic.includes(''); const recipientMsg = validation === 0 @@ -81,8 +83,8 @@ module.exports = class PhoneCall { } } else { const quitter = nonQuitter.id === this.origin.id ? this.recipient : this.origin; - await nonQuitter.send(`☎️ **${quitter.guild.name}** hung up.`); - await quitter.send('☎️ Hung up.'); + await nonQuitter.send(`☎️ **${quitter.guild.name}** hung up. _(Lasted ${this.durationDisplay})_`); + await quitter.send(`☎️ Hung up. _(Lasted ${this.durationDisplay})_`); } this.client.phone.delete(this.id); return this; @@ -134,4 +136,8 @@ module.exports = class PhoneCall { this.timeout = setTimeout(() => this.hangup('time'), 60000); return this.timeout; } + + get durationDisplay() { + return moment.duration(Date.now() - this.timeStarted).format('hh[h]mm[m]ss[s]'); + } };