This commit is contained in:
Dragon Fire
2020-05-19 14:12:23 -04:00
parent 4384c51e2d
commit 93c02f1802
+5 -5
View File
@@ -42,7 +42,6 @@ module.exports = class PhoneCall {
async hangup(nonQuitter, validation) { async hangup(nonQuitter, validation) {
this.active = false; this.active = false;
clearTimeout(this.timeout); clearTimeout(this.timeout);
this.client.phone.delete(this.id);
if (nonQuitter === 'time') { if (nonQuitter === 'time') {
await this.origin.send('☎️ Call ended due to inactivity.'); await this.origin.send('☎️ Call ended due to inactivity.');
await this.recipient.send('☎️ Call ended due to inactivity.'); await this.recipient.send('☎️ Call ended due to inactivity.');
@@ -65,7 +64,7 @@ module.exports = class PhoneCall {
await this.origin.send('☎️ No voicemail will be left.'); await this.origin.send('☎️ No voicemail will be left.');
} else { } else {
const voicemailMsg = voicemail.first(); const voicemailMsg = voicemail.first();
await this.sendVoicemail(this.recipient, voicemailMsg.author, voicemailMsg.content); await this.sendVoicemail(this.recipient, voicemailMsg);
await this.origin.send('☎️ Your voicemail has been left.'); await this.origin.send('☎️ Your voicemail has been left.');
} }
} }
@@ -78,6 +77,7 @@ module.exports = class PhoneCall {
await nonQuitter.send(`☎️ **${quitter.guild.name}** hung up.`); await nonQuitter.send(`☎️ **${quitter.guild.name}** hung up.`);
await quitter.send('☎️ Hung up.'); await quitter.send('☎️ Hung up.');
} }
this.client.phone.delete(this.id);
return this; return this;
} }
@@ -105,11 +105,11 @@ module.exports = class PhoneCall {
return channel.send(`☎️ **${msg.author.tag}:** ${content}\n${attachments || ''}`.trim()); return channel.send(`☎️ **${msg.author.tag}:** ${content}\n${attachments || ''}`.trim());
} }
sendVoicemail(channel, author, message) { sendVoicemail(channel, msg) {
if (!channel.topic || channel.topic.includes('<xiao:phone:no-voicemail>')) return null; if (!channel.topic || channel.topic.includes('<xiao:phone:no-voicemail>')) return null;
return channel.send(stripInvites` return channel.send(stripInvites`
☎️ New Voicemail from **${channel.guild.name}**: ☎️ New Voicemail from **${msg.guild.name}**:
**${author.tag}:** ${message} **${msg.author.tag}:** ${msg.content}
`); `);
} }