commit 81195fb279c535fcb1ba08a38d6787fcb95072f3
parent f1dcb6727051bb98c20937418d2effb700573333
Author: Demonstrandum <moi@knutsen.co>
Date: Tue, 24 Mar 2020 17:40:27 +0000
Use nickname, or tag without numbers.
Diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/main.ts b/lib/main.ts
@@ -119,17 +119,20 @@ export class SimpOMatic {
}
static start() {
- this._CLIENT = new Client();
- this._CLIENT.login(
+ const client = this._CLIENT = new Client();
+ const logged_in = client.login(
SECRETS.api.token,
`${__dirname}/*Discord.ts`
- ).then(() => console.log('Bot logged in.'));
- this._CLIENT.on('ready', () => this.events());
+ );
+ logged_in.then(() => console.log('Bot logged in.'));
+ client.on('ready', () => this.events());
return this._CLIENT;
}
static events() {
+ console.log('Bot ready to do work!');
+
const client = this._CLIENT;
system_message(client, "**We're back online baby!**");
client.on('guildCreate', guild => {
@@ -163,7 +166,8 @@ export class SimpOMatic {
// Wave goodbye to member.
channel.send(FAREWELL_MESSAGES
.choose()
- .replace('USER_TAG', member.user.tag));
+ .replace('USER_TAG', member.nickname
+ || member.user.tag.split('#').first()));
}
});
}