34 Commits

Author SHA1 Message Date
Edward Jones
f047ce0224
Upgrade discord.js to 12.2.0 (#555)
* 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
2020-08-09 02:07:09 -03:00
Edward Jones
221d42a44b
Upgrade sinon to ^7.4.1, sinon-chai to ^3.3.0 (#503)
* Upgrade sinon to ^5.1.1 and sinon-chai to ^3.1.0

* Upgrade sinon to ^6.3.5

* Upgrade sinon to ^7.4.1
2019-08-08 13:03:05 -03:00
Martin Ek
f8ad2d2fa7 Define a custom winston logger 2018-09-19 00:24:52 +01:00
Martin Ek
87a3458bdd Upgrade eslint-config-airbnb 2017-10-05 00:54:01 +02:00
Edward Jones
7f7505cae7 Translate TextChannel#sendMessage to #send to fix deprecation warning
Fixes #266, changing references to "sendMessage" to "send". It seems to
work just fine with some brief testing and this reflects the fact the
method seems to just be a passthrough:
https://github.com/hydrabolt/discord.js/blob/11.1.0/src/structures/interfaces/TextBasedChannel.js#L415

This also changes the test stub "sendMessageStub" to be "sendStub" to
reflect the name change.
2017-07-11 21:10:27 +01:00
Martin Ek
67ac5f1605 Merge pull request #258 from Throne3d/upgrade/migrate-to-irc-upd
Move from irc 0.5.2 to irc-upd 0.6.1
2017-07-01 11:47:01 -07:00
Edward Jones
c0d443d9c5 Move from irc 0.5.2 to irc-upd 0.6.1
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.
2017-07-01 17:29:33 +01:00
Edward Jones
76fda25a19 Use ircClient.nick instead of nickname when checking current nick
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').
2017-07-01 01:11:49 +01:00
Richard Schöbel
fd95d7d9b0 check if an user is present in the channel 2017-05-16 16:06:39 +02:00
Richard Schöbel
fd88a992b1 fixed 'nitpick' :D, and only sends to tracked channels,
edited tests to reflect these changes
2017-05-16 14:05:22 +02:00
Richard Schöbel
ec7ca8b88d more tests and usage of ircStatusNotices 2017-05-10 01:25:00 +02:00
Richard Schöbel
2e96dd7b79 Added test 2017-05-10 00:56:27 +02:00
Edward Jones
03596570bc Warn if a part/quit is received and no channelUsers is set
Attempts to fix #216's crash but is unlikely to fix the
underlying issue (that somehow the client isn't saving
a list of nicks in a channel, either because the server
isn't sending a names event, or the node-irc library is
processing it poorly, or otherwise).
2017-04-29 23:49:56 +01:00
Edward Jones
de448eac49 Fix ircStatusNotices when channels are not lowercase
Should fix #216, by lowercasing the channel name when
it receives each event. This also adds debug messages
to make it easier to see when the bot is actually
receiving (and presumably processing) these events.
2017-04-13 18:29:26 +01:00
Edward Jones
cc990d67e1 Use sets instead of arrays for user membership in channels 2017-04-05 20:52:38 +01:00
Edward Jones
1c8fa12def Fix IRC quit messages sending to all channels by tracking users
Keep a list of users in each channel, using the names event
in addition to the join/part events, so as to prevent spamming
unnecessary channels when the quit event is raised with all
channels from a server.

Fixes #213.
2017-04-04 17:15:14 +01:00
Edward Jones
215c33baff Rename special->exact and getDiscordChannelFor->findDiscordChannel 2017-03-30 15:24:41 +01:00
Edward Jones
607cb687fd Allow users to have bot announce itself joining IRC to Discord 2017-03-30 15:22:55 +01:00
Edward Jones
c39d751f4f Bot should not announce itself joining IRC 2017-03-30 15:22:55 +01:00
Edward Jones
0633c32b0a Add ability to disable join/part messages and test for this 2017-03-30 15:22:55 +01:00
Edward Jones
611aa6b6db Update part/quit messages and add tests
- Do not discard reason from part messages
- Output to each channel in the quit messages
- Add tests for join/part/quit events
- Add test that sendSpecialToDiscord doesn't send messages
  to outside the channel mapping
2017-03-30 15:22:55 +01:00
Martin Ek
bac7069421 Add a test for irc's registered event and update existing 2016-12-08 23:52:00 -05:00
Martin Ek
8a6935c2e5 Listen to warn and debug events from discord 2016-12-08 23:32:31 -05:00
Martin Ek
9e05344374 Migrate to discord.js v9.3 2016-09-25 21:16:28 -04:00
Martin Ek
483798cd54 Use airbnb directly and fix lint errors 2016-09-25 20:36:26 -04:00
ekmartin
35c9b445e5 Update dependencies (Babel 6 etc.) 2016-01-23 20:37:29 +01:00
ekmartin
9085bc5364 Rewrite to ES6 using Babel 2015-10-28 15:24:01 +01:00
ekmartin
499eeec5a0 Fix all the tests 2015-10-28 03:37:33 +01:00
ekmartin
e94a27ee99 Use ESLint instead of JSHint and JSCS 2015-10-06 20:31:41 +02:00
ekmartin
fced1b5275 Add support for IRC notices 2015-09-14 13:03:29 +02:00
ekmartin
fec4a33b01 Send Slack actions to IRC 2015-09-14 12:50:33 +02:00
ekmartin
388b857491 Add support for IRC actions 2015-09-14 11:11:27 +02:00
ekmartin
2e068bfa2a Add message parsing, fixes #9 2015-03-24 01:04:38 +01:00
ekmartin
f27a5a3a5a Add more tests 2015-03-23 23:42:08 +01:00