discord-irc
Advanced tools
Comparing version 2.1.7 to 2.2.0
# Changelog | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
## [2.2.0] - 2017-03-06 | ||
### Fixed | ||
* Added a zero width character between each letter of the IRC nicknames, to | ||
avoid unwanted highlights. Fixed by @Sanqui in | ||
[#193](https://github.com/reactiflux/discord-irc/pull/193). | ||
## [2.1.6] - 2017-01-10 | ||
@@ -5,0 +11,0 @@ ### Fixed |
@@ -42,3 +42,3 @@ 'use strict'; | ||
if (!options[field]) { | ||
throw new _errors.ConfigurationError(`Missing configuration field ${ field }`); | ||
throw new _errors.ConfigurationError(`Missing configuration field ${field}`); | ||
} | ||
@@ -120,7 +120,7 @@ }); | ||
this.ircClient.on('notice', (author, to, text) => { | ||
this.sendToDiscord(author, to, `*${ text }*`); | ||
this.sendToDiscord(author, to, `*${text}*`); | ||
}); | ||
this.ircClient.on('action', (author, to, text) => { | ||
this.sendToDiscord(author, to, `_${ text }_`); | ||
this.sendToDiscord(author, to, `_${text}_`); | ||
}); | ||
@@ -156,3 +156,3 @@ | ||
const displayName = Bot.getDiscordNicknameOnServer(mention, message.guild); | ||
return content.replace(`<@${ mention.id }>`, `@${ displayName }`).replace(`<@!${ mention.id }>`, `@${ displayName }`).replace(`<@&${ mention.id }>`, `@${ displayName }`); | ||
return content.replace(`<@${mention.id}>`, `@${displayName}`).replace(`<@!${mention.id}>`, `@${displayName}`).replace(`<@&${mention.id}>`, `@${displayName}`); | ||
}, message.content); | ||
@@ -162,3 +162,3 @@ | ||
const channel = this.discord.channels.get(channelId); | ||
return `#${ channel.name }`; | ||
return `#${channel.name}`; | ||
}).replace(/<(:\w+:)\d+>/g, (match, emoteName) => emoteName); | ||
@@ -176,3 +176,3 @@ } | ||
const channelName = `#${ message.channel.name }`; | ||
const channelName = `#${message.channel.name}`; | ||
const ircChannel = this.channelMapping[channelName]; | ||
@@ -186,9 +186,14 @@ | ||
let displayUsername = nickname; | ||
// Join the display name with double "bold" formatting characters | ||
// to prevent unintentional highlights on the IRC side | ||
displayUsername = displayUsername.split('').join('\u200d'); | ||
if (this.ircNickColor) { | ||
const colorIndex = (nickname.charCodeAt(0) + nickname.length) % NICK_COLORS.length; | ||
displayUsername = _irc2.default.colors.wrap(NICK_COLORS[colorIndex], nickname); | ||
displayUsername = _irc2.default.colors.wrap(NICK_COLORS[colorIndex], displayUsername); | ||
} | ||
if (this.isCommandMessage(text)) { | ||
const prelude = `Command sent from Discord by ${ nickname }:`; | ||
const prelude = `Command sent from Discord by ${nickname}:`; | ||
this.ircClient.say(ircChannel, prelude); | ||
@@ -198,3 +203,3 @@ this.ircClient.say(ircChannel, text); | ||
if (text !== '') { | ||
text = `<${ displayUsername }> ${ text }`; | ||
text = `<${displayUsername}> ${text}`; | ||
_winston2.default.debug('Sending message to IRC', ircChannel, text); | ||
@@ -206,3 +211,3 @@ this.ircClient.say(ircChannel, text); | ||
message.attachments.forEach(a => { | ||
const urlMessage = `<${ displayUsername }> ${ a.url }`; | ||
const urlMessage = `<${displayUsername}> ${a.url}`; | ||
_winston2.default.debug('Sending attachment URL to IRC', ircChannel, urlMessage); | ||
@@ -247,3 +252,3 @@ this.ircClient.say(ircChannel, urlMessage); | ||
// Add bold formatting: | ||
const withAuthor = `**<${ author }>** ${ withMentions }`; | ||
const withAuthor = `**<${author}>** ${withMentions}`; | ||
_winston2.default.debug('Sending message to Discord', withAuthor, channel, '->', discordChannelName); | ||
@@ -250,0 +255,0 @@ discordChannel.sendMessage(withAuthor); |
{ | ||
"name": "discord-irc", | ||
"version": "2.1.7", | ||
"version": "2.2.0", | ||
"description": "Connects IRC and Discord channels by sending messages back and forth.", | ||
@@ -45,3 +45,3 @@ "keywords": [ | ||
"strip-json-comments": "2.0.1", | ||
"winston": "2.3.0" | ||
"winston": "2.3.1" | ||
}, | ||
@@ -48,0 +48,0 @@ "devDependencies": { |
@@ -11,3 +11,10 @@ # discord-irc [](https://travis-ci.org/reactiflux/discord-irc) [](https://coveralls.io/github/reactiflux/discord-irc?branch=master) | ||
Either by installing through npm: | ||
Before you can run discord-irc you need to create a configuration file by | ||
following the instructions [here](https://github.com/reactiflux/discord-irc#configuration). | ||
After you've done that you can replace `/path/to/config.json` in the commands | ||
below with the path to your newly created configuration file - or just `config.json` if it's | ||
in the same directory as the one you're starting the bot from. | ||
When you've done that you can install and start the bot either through npm: | ||
```bash | ||
@@ -14,0 +21,0 @@ $ npm install -g discord-irc |
127975
318
96
15
+ Addedwinston@2.3.1(transitive)
- Removedwinston@2.3.0(transitive)
Updatedwinston@2.3.1