Code Monkey home page Code Monkey logo

teleirc's Introduction

TeleIRC

TeleIRC logo by Ura Design

License: GPL v3 CircleCI Documentation Status Maintainability Test Coverage

Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group

About

RITlug TeleIRC is a Go implementation of a Telegram <=> IRC bridge. TeleIRC works with any IRC channel and Telegram group. It bridges messages between a Telegram group and an IRC channel.

This bot was originally written for RITlug. Today, it is used by various communities.

Live demo

A public Telegram supergroup and IRC channel (on Freenode) are available for testing. Our developer community is found in these channels.

Contribute to TeleIRC

See our contributing guidelines.

Who uses TeleIRC?

See what projects and communities use TeleIRC.

Who uses TeleIRC?

Documentation

See the project documentation to install and use TeleIRC.

License

TeleIRC is licensed under the GNU General Public License 3.0. Not a lawyer? Get a quick summary from tldrlegal.com on what you can, cannot, and must do.

teleirc's People

Contributors

ablakely avatar amirhossein2000 avatar axk4545 avatar bmamlin avatar denisse-dev avatar dependabot[bot] avatar dhaneshsabane avatar felixonmars avatar fgaz avatar gnikandrov avatar half-duplex avatar itamarjp avatar jkramarz avatar jwflory avatar kennedy avatar kevinassogba avatar mbologna avatar michalrud avatar mnixry avatar palid avatar regismesquita avatar repkam09 avatar robbyoconnor avatar rskikuli avatar seckatie avatar thenaterhood avatar tjzabel avatar weezel avatar xforever1313 avatar zedjones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teleirc's Issues

Fix undefined var: "ReferenceError: imgur is not defined"

This is a bug where the existing code in master branch does not work because of an undefined variable:

$ docker run --rm -it teleirc-fedora-tmp
node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. module.js:653:30
Reading config file to get bot API token...
/opt/teleirc/lib/TeleIrc.js:39
      imgur.setClientId(this.config.imgur.imgurClientId);
      ^

ReferenceError: imgur is not defined
    at new TeleIrc (/opt/teleirc/lib/TeleIrc.js:39:7)
    at Object.<anonymous> (/opt/teleirc/teleirc.js:12:15)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

Allow user to configure more variables for IRC server connection (e.g. port, SSL certs, etc.)

Summary

Allow user to configure more parts of the IRC server connection (e.g. server port, using self-signed TLS certs, etc.)

Background

IRC servers are a wild world. Everyone can do things a little bit differently or deploy their network in a different way. Most of the current developers run the bot on Freenode, so we haven't thought about other bots as much. However, to make the bot more useful for more people, more options should be opened up for configuration for those who need it.

Details

Implementation should be straightforward. New env variables should be created for the following:

  • IRC server port
  • Allow expired / self-signed TLS certificates

These env variables should be used when negotiating the connection to the IRC server, instead of using hard-coded defaults. For our purposes, we can ship the Freenode defaults in our env.example file.

Outcome

More people can use the bot on a range of different IRC networks, outside of only Freenode


Original comment:

There is a way to specify IRC server port as well as SSL self signed certificate or turning on debug in the .env file or as environment variables?

spurious disconnect

this morning my teleirc bridge suddenly disconnected from the IRC.

the relevant logs from my docker-container running teleirc are:

