Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ First you need to create a Discord bot user, which you can do by following the i
"#discord": "#irc channel-password", // Add channel keys after the channel name
"1234567890": "#channel" // Use a discord channel ID instead of its name (so you can rename it or to disambiguate)
},
"channelTopicsToDiscord": [ // Sends topic changes from IRC to Discord
"#irc

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"#irc
should be
"#irc"

],
"ircOptions": { // Optional node-irc options
"floodProtection": false, // On by default
"floodProtectionDelay": 1000 // 500 by default
Expand Down
12 changes: 12 additions & 0 deletions lib/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Bot {
this.ircStatusNotices = options.ircStatusNotices;
this.announceSelfJoin = options.announceSelfJoin;
this.webhookOptions = options.webhooks;
this.channelTopicsToDiscord = options.channelTopicsToDiscord;

// Nicks to ignore
this.ignoreUsers = options.ignoreUsers || {};
Expand Down Expand Up @@ -238,6 +239,17 @@ class Bot {
}
});

if (typeof this.channelTopicsToDiscord !== 'undefined') {
this.ircClient.on('topic', (channel, topic, nick, message) => {
if (message.command !== 'rpl_topicwhotime') {
logger.debug('Received topic change from IRC:', channel, topic);
if (this.channelTopicsToDiscord === true || this.channelTopicsToDiscord.includes(channel)) {
this.sendExactToDiscord(channel, `*${nick}* has changed the topic to "${topic}"`);
}
}
});
}

if (logger.level === 'debug') {
this.discord.on('debug', (message) => {
logger.debug('Received debug event from Discord', message);
Expand Down