Skip to content

Commit

Permalink
Adds an option to potentially let bot messages go through
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaaz committed Mar 21, 2019
1 parent 552e893 commit d7400c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Link channels between them easily using webhooks and by just completing the json
- Warn if a server supposed to be in the linked channels is not here anymore or if a webhook is falsy.
- EnhancedMention - mention a user/role/channel in another guild easily by simply using `@name` or `#name`.
- ignore - Whether or not to ignore all messages coming from that channel.
- ignoreBots - Whether to accept bots message to gothrough the network. False by default

## Setup
Clone this repository.
Expand All @@ -31,7 +32,8 @@ Enter your bot token and all correct informations:
"channelID": "121212",
"whID": "232323",
"whToken": "webhookToken2323",
"ignore": false
"ignore": false,
"ignoreBots": true
},
"otherGuildName": {
"guildID": "444444",
Expand Down
6 changes: 4 additions & 2 deletions config.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
"channelID": "",
"whID": "",
"whToken": "",
"ignore": false
"ignore": false,
"ignoreBots": true
},
"name2": {
"guildID": "",
"channelID": "",
"whID": "",
"whToken": ""
"whToken": "",
"ignoreBots": true
}
}
}
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ async function triggerWH(channel, user, content) {
}

bot.on('messageCreate', msg => {
if (!msg.author || msg.author.bot || !msg.channel.guild) {

if (!msg.author || msg.author.discriminator === '0000' || !msg.channel.guild) {
return;
}

Expand All @@ -211,7 +212,11 @@ bot.on('messageCreate', msg => {
return;
}

if (cur.ignore) {
if (msg.author.bot && cur.ignoreBots !== false) { // ignore bots if needed (check for false to not accept bot in case of not defined)
return;
}

if (cur.ignore) { // ignore channels if needed
return;
}

Expand Down

0 comments on commit d7400c1

Please sign in to comment.