mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-24 02:15:10 +02:00
Fix broken quitter/non-quitter relations
This commit is contained in:
@@ -38,16 +38,16 @@ module.exports = class PhoneCall {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
async hangup(quitter) {
|
async hangup(nonQuitter) {
|
||||||
this.active = false;
|
this.active = false;
|
||||||
clearTimeout(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
this.client.phone.delete(this.id);
|
this.client.phone.delete(this.id);
|
||||||
if (quitter === '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.');
|
||||||
} else {
|
} else {
|
||||||
const channel = quitter.id === this.origin.id ? this.origin : this.recipient;
|
const quitter = nonQuitter.id === this.origin.id ? this.recipient : this.origin;
|
||||||
await channel.send(`☎️ **${channel.guild.name}** hung up.`);
|
await nonQuitter.send(`☎️ **${channel.guild.name}** hung up.`);
|
||||||
await quitter.send('☎️ Hung up.');
|
await quitter.send('☎️ Hung up.');
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
Reference in New Issue
Block a user