Sep 06 07:33:20 docker1 env[9707]: teleirc_1  | Unhandled rejection TimeoutError: operation timed out
Sep 06 07:33:20 docker1 env[9707]: teleirc_1  |     at afterTimeout (/opt/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/timers.js:16:15)
Sep 06 07:33:20 docker1 env[9707]: teleirc_1  |     at Timeout.timeoutTimeout [as _onTimeout] (/opt/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/tim
Sep 06 07:33:20 docker1 env[9707]: teleirc_1  |     at ontimeout (timers.js:498:11)
Sep 06 07:33:20 docker1 env[9707]: teleirc_1  |     at tryOnTimeout (timers.js:323:5)
Sep 06 07:33:20 docker1 env[9707]: teleirc_1  |     at Timer.listOnTimeout (timers.js:290:5)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  | Unhandled rejection RequestError: Error: connect EADDRNOTAVAIL 2001:67c:4e8:f004::9:443 - Local (:::0)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at new RequestError (/opt/teleirc/node_modules/request-promise/lib/errors.js:11:15)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at Request.RP$callback [as _callback] (/opt/teleirc/node_modules/request-promise/lib/rp.js:60:32)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at self.callback (/opt/teleirc/node_modules/request/request.js:186:22)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at emitOne (events.js:116:13)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at Request.emit (events.js:211:7)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at Request.onRequestError (/opt/teleirc/node_modules/request/request.js:845:8)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at emitOne (events.js:116:13)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at ClientRequest.emit (events.js:211:7)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at TLSSocket.socketErrorListener (_http_client.js:387:9)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at emitOne (events.js:116:13)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at TLSSocket.emit (events.js:211:7)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at emitErrorNT (internal/streams/destroy.js:64:8)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at _combinedTickCallback (internal/process/next_tick.js:138:11)
Sep 06 07:33:25 docker1 env[9707]: teleirc_1  |     at process._tickCallback (internal/process/next_tick.js:180:9)

the container is configured to restart on exit. however it seems that these "unhandled errors" are not fatal, but the bridge never attempts to recover from them, thus keeping the bridge in disconnected state.

(sidenote: i have no clue what happened on the telegram side, as i'm not subscribed there)

Handle telegram bot rate limiting

Telegram bots are rate limited:

  • Less than 1 message per second
  • No more than 20 messages per minute

When bridging IRC, this clearly becomes a problem in particularly active chats. The bot needs to understand the rate limits and batch messages in order to avoid hitting the limits. Ideally, this will make use of an intelligent algorithm which will do a batch-and-wait for large volumes of messages, but will immediately forward messages for lower message volumes. It also needs to do this in a way that doesn't result delays that are long or frequent enough to disrupt the chat.

Teleirc fails to start from master in certain environments

Issue

Currently, when running teleirc from CentOS 7, teleirc does not start, citing an unexpected identifier.

In my experience, this usually occurs when async is not supported in nodejs. However, node is on version 8.x.x, which should support the async functionality added in the 7.x.x versions.

We need to figure out why the master branch is failing, and also whether or not this is an isolated case with a CentOS 7 server. Further testing needs to be done with our Dockerfiles to figure out if this is an isolated issue or not.

Stacktrace

/usr/lib64/teleirc/rit-foss/lib/TelegramHandlers/TgDocumentHandler.js:31
    async RelayDocumentMessage(from, document) {
          ^^^^^^^^^^^^^^^^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib64/teleirc/rit-foss/lib/TeleIrc.js:9:27)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/lib64/teleirc/rit-foss/teleirc.js:6:17)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)

Leave/join usernames are sent to the wrong channel

When using teleirc for two channels with

config.sendNonMsg = true;

if someone leaves channel1 in IRC, it would message channel1 mirror in Telegram, but also channel2 mirror in Telegram;
Steps to reproduce:
Config your bot to be in two channels
-> #sugar
-> #poxip

Supposing that you are in #sugar , leave in #sugar
expected: teleirc to send a message to #sugar mirror in Telegram
result:
#sugar mirror in telegram the messages
but #poxip mirror get the message two.

config.js: https://paste.fedoraproject.org/494846/80617652/

Test cases regarding NickServ identification

There are some test cases that would be nice to write for #65 , unfortunately I don't have time to do so in a timely manner :(

  1. Test checking that joining the channel doesn't happen before nickserv answers
  2. Test checking that receiving a message from anyone else than nickserv doesn't trigger joining the channel
  3. Consider parsing NickServ messages to understand if we're really identified

If there are any questions, feel free to contact me :) There are also some tests in IrcConnectionTests.js on which new test can base on.

Bot fails to post to Telegram

I was creating a Docker image from this repo and it failed to post to Telegram. Debugging teleirc.js revealed a couple places where chatId was mistyped as chatID. A pull request is on its way!

Fix Imgur Photo Uploading

With #87 we've discovered imgur is not properly set up, and so therefore we get an error saying imgur is undefined.

In order to fix this, we need to implement proper Imgur photo uploading from Telegram to IRC.
Here is my suggestion for how we move forward.

