-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
This happens on every bot i make. please
NodeJS 12
Client:
const { AkairoClient, ListenerHandler, CommandHandler, InhibitorHandler } = require('discord-akairo');
const LoggerClass = require('./Logger');
const DatabaseHandler = require('./DatabaseClient')
const { Collection } = require('discord.js');
// Discord Client Class
/*
Make it work
Fix stopping after 1m
*/
class DiscordClient extends AkairoClient {
constructor() {
super({
ownerID: "790078829997326416"
});
this.logger = LoggerClass
this.logger.info("Setup variables..", {Tag: "Client"});
this._databaseClient = new DatabaseHandler(this);
this.commandHandler = new CommandHandler(this, {
automateCategories: true,
directory: './src/commands/',
aliasReplacement: /-/g,
prefix: message => {
if (message.guild) {
return this.storage.guilds.get(message.guild.id).prefix
}
},
allowMention: true,
commandUtil: true,
commandUtilLifetime: 10000,
commandUtilSweepInterval: 10000,
storeMessages: true,
handleEdits: true,
argumentDefaults: {
prompt: {
start: 'What is thing?',
modifyStart: (msg, text) => `${msg.author}, ${text}\nType \`cancel\` to cancel this command.`,
retry: 'What is thing, again?',
modifyRetry: (msg, text) => `${msg.author}, ${text}\nType \`cancel\` to cancel this command.`,
timeout: 'Out of time.',
ended: 'No more tries.',
cancel: 'Cancelled.',
retries: 5
},
modifyOtherwise: (msg, text) => `${msg.author}, ${text}`
}
});
this.inhibitorHandler = new InhibitorHandler(this, {
directory: './src/inhibitors/'
});
this.listenerHandler = new ListenerHandler(this, {
directory: './src/events/'
});
this.logger.info("Finish setup variables", {Tag: 'Client'})
this.setup();
}
setup() {
this.logger.info("Setup..", {Tag: "Client"})
this.commandHandler.useInhibitorHandler(this.inhibitorHandler);
this.commandHandler.useListenerHandler(this.listenerHandler);
this.listenerHandler.setEmitters({
commandHandler: this.commandHandler,
inhibitorHandler: this.inhibitorHandler,
listenerHandler: this.listenerHandler
});
this.commandHandler.loadAll();
this.inhibitorHandler.loadAll();
this.listenerHandler.loadAll();
const resolver = this.commandHandler.resolver;
resolver.addType('1-10', (message, phrase) => {
const num = resolver.type('integer')(phrase);
if (num == null) return null;
if (num < 1 || num > 10) return null;
return num;
});
this.logger.info("Finish setup", {Tag: "Client"})
}
async start(token) {
if (!token) this.logger.info("No token", { Tag: "Error" });
this.logger.info("Contacting discord for login", { Tag: "Client" })
this.storage = {
guilds: new Collection(),
users: new Collection(),
eco: new Collection(),
notes: new Collection()
};
await super.login(token)
}
}
module.exports = DiscordClient
Metadata
Metadata
Assignees
Labels
No labels