ritlug / teleirc Goto Github PK
View Code? Open in Web Editor NEWGo implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
Home Page: https://docs.teleirc.com/
License: GNU General Public License v3.0
Go implementation of a Telegram <=> IRC bridge for use with any IRC channel and Telegram group
Home Page: https://docs.teleirc.com/
License: GNU General Public License v3.0
The Fedora container image fails to start. Need to get it working and running as expected again. Also, upgrade to Fedora 29?
teleirc does not crash and return an exit code if it encounters an unrecoverable error. Rather, it fails and hangs without exiting.
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.
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
Organization: Hamara Linux
Website: https://hamaralinux.org
Telegram group URL: https://t.me/hamaraLinux
IRC Channel: #hamara on irc.oftc.net
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 :(
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.
Send notification from Telegram bot to group when IRC connection is lost and when it is restored
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…
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.
Less confusion when a connection drops and cross-bridge conversation is interrupted (and messages will never be relayed automatically later)
Pure Data / https://puredata.info
https://t.me/puredata
#dataflow on freenode
Organization: l.u.ma.ca. (Linux Users Massa Carrara)
Website: https://www.lumacaonline.org/
Telegram group URL: https://t.me/joinchat/Afu_TAczLfB4dQRKeYQCqg
IRC Channel: #lumaca on irc.autistici.org
Thanks
When a member of a Telegram group leaves the group teleirc tries to evaluate
Line 333 in e81ff0b
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.
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.
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.
/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)
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
The container builds successfully and teleirc is spawned.
OS: Ubuntu/Xenial
Docker: Installed the docker-io package from the Ubuntu Xenial repo
Telegram bots are rate limited:
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.
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"}}
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?
Similar blocks of code found in 4 locations. Consider refactoring.
https://codeclimate.com/github/RITlug/teleirc/lib/TeleIrc.js#issue_5aaa879fe65aaa0001000036
Break up documentation from single, monolithic pages to more modular, bite-sized pages
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).
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:
Usage
section)Documentation is more useful to non-developers, easier to find key information, better visibility into different parts of Teleirc
The teleirc readthedocs page explains what each of the configurations do in the env.example
config file. However, there are two examples missing. IRC_NICKSERV_SERVICE
, and IRC_NICKSERV_PASS
.
We need to describe what these options are used for.
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:
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
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.
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.
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.
_UploadImage
, or implement uploadUrl
.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.
Need better developer docs for new contributors. Working with @icflournoy @Zedjones and noticed the docs aren't clear in this way.
[deleted]
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.
This will make the messages easier to understand on the irc side.
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
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.
Ensure teleirc is able to start and stop successfully when running in the CI environment
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.
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.
Making CI tests more reliable again
File TeleIrc.js
has 308 lines of code (exceeds 250 allowed). Consider refactoring.
https://codeclimate.com/github/RITlug/teleirc/lib/TeleIrc.js#issue_5aaa8799e65aaa0001000027
Inspired by 42wim/matterbridge#175.
Insert zero-width space in Telegram usernames sent to IRC to prevent pinging IRC usernames with the same Telegram nick
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.
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.
Better user experience for people chatting on both sides of a bridge when their Telegram username and IRC nick are the same
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!
This is REALLY great for beginners looking to get their feet wet who knows Node.js well and has good code design instincts.
Currently we are at a D -- let's get it up!
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.
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.
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.
Allow user to configure more parts of the IRC server connection (e.g. server port, using self-signed TLS certs, etc.)
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.
Implementation should be straightforward. New env variables should be created for the following:
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.
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?
In the Fedora Project, the Fedora Marketing team is using TeleIRC.
Imgur unit tests fail
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
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.
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.
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.
Officially support Node v10.x LTS and integrate support into CI tests
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.
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.
Better support for newer versions of Node, more cookie points for users / developers who want to use newer versions of Node
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)
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.