Archived
fixed token
This commit is contained in:
1 parent
f6fdcde0c3
commit
6ec554df8f
1 file changed
+3
-9
+3
-9
@@ -60,14 +60,8 @@ class Bot {
|
|||||||
try {
|
try {
|
||||||
console.log(`Bot name: ${this.name}`);
|
console.log(`Bot name: ${this.name}`);
|
||||||
console.log(`Prefix: ${this.config.prefix} \n`);
|
console.log(`Prefix: ${this.config.prefix} \n`);
|
||||||
let loginToken;
|
const loginToken: string = token || this.config.token || '';
|
||||||
if(this.config.token) {
|
if(loginToken === '') {
|
||||||
loginToken = this.config.token;
|
|
||||||
}
|
|
||||||
else if(token) {
|
|
||||||
loginToken = token;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new ReferenceError('No token specified. Please pass your Discord application token as an argument to the "start" method or in the constructor');
|
throw new ReferenceError('No token specified. Please pass your Discord application token as an argument to the "start" method or in the constructor');
|
||||||
}
|
}
|
||||||
if(port) {
|
if(port) {
|
||||||
@@ -78,7 +72,7 @@ class Bot {
|
|||||||
const helpMsg: Command = new HelpMessage(this.commands, this.messages.help, this.config.prefix, this.name);
|
const helpMsg: Command = new HelpMessage(this.commands, this.messages.help, this.config.prefix, this.name);
|
||||||
this.commands.add(helpMsg);
|
this.commands.add(helpMsg);
|
||||||
console.log('Connecting to Discord...');
|
console.log('Connecting to Discord...');
|
||||||
if(await this.client.login(token)) {
|
if(await this.client.login(loginToken)) {
|
||||||
console.log('BOT IS READY!\n');
|
console.log('BOT IS READY!\n');
|
||||||
this.client.on('message', async m => {
|
this.client.on('message', async m => {
|
||||||
this.on.message(m);
|
this.on.message(m);
|
||||||
|
|||||||
Reference in new issue
Block a user