-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Description
I modified my local installation with a fork of the library that adds ESM exports
And added a single ping
command from the official guide
Note: My prefix is $
.
When I send $ping
in a channel the bot has the right messages (read messages history, send messages, read history, view channel), it doesn't reply to me with pong
. Evren when I changed the exec
function to log something, it doesn't do it.
This is my project's file system:
config
┕━ config.mjs
commands
┕━━ ping.mjs
package.json
Bot.mjs
index.mjs
This is Bot.mjs
:
import {
AkairoClient,
InhibitorHandler,
CommandHandler,
ListenerHandler
}
from 'discord-akairo';
class Bot extends AkairoClient {
constructor(CONFIG) {
super( { }, { } );
/* #region Handling Commands */
this.commandHandler = new CommandHandler(
this,
{
directory: './commands/',
prefix: CONFIG.prefix
}
);
this.commandHandler.loadAll();
/* #endregion */
// Log in the Bot
this._login(CONFIG.auth_token)
// onReady, log the bot is ready
this._onReady();
}
_login(auth_token) {
this.login(auth_token)
.then(console.log(`[✔️ ] 🔓 Logged bot in`))
.catch(error => console.error(error));
}
_onReady() {
this.once(
"ready",
() => {
console.log(` 🟢 🤖 + ${this.user.username} — ready `);
}
);
}
}
export default Bot;
Ping.mjs
- copy-pasted from the official guide:
import {
Command
} from 'discord-akairo';
class PingCommand extends Command {
constructor() {
super(
'ping', {
aliases: ['ping']
}
);
}
exec(message) {
console.log("pong!");
return message.reply('Pong!');
}
}
export default PingCommand;
And index.mjs
where I create an instance of the client Bot
:
import CONFIG from './config.mjs'; // { prefix: "$", auth_token: <my-token> }
import Bot from './Bot.mjs';
const BOT = new Bot(CONFIG);
Am I doing something wrong? AFAIK I'm following the official guide but with some extra steps.
Metadata
Metadata
Assignees
Labels
No labels