95 Commits

Author SHA1 Message Date
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
Edward Jones
d528aedb6d
Add ircPreventMention (#502)
* 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.
2019-08-08 12:06:07 -03:00
George
70e88498de Add a customizable fallback URL for webhook avatars (#419)
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.
2019-08-08 11:35:11 -03:00
Edward Jones
3b362d8698
Defer to discord for disabling at-everyone in webhooks (#497)
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
2019-08-04 23:39:27 +02:00
Martin Ek
5ea6abbe86 Add tests for webhook usernames 2019-03-16 23:29:59 +00:00
Edward Jones
0e21e679fd Test bot converts same-guild channel mentions 2019-03-13 15:10:22 -03:00
Edward Jones
38e7f1fe3a Fix addRole and addEmoji stubs, add addTextChannel stub 2019-03-13 15:10:00 -03:00
rdb
ba505edd32 Add unit tests for IRC-style initial mentions (#470) 2019-03-04 15:47:48 +01:00
Martin Ek
f8ad2d2fa7 Define a custom winston logger 2018-09-19 00:24:52 +01:00
Edward Jones
f624134814 Fix parsing of animated emoji from Discord (#388)
(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:`.
2018-04-23 12:02:10 +02:00
Fiaxhs
90c901a034 Merge remote-tracking branch 'upstream/master' 2018-01-11 11:31:48 +01:00
Edward Jones
cff6eee324 Fix linting in new test for long object 2017-10-23 01:07:02 +01:00
Edward Jones
0992dc2da1 Add tests for partial and overlapping matches 2017-10-23 01:07:02 +01:00
Martin Ek
87a3458bdd Upgrade eslint-config-airbnb 2017-10-05 00:54:01 +02:00
Anirban Mukhopadhyay
be281c5add Add ability to ignore discord users by nickname 2017-10-04 11:45:50 -05:00
Anirban Mukhopadhyay
0adcf50b02 Fix ESLint issue & add test for ignoring IRC users 2017-10-04 11:45:36 -05:00
Eric Schneider
c0a4133d03 Closes #299 (#301)
* 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.
2017-09-18 00:54:36 +02:00
Fiaxhs
549b8fb767 One pass for webhook options
Variables renaming
Improved code readability
2017-08-03 13:52:25 +02:00
Fiaxhs
ff788083d1 Better tests
Preventing crash on empty nickname
2017-07-31 15:12:31 +02:00
Fiaxhs
e8c96e2a44 Fixed username/nickname matching 2017-07-31 10:59:58 +02:00
Fiaxhs
8a23a91931 Fix avatar lookup function (and tests) 2017-07-28 11:54:02 +02:00
Fiaxhs
4facb56ebb Updated avatar tests with new guild/members stub 2017-07-28 11:40:20 +02:00
Fiaxhs
07662761b4 Merge remote-tracking branch 'upstream/master' 2017-07-28 11:25:46 +02:00
Fiaxhs
34cdd373af Avatar matching is now more accurate and case insensitive 2017-07-28 11:19:25 +02:00
Edward Jones
f0ffc260cc Don't mutate given param, remove unnecessary guild constant 2017-07-19 15:02:18 +01:00
Edward Jones
e47d8e3aab Modify tests to use actual discord Collections and a single guild for clarity 2017-07-17 16:44:38 +01: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
Fiaxhs
d62dcfb9e6 Merge remote-tracking branch 'upstream/master' 2017-07-04 10:29:03 +02:00
Edward Jones
1aff7a99ef Skip sending falsy command preludes
Fixes #239 by allowing falsy command preludes to override default, and
then manually skipping them in the sendToIrc and sendToDiscord methods.
2017-07-01 21:11:59 +01:00
Doppins
483fc44e9b [Doppins] Upgrade dependency eslint to ^4.1.1 (#254)
* Upgrade dependency eslint to ^4.0.0

* Upgrade dependency eslint to ^4.1.0

* Upgrade dependency eslint to ^4.1.1

* lint: run eslint --fix
2017-07-01 12:08:49 -07: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
474d298713 Translate custom emoji references from IRC to Discord (#256)
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.
2017-07-01 11:44:31 -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
Fiaxhs
2bf761b163 getDiscordAvatar refactoring
Added test
2017-05-30 14:37:57 +02:00
Fiaxhs
fa9ef71372 Merge remote-tracking branch 'upstream/master' 2017-05-30 14:35:58 +02:00
Fiaxhs
9ea90a9d96 Merge remote-tracking branch 'upstream/master' 2017-05-02 12:42:29 +02:00
Edward Jones
4120c5961b Allow commandCharacters to work for messages sent to Discord
Fixes #217.
- Reorganize the comments describing how to format the custom
formatting options
- Make 'author' and 'nickname' synonyms in the custom formatting
- Add a 'side' parameter for commandPrelude (takes 'Discord' or
  'IRC', depending on whether the message was from Discord or IRC)
- Add debug messages upon sending command messages
- Add similar functionality for command messages sent in IRC to
  Discord, as from Discord to IRC
- Add tests for the above and custom formatting of it
2017-04-13 19:13:38 +01:00
Edward Jones
215c33baff Rename special->exact and getDiscordChannelFor->findDiscordChannel 2017-03-30 15:24:41 +01:00
Edward Jones
99e3a0f83f Add tests for not-in-channel vs channel-not-in-mapping 2017-03-30 15:24:41 +01:00
Edward Jones
de68c48202 Add test to ensure special messages send 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
Edward Jones
e4a994b996 Move formatting options into a separate 'format' object 2017-03-29 22:22:33 +01:00
Edward Jones
b88695eb56 Add tests for custom IRC output, fix to connect in Discord tests 2017-03-29 22:14:57 +01:00
Edward Jones
8e7900c9c5 Split tests into config contexts, add Discord format tests
Also fix an issue in a previous commit whereby Discord
channel names were not prefixed with '#' (despite the
comments suggesting that to be the case).
2017-03-29 22:14:57 +01:00
Martin Ek
bc3f51750a Merge pull request #208 from Throne3d/fix/username-mentions
Convert username mentions even if nickname set
2017-03-29 15:25:22 -04:00
Martin Ek
1daf62e5a6 Merge pull request #203 from Throne3d/add/role-mentions
Parse role mentions appropriately, as with channel and user mentions
2017-03-29 15:08:17 -04:00
Martin Ek
8c37393ca6 Merge pull request #202 from Throne3d/add-channelids-tests
Add Discord channel ID matching (PR #187) and tests for it
2017-03-29 15:06:57 -04:00
Edward Jones
8ef4ba9d44 Convert username mentions even if nickname set 2017-03-27 00:06:46 +01:00
Edward Jones
b30c4c34f3 Only translate role mentions from IRC if role is mentionable 2017-03-25 02:15:01 +00:00
Edward Jones
860a4137a7 Add IRC->Discord role mention parsing 2017-03-25 02:15:01 +00:00