-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support using discord channel ids #187
Conversation
Would you care to explain why you think is useful as well? Can't see any immediate gain, but I might be missing something. |
It allows the config to keep working even if discord channels are renamed, which is the problem I was having. |
Ye, that makes sense. Care to add a test or two? |
lib/bot.js
Outdated
@@ -193,9 +194,9 @@ class Bot { | |||
const discordChannelName = this.invertedMapping[channel.toLowerCase()]; | |||
if (discordChannelName) { | |||
// #channel -> channel before retrieving and select only text channels: | |||
const discordChannel = this.discord.channels | |||
const discordChannel = discordChannelName.charAt(0) === '#' ? this.discord.channels |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discordChannelName.startsWith('#')
lib/bot.js
Outdated
@@ -154,7 +154,8 @@ class Bot { | |||
if (author.id === this.discord.user.id) return; | |||
|
|||
const channelName = `#${message.channel.name}`; | |||
const ircChannel = this.channelMapping[channelName]; | |||
const ircChannel = this.channelMapping[message.channel.id in this.channelMapping ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const ircChannel = this.channelMapping[message.channel.id] || this.channelMapping[channelName]
maybe?
I'm afraid I don't actually know how to add tests |
I just ran an issue when joining the bot onto two Discord servers with #general. Would appreciate this a lot. Might give writing tests a shot but I'm not familiar with it at all. |
I've had a go at adding tests for this in PR #202. Thanks for putting in the work for the functionality. |
Add Discord channel ID matching (PR #187) and tests for it
Closing this since #202 was merged. Thanks! |
No description provided.