* Upgrade discord.js to 12.2.0
* Use cache accessors in Discord client
* Replace sendMessage with send
* Use avatarURL method
* Update test stubs for discord.js 12
* Disconnect clients at end of tests
* Fix disabling webhook mentions when bot lacks permissions
* Consistently use this.bot in tests
Some tests were subtly testing broken behavior,
as this.addUser was not correctly adding a user
to the given bot's guild.
* Group up webhook tests in contexts
* Fix webhooks for users with no avatars
Fixes#529.
* Fix avatars not displaying via webhooks
Avatars that were 2048x2048 would break webhooks displaying avatars, defaulting to 128x128 fixes that.
* travis-ci fix
* Fix null-checks
* Fix travis-ci tests for avatar size
* Add ircPreventMention
(This adds a zero-width character to nicknames to prevent IRC-side pings.)
Original commits:
- Add ircPreventMention code
- Document ircPreventMention
- Make ircNickColor wrap the displayUsername
- Fix build errors
- Default ircPreventMention to false
* Correct that ircPreventMention is off by default
* Test ircPreventMention
Only tests turning it on; extant tests ensure it's off by default.
Adds a format option for a default avatar URL to send if the user isn't found on IRC. Takes the user's nickname as an argument so it can be passed to a web service.
Fixes#383.
Discord already has permissions for whether the bot can ping everyone,
and the webhook send method has a `disableEveryone` option, so let's
defer to the inbuilt Discord permission for this.
When permissions can't be found (shouldn't happen), defaults to
disabling the pings.
Fixes#494
* use non-deprecated form of `Array.find`
The older form emitted a deprecation warning in nodejs, cluttering up the log.
* refactor to make lines shorter
required by code style guidelines
(Fixes #384.)
On the Discord side of things, animated emoji get a prefixed 'a' to the
identifier string, so that instead of the normal emoji string:
`<:test:330064465703862273>`
you instead get:
`<a:test:330064465703862273>`
This commit fixes parseText to also process the animated form into `:test:`.
* Add a note about how to install optional charset converter dependencies
Fixes part of #252 and #237.
* Default ircOptions.encoding to utf-8 if node-irc can convert encodings
Also warn when started if the IRC library cannot convert between
encodings, in case users rely on this behavior.
* Improve config check and warning message around encodings
When the client reconnects to IRC after a timeout, the bot nickname
is often still in use (the client receives an `err_nicknameinuse`
message), and the bot is given an alternate nickname by the server.
In this case, it is almost always desirable to try to change the
nickname back to the configured nickname, so we enable `autoRenick`
by default.
NOTE: `autoRenick` can be disabled by specifying `autoRenick: false`
in `ircOptions` in the discord-irc configuration file, or the
behavior can be modified with the `renickCount` and `renickDelay`
options. See the node-irc documentation for more details.
* I think this should work?
* Added test for multi-character command prefixes
(accidentally pushed to wrong branch there but let's hope no one notices)
* Fixed bot test. That looks better.
When an IRC user uses a custom emoji reference (e.g.
:testemoji:), it should be translated into the actual
emoji for Discord users, instead of appearing in plain
text.
This also adds tests to ensure other emoji-like phrases
do not get converted or cause the bot to crash.
The irc module does not appear to be very actively maintained, and has
quite a few issues causing issues in this project itself.
This fork, maintained by me, has a few fixes to some major issues
already.
Changelogs:
- v0.6.0 - https://github.com/Throne3d/node-irc/releases/tag/v0.6.0
- v0.6.1 - https://github.com/Throne3d/node-irc/releases/tag/v0.6.1
Should fix#199, #200, as well as some issues not previously noted
(crash if unbanning a user who is not banned, crash in circumstances
with a poor internet connection).
It may also allow us to remove our workaround for the quit and nick
events having all channels in the associated array.
As the irc library can change the nick of the bot when
connecting (e.g. because the nick is currently taken, by
some other user), `this.nickname` may not correspond to the
current nickname and so when receiving a join event upon
joining a channel (prior to the names event), the current
guard against this can pass despite it being an event for
the bot.
This modifies it to check against ircClient.nick where
relevant, and also modifies the test stubs to allow adding
the nickname to the config and exposing this functionality
in tests.
To see the failure before this patch, enable
`ircStatusNotices` and run two copies of the bot; the
second should crash upon joining a channel, as it will have
a modified nickname (e.g. 'testbot1').