How to Connect Your Telegram Group to Your IRC Server

in #technology8 years ago (edited)


Image Source

Hey guys I set this up today and it works great so I thought other people might want this information compiled into one document. Hopefully this makes thing easier for you.

Note: This guide was written for Linux systems. Node is multi-platform so these steps apply to any system. Minor adjustments required.

Prepare necessary packages

Install node

The best way to do this is to use the nodesource repository (recommended on node.js website). We'll be installing Node v4. Node v6 probably works but most documentation uses v4 so let's stick to that.

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

Install the Node Package Manager (npm)

sudo apt-get install -y build-essential

Install teleirc

This is the Node module that acts as the relay between your IRC channel and Telegram group.

Make sure you have Git installed.

Clone the teleirc repository

git clone https://github.com/FruitieX/teleirc.git

Install module

[sudo] npm install -g teleirc

Create Telegram bot

Telegram's bot system is super easy to use. The whole thing works through their client GUI through an automated user called "BotFather". You will set up your telegram bot by chatting with BotFather. Don't worry, he doesn't byte.

Initiate conversation

Ad BotFather to your telegram contacts. You should be able to find him from the search bar.
Once you've added him, initiate a chat window and type:

/start

BotFather will give you a list of commands. You might want to save them for later, but for now we'll just use "/newbot".

Create bot

/newbot

BotFather will ask you for a name for the bot. The only requirement is that the name ends with "bot".

Save bot token

Upon creating your bot, BotFather will have given you a unique API token for your bot. Make sure to make a backup of the key as you'll need it later to configure your IRC bot.

Set privacy

To allow your bot to receive all messages, make sure that its privacy setting is set to DISABLED.
Type the following to change the setting.

/setprivacy

BotFather will give you the chance to adjust the configuration.

Adjust IRC bot config files

Now that you have all the necessary packages installed and your telegram is ready to go, all we have to do is configure the IRC side of things

Generate config

Generate a default config file for teleirc by using the following command.

teleirc --genconfig

Edit config

Edit the config file. It's located at ~/.teleirc/config.js.

  • line 14: set Token [config.tgToken = 'yourToken1234567...'
  • line 80: set Nick [config.ircNick = 'yourNick';]
  • line 81: set server IP [config.ircServer = 'your.domain';]
  • line 89: configure Telegram and IRC channels [under "config.channels" - the comments explain it nicely]

You can also change the bot userName but it's no strictly necessary.
Save the file.

Run teleirc

Everything should be ready to go. Run the app.

teleirc

Now every message that is sent in either IRC channel or Telegram group will be reproduced in the other via the bot.


steemit: @martin-stuessy
other: Portfolio page

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 60777.85
ETH 2609.63
USDT 1.00
SBD 2.65