170 Commits

Author SHA1 Message Date
Edward Jones
8a6dec41c6
Rename ircPreventMention to parallelPingFix (#520) 2019-12-14 14:31:12 -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
Martin Ek
15f2382639
Merge pull request #454 from simnalamburt/patch-1
Update bot.js
2019-03-16 23:16:11 +00:00
Edward Jones
d07ac66e39 Convert channel mentions similar to user mentions 2019-03-13 15:09:22 -03:00
rdb
d7d3bd6f67
Match IRC-style mentions at beginning of message 2019-02-11 13:54:26 +01:00
Hyeon Kim
d10606106f
Update bot.js
Username must be between 2 and 32 in length, even in the webhook.

Reference:
  https://discordapp.com/developers/docs/resources/user#usernames-and-nicknames
2018-12-11 22:40:55 +09:00
James Ward
ebee361e2d use non-deprecated form of Array.find (#449)
* 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
2018-11-22 18:28:18 +00: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
Martin Ek
4b2ffb2c2c
Merge pull request #316 from fishyFrogFace/master
Make it work with group DM
2017-10-27 19:20:25 +02:00
Edward Jones
0992dc2da1 Add tests for partial and overlapping matches 2017-10-23 01:07:02 +01:00
Edward Jones
188553b670 Improve IRC->Discord mentions for non-word characters and partial word matches 2017-10-23 01:07:02 +01:00
Anirban Mukhopadhyay
c3cac2b7ac Allow displayUsername to be used in command prelude (#321) 2017-10-05 01:01:47 +02:00
Martin Ek
87a3458bdd Upgrade eslint-config-airbnb 2017-10-05 00:54:01 +02:00
Anirban Mukhopadhyay
94d90960c6 Respond to PR comments. Mostly cleanup. 2017-10-04 17:12:15 -05: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
Anirban Mukhopadhyay
a12a186f8c Add ability to ignore certain IRC nicks 2017-10-04 11:45:11 -05:00
fishyFrogFace
78c4935614 Make it work with group DM 2017-09-30 23:12:17 +02:00
Edward Jones
7fbf1d0ba0 Set default encoding to UTF-8 (#315)
* 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
2017-09-30 16:35:59 +02:00
Dan Hemberger
8bf36dd58d bot.js: enable autoRenick by default (#302)
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.
2017-09-18 06:56:13 +02: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
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
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
Martin Ek
d7b4ab5889 Merge pull request #257 from Throne3d/fix/nickname-differs
Use ircClient.nick instead of nickname when guarding against events for current nick
2017-07-01 11:45:43 -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
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
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
Martin Ek
8c4d83a37d Merge pull request #241 from Junky2k/master
check if an user is present in the channel for nickchange
2017-05-16 10:51:05 -04:00
Richard Schöbel
fd95d7d9b0 check if an user is present in the channel 2017-05-16 16:06:39 +02:00
Martin Ek
5453e4589f Merge pull request #235 from Junky2k/master
send nick change from irc to discord
2017-05-16 08:53:18 -04: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
Martin Ek
a03433d357 Merge pull request #221 from Throne3d/add/discord-commands
Allow commandCharacters to work for messages sent to Discord
2017-05-15 22:30:05 -04: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