From 084de9469484c7c8246ddf1eb47a7e74a6dc63ab Mon Sep 17 00:00:00 2001 From: Lamp Date: Fri, 13 Jul 2018 16:29:48 -0700 Subject: [PATCH] h --- .gitignore | 3 ++- src/config.js | 17 ++++++++++------- src/main.js | 2 +- src/misc.js | 12 ++++++------ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 5e6c27e..897c76b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /local/ -node_modules/ \ No newline at end of file +node_modules/ +.DS_Store diff --git a/src/config.js b/src/config.js index 5d10bf2..007ab6f 100644 --- a/src/config.js +++ b/src/config.js @@ -1,25 +1,28 @@ module.exports = { - "testmode": false, - + + "testmode": new Boolean(process.env.TEST), + "token": process.env.DISCORD_TOKEN, "webhooks": { - "console": process.env.TOKEN_WEBHOOK_CONSOLE, - "welcome": process.env.TOKEN_WEBHOOK_WELCOME, + "console": process.env.WEBHOOK_CONSOLE.split("/"), + "welcome": process.env.WEBHOOK_WELCOME.split("/"), }, "opID": "281134216115257344", - "guildID": "321819041348190249", + "guildID": this.testmode ? "" : "321819041348190249", "channels": { - "main": "321819041348190249" + "main": this.testmode ? "" : "321819041348190249" }, + + "mppname": "[discord.gg/k44Eqha]", "disabledRooms": [ "RP Room", "Legends of Alorgon {RP Room}", "Legends of Alorgon", "Breastmilk ♥ 7:45 AM" - ] + ], } \ No newline at end of file diff --git a/src/main.js b/src/main.js index c701239..492a86c 100755 --- a/src/main.js +++ b/src/main.js @@ -18,7 +18,7 @@ console.error = function(){ console.warn = console.error; console.info = console.log; -var webhook = new Discord.WebhookClient('405445543536623627', config.webhooks.console); +var webhook = new Discord.WebhookClient(config.webhooks.console[0], config.webhooks.console[1]); function log2discord(str){ str = Array.from(str); str = str.map(require('util').inspect); diff --git a/src/misc.js b/src/misc.js index 0998bc3..f8c784e 100755 --- a/src/misc.js +++ b/src/misc.js @@ -1,22 +1,22 @@ // join/leave -(function(){ - var webhook = new Discord.WebhookClient('404736784354770958', config.webhooks.welcome); - dClient.on('guildMemberAdd', member => { +(async function(){ + var webhook = new Discord.WebhookClient(config.webhooks.welcome[0], config.webhooks.welcome[1]); + dClient.on('guildMemberAdd', async member => { webhook.send(`${member} joined.`, {username: member.user.username, avatarURL: member.user.displayAvatarURL(), disableEveryone:true}); }); - dClient.on('guildMemberRemove', member => { + dClient.on('guildMemberRemove', async member => { webhook.send(`${member.user.tag} left.`, {username: member.user.username, avatarURL: member.user.displayAvatarURL(), disableEveryone:true}); }); })(); // view deleted channels -(function(){ +(async function(){ var vcid = '425060452129701889'; var rid = '425060792455397376'; - dClient.on('voiceStateUpdate', (oldMember, newMember) => { + dClient.on('voiceStateUpdate', async (oldMember, newMember) => { if (oldMember.voiceChannelID != vcid && newMember.voiceChannelID == vcid) { // member joined the channel newMember.roles.add(newMember.guild.roles.get(rid));