Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Command = require('../base/Command.js');
- const Discord = require('discord.js');
- class Ping extends Command {
- constructor(client) {
- super(client, {
- name: 'ping',
- description: 'Latency and API response times.',
- usage: 'ping',
- extended: 'This command is a response test, it helps gauge if there is any latency (lag) in either the bots connection, or the API.',
- aliases: ['pong']
- });
- }
- async run(message, args, level) { // eslint-disable-line no-unused-vars
- try {
- const msg = await message.channel.send('Pinging ...');
- const mss = Math.round(this.client.ping);
- const ms = msg.createdTimestamp - message.createdTimestamp;
- const embed = new Discord.RichEmbed()
- .setAuthor(`${this.client.user.username}`, `${this.client.user.avatarURL}`)
- .setColor(`${[Math.floor(Math.random() * 16777215).toString(16)]}`)
- .setTitle('Speed of bot connection.')
- .setDescription(`
- • 🏓 | \`Ping:\` ${ms}ms
- • 💙 | \`API:\` ${mss}ms
- `)
- .setFooter(`${this.client.user.tag} (ID Client: ${this.client.user.id})`, `${this.client.user.avatarURL}`);
- msg.edit({embed});
- } catch (e) {
- console.log(e);
- }
- }
- }
- module.exports = Ping;
- function editPong(message, secondMessage) {
- const mss = Math.round(this.client.ping);
- const ms = secondMessage.createdTimestamp - message.createdTimestamp;
- let statuss = '';
- if (mss < 50) {
- statuss = '(`ممتاز`)';
- } else if (mss < 100) {
- statuss = '(`جيد جداً`)';
- } else if (mss < 300) {
- statuss = '(`جيد`)';
- } else if (mss < 1000) {
- statuss = '(`متوسط`)';
- } else {
- statuss = '(`سيء`)';
- }
- let status = '';
- if (ms < 50) {
- status = '(`ممتاز`)';
- } else if (ms < 100) {
- status = '(`جيد جداً`)';
- } else if (ms < 300) {
- status = '(`جيد`)';
- } else if (ms < 1000) {
- status = '(`متوسط`)';
- } else {
- status = '(`سيء`)';
- }
- const embed = new Discord.RichEmbed()
- .setAuthor(`${this.client.user.username}`, `${this.client.user.avatarURL}`)
- .setColor(`${[Math.floor(Math.random() * 16777215).toString(16)]}`)
- .setTitle('سرعة أتصال البوت')
- .setDescription(`
- • 🏓 | \`Ping:\` ${ms}ms | ${status}
- • 💙 | \`Websocket:\` ${mss}ms | ${statuss}
- `)
- .setFooter(`${this.client.user.tag} (ID Client: ${this.client.user.id})`, `${this.client.user.avatarURL}`);
- secondMessage.edit({embed});
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement