mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 06:37:32 +02:00
Phone Info Command
This commit is contained in:
@@ -29,7 +29,7 @@ module.exports = class AdminPhoneCommand extends Command {
|
||||
if (!channel || !channel.guild) return msg.reply('This channel does not exist.');
|
||||
try {
|
||||
const id = `${msg.channel.id}:${channel.id}`;
|
||||
this.client.phone.set(id, new PhoneCall(this.client, msg.channel, channel, true));
|
||||
this.client.phone.set(id, new PhoneCall(this.client, msg.author, msg.channel, channel, true));
|
||||
await this.client.phone.get(id).start();
|
||||
return null;
|
||||
} catch {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const moment = require('moment');
|
||||
require('moment-duration-format');
|
||||
|
||||
module.exports = class PhoneInfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'phone-info',
|
||||
aliases: ['call-info', 'phone-call-info'],
|
||||
group: 'phone',
|
||||
memberName: 'phone-info',
|
||||
description: 'Gives information on the current phone call.',
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
const origin = this.client.phone.find(call => call.origin.id === msg.channel.id);
|
||||
const recipient = this.client.phone.find(call => call.recipient.id === msg.channel.id);
|
||||
if (!origin && !recipient) return msg.reply('☎️ This channel is not in a phone call.');
|
||||
const call = origin || recipient;
|
||||
if (!call.active) return msg.reply('☎️ This call is not currently active.');
|
||||
const otherChannel = msg.channel.id === call.origin.id ? call.recipient : call.origin;
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.setThumbnail(otherChannel.guild.iconURL({ format: 'png' }))
|
||||
.addField('❯ Recipient Channel', `#${otherChannel.name}`, true)
|
||||
.addField('❯ Recipient Server', otherChannel.guild.name, true)
|
||||
.addField('❯ Recipient ID', otherChannel.id, true)
|
||||
.addField('❯ Call Duration', moment.duration(Date.now() - call.timeStarted).format('d:hh:mm:ss'), true)
|
||||
.addField('❯ Admin Call?', call.ownerOrigin ? 'Yes' : 'No', true)
|
||||
.addField('❯ Started By', call.startUser.tag, true);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
@@ -64,7 +64,7 @@ module.exports = class PhoneCommand extends Command {
|
||||
}
|
||||
try {
|
||||
const id = `${msg.channel.id}:${channel.id}`;
|
||||
this.client.phone.set(id, new PhoneCall(this.client, msg.channel, channel));
|
||||
this.client.phone.set(id, new PhoneCall(this.client, msg.author, msg.channel, channel));
|
||||
await this.client.phone.get(id).start();
|
||||
return null;
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user