Skip to content
Permalink
Browse files

Add support for channel key

  • Loading branch information...
Tjzabel committed Sep 30, 2019
1 parent babc0f1 commit 1f4039a9a259e9fc384063b0effa47099a57a425
Showing with 9 additions and 3 deletions.
  1. +1 −0 config.js
  2. +3 −0 docs/config-file-glossary.rst
  3. +1 −0 env.example
  4. +1 −1 teleirc.js
  5. +3 −2 tests/IrcConnectionTests.js
@@ -10,6 +10,7 @@ let settings = {
tlsAllowSelfSigned: process.env.IRC_CERT_ALLOW_SELFSIGNED === "true" || false,
tlsAllowCertExpired: process.env.IRC_CERT_ALLOW_EXPIRED === "true" || false,
channel: process.env.IRC_CHANNEL || "",
channelKey: process.env.IRC_CHANNEL_KEY || "",
botName: process.env.IRC_BOT_NAME || "teleirc",
sendStickerEmoji: process.env.IRC_SEND_STICKER_EMOJI === "true" || true,
sendDocument: process.env.IRC_SEND_DOCUMENT === "true" || false,
@@ -20,6 +20,9 @@ IRC settings
``IRC_CHANNEL=#channel``
IRC channel for bot to join

``IRC_CHANNEL_KEY=""``
IRC channel key

``IRC_SEND_STICKER_EMOJI=true``
Send emojis associated with a sticker to IRC (when a Telegram user sends a sticker)

@@ -9,6 +9,7 @@
IRC_BLACKLIST=""
IRC_BOT_NAME=teleirc
IRC_CHANNEL=#channel
IRC_CHANNEL_KEY=""
IRC_SEND_STICKER_EMOJI=true
IRC_SEND_DOCUMENT=false
IRC_PREFIX="<"
@@ -22,7 +22,7 @@ let ircbot = new irc.Client(config.irc.server, config.irc.botName, {
password: config.irc.serverPassword,
selfSigned: config.irc.tlsAllowSelfSigned,
certExpired: config.irc.tlsAllowCertExpired,
channels: [config.irc.channel],
channels: [`${config.irc.channel} ${config.irc.channelKey}`],
debug: false,
username: config.irc.botName,
autoConnect: false,
@@ -35,12 +35,13 @@ const TEST_NICKSERV_SERVICE = "TestNickServServiceNick";
const TEST_MESSAGE = "Test message body";
const BLACKLISTED_NICK = "Nasty one!";
const TEST_IRC_CHANNEL = "#EXAMPLE_IRC_CHANNEL";
const TEST_IRC_CHANNEL_KEY = "testkey";
const TEST_SETTINGS = {
token: "EXAMPLE_TOKEN",
ircBlacklist: [BLACKLISTED_NICK, "some other blacklisted nick"],
irc: {
server: "EXAMPLE_IRC_SERVER",
channel: TEST_IRC_CHANNEL,
channel: `${TEST_IRC_CHANNEL} ${TEST_IRC_CHANNEL_KEY}`,
botName: "exampleBotName",
sendStickerEmoji: "",
prefix: "<_",
@@ -215,6 +216,6 @@ exports.IrcConnectionTests = {
uut.initStage3_initBots(this.ircBotMock, this.tgBotMock);
uut.initStage4_addIrcListeners();

this.ircBotMock.fireMessageEvent(EXPECTED_NICK, TEST_IRC_CHANNEL, TEST_MESSAGE);
this.ircBotMock.fireMessageEvent(EXPECTED_NICK, `${TEST_IRC_CHANNEL} ${TEST_IRC_CHANNEL_KEY}`, TEST_MESSAGE);
},
};

0 comments on commit 1f4039a

Please sign in to comment.
You can’t perform that action at this time.