mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Add ability to see phone and portal channel counts
This commit is contained in:
@@ -31,6 +31,9 @@ module.exports = class PhoneCommand extends Command {
|
|||||||
&& channel.topic
|
&& channel.topic
|
||||||
&& channel.topic.includes('<xiao:phone>')
|
&& channel.topic.includes('<xiao:phone>')
|
||||||
&& !msg.guild.channels.cache.has(channel.id));
|
&& !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...');
|
if (!channels.size) return msg.reply('No channels currently allow phone calls...');
|
||||||
const channel = channels.random();
|
const channel = channels.random();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
const Command = require('../../structures/Command');
|
const Command = require('../../structures/Command');
|
||||||
const { oneLine } = require('common-tags');
|
|
||||||
const { PORTAL_EMOJI_ID, PORTAL_EMOJI_NAME } = process.env;
|
const { PORTAL_EMOJI_ID, PORTAL_EMOJI_NAME } = process.env;
|
||||||
|
|
||||||
module.exports = class PortalSendCommand extends Command {
|
module.exports = class PortalSendCommand extends Command {
|
||||||
@@ -29,13 +28,14 @@ module.exports = class PortalSendCommand extends Command {
|
|||||||
if (msg.channel.type === 'text') {
|
if (msg.channel.type === 'text') {
|
||||||
channels = channels.filter(channel => !msg.guild.channels.cache.has(channel.id));
|
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...');
|
if (!channels.size) return msg.reply('No channels have an open portal...');
|
||||||
const channel = channels.random();
|
const channel = channels.random();
|
||||||
try {
|
try {
|
||||||
await channel.send(oneLine`
|
const displayName = msg.channel.type === 'text' ? msg.guild.name : 'DM';
|
||||||
**${this.portalEmoji} ${msg.author.tag} (${msg.channel.type === 'text' ? msg.guild.name : 'DM'}):**
|
await channel.send(`**${this.portalEmoji} ${msg.author.tag} (${displayName}):** ${message}`);
|
||||||
${message}
|
|
||||||
`);
|
|
||||||
return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`);
|
return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return msg.reply('Failed to send the message. Try again later!');
|
return msg.reply('Failed to send the message. Try again later!');
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "111.1.4",
|
"version": "111.1.5",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user