Add auto-accept phone calls option

This commit is contained in:
Dragon Fire
2021-02-14 09:36:21 -05:00
parent f28e6d140d
commit a746003886
4 changed files with 16 additions and 4 deletions
+1
View File
@@ -251,6 +251,7 @@ in the appropriate channel's topic to use it.
* `<xiao:disable-leave>` Disables leave messages (Place in the channel you recieve welcome messages in).
* `<xiao:phone>` Allows a channel to recieve phone calls from the `phone` command.
* `<xiao:phone:auto-accept>` Automatically accepts all incoming phone calls.
* `<xiao:phone:no-notice>` Hides the abuse notice from phone call pick-ups.
* `<xiao:phone:no-voicemail>` Prevents this channel from recieving voicemails for missed calls.
* `<xiao:phone:no-random>` Makes the channel only able to be called directly in the `phone` command, rather than be picked at random.
+1
View File
@@ -23,6 +23,7 @@ module.exports = class OptionsCommand extends Command {
__Phone Options__
\`<xiao:phone>\` Allows this channel to recieve phone calls.
\`<xiao:phone:auto-accept>\` Automatically accepts all incoming phone calls.
\`<xiao:phone:no-notice>\` Hides the abuse notice from phone call pick-ups.
\`<xiao:phone:no-voicemail>\` Prevents this channel from recieving voicemails for missed calls.
\`<xiao:phone:no-random>\` Makes the channel only able to be called directly, rather than picked randomly.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "129.7.0",
"version": "129.7.1",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {
+13 -3
View File
@@ -30,6 +30,10 @@ module.exports = class PhoneCall {
}
} else {
await this.origin.send(`☎️ Calling **${this.recipient.guild.name} (${this.recipient.id})**...`);
if (this.recipient.topic && this.recipient.topic.includes('<xiao:phone:auto-accept>')) {
await this.accept();
return this;
}
if (this.originDM) {
await this.recipient.send(
`☎️ Incoming call from **${this.startUser.tag}'s DM (${this.startUser.id})**. Pick up?`
@@ -53,13 +57,19 @@ module.exports = class PhoneCall {
this.setTimeout();
if (this.adminCall) return this;
const usage = this.client.registry.commands.get('hang-up').usage();
if (!this.origin.topic.includes('<xiao:phone:no-notice>')) await this.sendNotice(this.origin);
if (this.originDM || (this.origin.topic && !this.origin.topic.includes('<xiao:phone:no-notice>'))) {
await this.sendNotice(this.origin, this.originDM);
}
await this.origin.send(`☎️ **${this.recipient.guild.name}** picked up! Use ${usage} to hang up.`);
if (this.originDM) {
await this.sendNotice(this.recipient, true);
if (this.recipient.topic && !this.recipient.topic.includes('<xiao:phone:no-notice>')) {
await this.sendNotice(this.recipient);
}
await this.recipient.send(`☎️ Accepted call from **${this.startUser.tag}'s DM**. Use ${usage} to hang up.`);
} else {
if (!this.recipient.topic.includes('<xiao:phone:no-notice>')) await this.sendNotice(this.recipient);
if (this.recipient.topic && !this.recipient.topic.includes('<xiao:phone:no-notice>')) {
await this.sendNotice(this.recipient);
}
await this.recipient.send(`☎️ Accepted call from **${this.origin.guild.name}**. Use ${usage} to hang up.`);
}
return this;