Steps to get Imgur Working

  1. Obtain Imgur API key.
  2. Either add image uploading to _UploadImage, or implement uploadUrl.
  3. Create test cases to test new implementation

Helpful links

Add bold formatting to usernames in message strings on both Telegram and IRC

Summary

When using the bridge bot, it would be helpful if usernames were marked up with bold text, to help separate them from the message body on IRC and Telegram.

Analysis

In #8, there was a lot of discussion about how this should be implemented, especially in terms of using pre-existing libraries for markdown. Before completing or coming up with a solution to close this issue, please read through the comments and discussion in #8.

Fix Fedora container image

The Fedora container image fails to start. Need to get it working and running as expected again. Also, upgrade to Fedora 29?

Refactor documentation into smaller pages (to make it more readable)

Summary

Break up documentation from single, monolithic pages to more modular, bite-sized pages

Background

We have documentation, but it is not easy to read. It is wordy and sometimes confusing. Our docs should take on small topics and focus on those topics. This also helps our documentation's searchability and makes it easier to navigate (in other words, important information isn't buried).

Details

The installation page is in need of the most love. This page could be 3-4 pages. I was thinking to split it up this way:

  • Quick installation guide (i.e. numbered steps about how to do a fast install)
  • Create Telegram bot
  • Configure IRC channel
  • Explaining the config file
  • Deployment options (currently Usage section)
  • Maybe more…?

Outcome

Documentation is more useful to non-developers, easier to find key information, better visibility into different parts of Teleirc

Add Telegram-side highlighting for IRC messages prefixed with username

Users on IRC will use another user's nick to highlight their attention. This notification behavior is not translated over to Telegram, which receives them as plain text. For users on IRC-side, it can be confusing if they have notified someone or not.

Add a pre-processing hook for IRC-to-Telegram messages that scan the beginning of the message string for a single "word" prefixed by a :. If this is found, assume the text is a username and prefix the message string with an @.

This improves the user experience for participants in IRC and makes it easier to engage and continue conversations across the bridge.

Docker containers should not operate as root!

Docker containers should whenever possible become a non-privileged user. The root user in the containers has access to EVERYTHING. Let me reiterate, root in container means root in the main system.

I plan on fixing this but wanted an issue attached to this.

multi-line messages should have each lined prefixed with the userid

Currently, when a message with newlines is posted to Telegram, it will be automatically splitted by the bot (well, technically by the underlying irc client library), so when user1 posts a message like this to Telegram (notice the newline):

This is my message.
<user2> I am not very smart

teleirc will post following messages to the IRC channel:

<teleirc>: <user1> This is my message.
<teleirc>: <user2> I am not very smart

Therefore, misleading other IRC users into thinking that user2 admitted his/her own shortcomings.

I will be preparing a PR with a fix. The code is mostly ready, but I would like to test it more before I would consider it ready enough as I didn't actually test it with telegram nor IRC.

Support for registering nicks

As we discovered in our (RITlug & FOSS@MAGIC) spam mitigation during the recent Freenode spam attacks, having bots with unregistered nicks can get them kicked from a channel. This issue requests support for a registered nick. Most likely this would take the form of:

  • config values for the desired nick & NickServ password
  • authenticating to NickServ when joining the server
  • authenticating to NickServ any time NickServ challenges it

A member leaving the Telegram group causes unhandled promise rejection

Summary

