Add ability to see phone and portal channel counts

This commit is contained in:
Dragon Fire
2020-03-01 22:07:39 -05:00
parent 454fa33ffd
commit bb076a8305
3 changed files with 9 additions and 6 deletions
+3
View File
@@ -31,6 +31,9 @@ module.exports = class PhoneCommand extends Command {
&& channel.topic
&& channel.topic.includes('<xiao:phone>')
&& !msg.guild.channels.cache.has(channel.id));
if (message.toLowerCase() === 'count') {
return msg.say(`☎️ **${channels.size}** currently open lines.`);
}
if (!channels.size) return msg.reply('No channels currently allow phone calls...');
const channel = channels.random();
try {
+5 -5
View File
@@ -1,5 +1,4 @@
const Command = require('../../structures/Command');
const { oneLine } = require('common-tags');
const { PORTAL_EMOJI_ID, PORTAL_EMOJI_NAME } = process.env;
module.exports = class PortalSendCommand extends Command {
@@ -29,13 +28,14 @@ module.exports = class PortalSendCommand extends Command {
if (msg.channel.type === 'text') {
channels = channels.filter(channel => !msg.guild.channels.cache.has(channel.id));
}
if (message.toLowerCase() === 'count') {
return msg.say(`**${this.portalEmoji} ${channels.size}** currently open portals.`);
}
if (!channels.size) return msg.reply('No channels have an open portal...');
const channel = channels.random();
try {
await channel.send(oneLine`
**${this.portalEmoji} ${msg.author.tag} (${msg.channel.type === 'text' ? msg.guild.name : 'DM'}):**
${message}
`);
const displayName = msg.channel.type === 'text' ? msg.guild.name : 'DM';
await channel.send(`**${this.portalEmoji} ${msg.author.tag} (${displayName}):** ${message}`);
return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`);
} catch (err) {
return msg.reply('Failed to send the message. Try again later!');
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "111.1.4",
"version": "111.1.5",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {