-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
I'm trying a simple ping bot, and I found a error in client command
index.js
require('dotenv').config()
const { AkairoClient, CommandHandler, ListenerHandler } = require('discord-akairo');
const { Intents } = require('discord.js');
const { join } = require('path');
class MyClient extends AkairoClient {
constructor() {
super({
ownerID: "514546889874472990"
// Options for Akairo go here.
}, {
// Options for discord.js goes here.
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
});
this.commandHandler = new CommandHandler(this, {
prefix: ['a!'],
// blockBots: true,
// blockClient: true,
// allowMention: true,
// defaultCooldown: 500,
// commandUtil: true,
directory: join(__dirname, "commands")
});
this.listenerHandler = new ListenerHandler(this, {
directory: join(__dirname, "listeners")
});
this.commandHandler.useListenerHandler(this.listenerHandler);
this.listenerHandler.loadAll();
this.commandHandler.loadAll();
}
}
const client = new MyClient();
client.login(process.env.DISCORD_TOKEN);
/commands/ping.js
const { Command } = require('discord-akairo');
class Ping extends Command {
constructor() {
super('ping', {
aliases: ['ping', 'pong'],
channel: 'guild',
category: 'Utilities',
description: {
content: 'This provides the ping of the bot.'
}
});
}
async exec(message) {
const msg = await message.channel.send('Pinging...');
const latency = msg.createdTimestamp - message.createdTimestamp;
const choices = ['Is this really my ping?', 'Is that okay? I can\'t look!', 'I hope it isn\'t bad!'];
const reponse = choices[Math.floor(Math.random() * choices.length)];
msg.edit(`${reponse} - **Bot Latency**: \`${latency}ms\`, **API Latency**: \`${Math.round(this.client.ws.ping)}ms\``)
}
}
module.exports = Ping;
/listeners/ready.js
class Ready extends Listener {
constructor() {
super('ready', {
event: 'ready',
emitter: 'client'
});
}
exec() {
// let i = 0;
setInterval(() => this.client.user.setActivity(`a!help | Powered by Akairo`, { type: 'WATCHING' }), 15000);
console.log(`${this.client.user.tag} is online!`);
}
}
module.exports = Ready;
How to solve this ? thanks
Windows 11
NodeJs 16.10
discord-akairo 8.1.0
discord.js 13.2.0
yarn 3.0
Metadata
Metadata
Assignees
Labels
No labels