When a member of a Telegram group leaves the group teleirc tries to evaluate

} else if (msg.left_chat_member && teleirc.config.irc.showLeaveMessage) {
resulting in the following trace being thrown:

Unhandled rejection ReferenceError: teleirc is not defined
    at TeleIrc.handleTelegramMsg (/home/icflournoy/dev/RITlug/teleirc/lib/TeleIrc.js:335:44)
    at TelegramBot.emit (/home/icflournoy/dev/RITlug/teleirc/node_modules/eventemitter3/index.js:116:35)
    at TelegramBot.processUpdate (/home/icflournoy/dev/RITlug/teleirc/node_modules/node-telegram-bot-api/lib/telegram.js:120:14)
    at /home/icflournoy/dev/RITlug/teleirc/node_modules/node-telegram-bot-api/lib/telegramPolling.js:59:17
    at Array.forEach (native)
    at /home/icflournoy/dev/RITlug/teleirc/node_modules/node-telegram-bot-api/lib/telegramPolling.js:56:17
    at tryCatcher (/home/icflournoy/dev/RITlug/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/util.js:26:23)
    at Promise._settlePromiseFromHandler (/home/icflournoy/dev/RITlug/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/promise.js:510:31)
    at Promise._settlePromiseAt (/home/icflournoy/dev/RITlug/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/promise.js:584:18)
    at Promise._settlePromises (/home/icflournoy/dev/RITlug/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/promise.js:700:14)
    at Async._drainQueue (/home/icflournoy/dev/RITlug/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/async.js:123:16)
    at Async._drainQueues (/home/icflournoy/dev/RITlug/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/async.js:133:10)
    at Immediate.Async.drainQueues (/home/icflournoy/dev/RITlug/teleirc/node_modules/request-promise/node_modules/bluebird/js/main/async.js:15:14)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)

I have tested using both the default configuration and a custom configuration.
default

SHOW_ACTION_MESSAGE=true
SHOW_JOIN_MESSAGE=false
SHOW_KICK_MESSAGE=true
SHOW_LEAVE_MESSAGE=false

all-enabled

SHOW_ACTION_MESSAGE=true
SHOW_JOIN_MESSAGE=true
SHOW_KICK_MESSAGE=true
SHOW_LEAVE_MESSAGE=true

It's an easy fix I can open a PR for.

Bot should check API responsiveness upon startup

Had an issue when bot started just fine and joined the IRC channel but nothing got redirected from IRC to TG or vice versa. No errors. Tried to curl the api but got "curl: (35) Unknown SSL protocol error in connection to api.telegram.org:443", curling from the same host with --interface "different ip" worked, so I'd guess it's a some kind of rate limit/blacklist on Telegrams end.

Maybe the bot could do a /getMe API-call upon startup to check that API is actually responding? getMe response looks like this:

{"ok":true,"result":{"id":xxx,"is_bot":true,"first_name":"botnick","username":"botname"}}

Include limited characters from Telegram replies in relayed IRC message

The teleboto bot in #fedora-zh does to interesting things. Notice this exchange from the IRC side:

[alick9188] @bexelbie You're living in China?
[bexelbie] 「Re alick9188: @bexelbi...」Nope. I’ll be in Beijing for LC3 though.

First, the name from telegram is in square brackets, making it more obvious it is passed through.

Second, it quotes part of the replied to message to give greater context.

WDYT?

Large Telegram messages should go on pastebin

IRC users get annoyed when one Telegram user posts a codeblock or just a multiline message.
It should be configurable that preformatted multilined text and any other text with >n carriage returns/newlines automatically are turned into a pastebin to be linked to in the IRC.

see also: FruitieX/teleirc#249

Insert zero-width space in Telegram usernames sent to IRC

Inspired by 42wim/matterbridge#175.


Summary

Insert zero-width space in Telegram usernames sent to IRC to prevent pinging IRC usernames with the same Telegram nick

Background

If someone is on both sides of a bridged Telegram group and IRC channel, and has the same username, they will get pinged on IRC whenever they send a message from Telegram. This can be annoying for IRC users when chatting from Telegram.

One solution is to insert a zero-width character into the Telegram username field sent to IRC. This prevents pinging IRC users when they chat from Telegram.

Details

I think the space needs to be inserted after the first character or before the last. Maybe the easiest solution is to insert it after the first character of the Telegram username.

This space should only be inserted in a username relayed from Telegram to IRC.

Outcome

Better user experience for people chatting on both sides of a bridge when their Telegram username and IRC nick are the same

Image url reveals bot's token

Imgur is not configured.
Sending an image on Telegram, the API URL appears on IRC.
Such URL contains the token of the bot, that should be keep private.

'Untitled Image' uploaded by XXXXXX: https://api.telegram.org/file/botXXXXXXXXXXX:XXXXXXXXXXXXXXXXXX/photos/file_1.jpg

Is this the only way to use the Telegram API?
There is a way to disable images on IRC, if Imgur is not configured?

Thanks.

Needs validation: does bot automatically restart when env file is hot-swapped while running?

