Phone Command

This commit is contained in:
Dragon Fire
2020-02-28 15:03:41 -05:00
parent d1970d2262
commit 9d5879c8c6
9 changed files with 120 additions and 4 deletions
+14
View File
@@ -56,6 +56,20 @@ client.on('ready', () => {
}
});
client.on('message', async msg => {
if (!msg.channel.topic || !msg.channel.topic.includes('<xiao:phone>')) return;
if (msg.author.bot || !msg.content) return;
const origin = client.phone.find(call => call.origin.id === msg.channel.id);
const recipient = client.phone.find(call => call.recipient.id === msg.channel.id);
if (!origin && !recipient) return;
try {
if (origin) await origin.send(origin.recipient, msg);
if (recipient) await recipient.send(recipient.origin, msg);
} catch (err) {
return; // eslint-disable-line no-useless-return
}
});
client.on('guildMemberRemove', async member => {
const channel = member.guild.systemChannel;
if (!channel || !channel.permissionsFor(client.user).has('SEND_MESSAGES')) return null;