Recently, since I started to use Ansible to deploy the bot, I noticed that the bot appears to restart on its own when the .env file is replaced while the bot is running. Currently, I restart the bot after reloading the config (and unfortunately, if one updates, I'm restarting all of them 😕 ). But if I don't have to do this anymore… that would be awesome.

We need help from a willing tester to try and confirm this. A manual test should include both editing the file in place and also completely replacing the file with a new copy.

Make CI tests more demanding: run with testing config to evaluate successful start-up

Summary

Ensure teleirc is able to start and stop successfully when running in the CI environment

Background

Recently, a breaking change accidentally made it to master even though our CI tests passed. It ran our code unit tests, but uncovered code got through and broke the application. Doing a full system start/stop is like a catch-all for anything that is not yet covered, to assert minimum functionality is there.

Details

I think the easiest way is to figure out a way to run CI builds with a testing config is the best way to do it. There are ways to encrypt variables for Travis CI in a repo, so we could do that with some of the API tokens. Needs more digging into.

Outcome

Making CI tests more reliable again

Support Node v10.x LTS

Summary

Officially support Node v10.x LTS and integrate support into CI tests

Background

NodeJS upstream released Node v10.0.0 in April 2018. It's had a few months in the wild and will receive long-term support for a few extra years. It's a good idea to keep up with upstream LTS so we don't fall behind. Only supporting LTS releases is also easier for the personal bandwidth of everyone involved with development.

Details

Updating Travis CI tests to also run with Node v10.x will close this ticket.

Currently, the bot is running without issues in a Node v10.14.1 environment. We need to make sure our unit tests still work tested up to this version.

Outcome

Better support for newer versions of Node, more cookie points for users / developers who want to use newer versions of Node

Add code convention recommendations

We should consider adding a code style guide so teleirc code is consistent. This makes approaching things in the project easier because there's consistent code format throughout. This also would make it possible to add linting.

I'd recommend this one as it's relatively commonly used, but there are other options as well. https://github.com/airbnb/javascript

npm install fails when using docker-compose with Node Alpine Linux image

The Error:

dhanesh@web:~/teleirc$ docker-compose up -d teleirc
Building teleirc
Step 1/9 : FROM node:8-alpine
 ---> ca148a52ea10
Step 2/9 : RUN apk add --no-cache --update bash         && addgroup -g 99 teleirc         && adduser -s /bin/bash -h /opt/teleirc -D -H teleirc -u 99 -G teleirc
 ---> Running in c5579faf03a4
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(2/5) Installing ncurses-terminfo (6.0_p20171125-r0)
(3/5) Installing ncurses-libs (6.0_p20171125-r0)
(4/5) Installing readline (6.3.008-r5)
(5/5) Installing bash (4.3.48-r1)
Executing bash-4.3.48-r1.post-install
Executing busybox-1.26.2-r11.trigger
OK: 14 MiB in 20 packages
 ---> 26be5ee24e07
Removing intermediate container c5579faf03a4
Step 3/9 : WORKDIR /opt/teleirc
 ---> ea3dec38240d
Removing intermediate container 1873e28aaf11
Step 4/9 : CMD node teleirc.js
 ---> Running in d7fe13c00f80
 ---> 27a2389bdeb6
Removing intermediate container d7fe13c00f80
Step 5/9 : COPY . /opt/teleirc
 ---> 57a086166ac7
Removing intermediate container 9c149b22b461
Step 6/9 : COPY config.js.example /opt/teleirc/config.js
 ---> 328fb76c62c7
Removing intermediate container d1c38505e8f4
Step 7/9 : RUN chown -R teleirc:teleirc /opt/teleirc
 ---> Running in 17e497782e8f
 ---> 47366bf75fde
Removing intermediate container 17e497782e8f
Step 8/9 : USER teleirc
 ---> Running in 0d351f0f03f4
 ---> 4d4850d08f15
Removing intermediate container 0d351f0f03f4
Step 9/9 : RUN npm install
 ---> Running in d18f99f02eb4
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN notice [SECURITY] minimatch has the following vulnerability: 1 high. Go here for more details: https://nodesecurity.io/advisories?search=minimatch&version=2.0.10 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.

> [email protected] preinstall /opt/teleirc/node_modules/node
> node installArchSpecificPackage

+ [email protected]
added 1 package in 4.086s

> [email protected] install /opt/teleirc/node_modules/irc/node_modules/iconv
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.4.0-87-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/teleirc/node_modules/irc/node_modules/iconv
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

> [email protected] install /opt/teleirc/node_modules/node-icu-charset-detector
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.4.0-87-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/teleirc/node_modules/node-icu-charset-detector
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

> [email protected] install /opt/teleirc/node_modules/iconv
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:397:16)
gyp ERR! stack     at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/which/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Linux 4.4.0-87-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/teleirc/node_modules/iconv
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/irc/node_modules/iconv):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/node-icu-charset-detector):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /opt/teleirc/.npm/_logs/2018-07-18T13_57_42_290Z-debug.log
ERROR: Service 'teleirc' failed to build: The command '/bin/sh -c npm install' returned a non-zero code: 1

Expected behaviour

The container builds successfully and teleirc is spawned.

Host machine details

OS: Ubuntu/Xenial
Docker: Installed the docker-io package from the Ubuntu Xenial repo

Fix Imgur Unit Tests

Problem

Imgur unit tests fail

Why?

The TgImgurPhotoHandler class is expecting an imgur object in its constructor. Currently, the mockImgur object is being passed into this parameter in the tests. This causes an error when running yarn test stating:

TgPhotoHandlerTests
✔ TgPhotoHandler_DisabledTest
✔ TgPhotoHandler_EnabledNoCaptionTest
✔ TgPhotoHandler_EnabledCaptionTest
Error when uploading to imgur: undefined
✔ ImgurPhotoHandler_SuccessTest

Possible Solution

I believe this is happening because the mockImgur object does not require('imgur') and so therefore does not pull from its properties. We need to figure out the best way to create a test imgur object.

Secondary Issue

Looking at this line of code in TgPhotoHandlerTests.js:

let photoSmall = {
    file_id : 1,
    file_size : 1,
    url : "https://ritlug.com/test/1.png",
    imgurUrl : "https://imgur.com/small.png"
};

The url field has a broken link. When the RITlug website was redesigned, these test images did not transfer over to the new site.
We have added new assets to be used in place of these broken test images.

Secondary Solution

This is an easy fix
Simply replace the https://ritlug.com/test/#.png links with the raw.githubusercontent.com links from each of the asset images.

Send Telegram notification when connection to IRC is lost/restored

Summary

Send notification from Telegram bot to group when IRC connection is lost and when it is restored

Background

Sometimes the bot may crash, restart, or otherwise not be connected. In IRC, this is clear because the bot has to join the channel and have proper permissions to speak. In Telegram, there is no indication when the connection is broken. It might be helpful to prevent a situation like this

Details

I'm not sure what our current options are to get the state of the IRC connection. If it's easy to get, then we should have an event handler for when the connection disconnects and reconnects after the bot's initial start-up.

Outcome

Less confusion when a connection drops and cross-bridge conversation is interrupted (and messages will never be relayed automatically later)

Add note to docs when Telegram bot "goes to sleep" and doesn't work

The other day, in one group, we had issues where a bridge bot was not working. It turns out, the Telegram bots can "go to sleep" if they lie dormant for a long time. I had to remove and re-add the bot to the group, and then it magically started working again.

Maybe this would be a good opportunity to revise the docs for clarity and add a FAQ section.


Blocking this on #77 for now.

Support cancellation of promises with node-telegram-bot-api

Every time the bot runs, this text blurb pops up:

node-telegram-bot-api deprecated Automatic enabling of cancellation of promises is deprecated.
In the future, you will have to enable it yourself.
See https://github.com/yagop/node-telegram-bot-api/issues/319. module.js:653:30

It would be nice to ensure promises can be canceled, since it seems we're using them actively. I'll try to dig into this one and see if I can find a fix.

To add the Russian community of LibreOffice

I would like to know if you can help with the organization of communication between telegrams and irc.
We have two channels #libreoffice-ru on the freenode and libreofficeru in the telegrams. But we do not have a server to install the teleirc.
I know that you help community LibreOffice with some channals.
Is it possible for Russian part?
Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.