/tg-irc-relay

Relay between Telegram groups and IRC channels.

Primary LanguagePythonGNU Lesser General Public License v3.0LGPL-3.0

Telegram-IRC Relay Bot

A lightweight Telegram-IRC relay bot written in Python. It won't eat messages or memory.

Run: python3 relay.py [-d]

-d for debug mode.

Deprecated

Check out the simple branch of orizonhub instead. This branch removes unnecessarily bloated functions, like this project and the tg-chatdig project.

Config

The config file must be config.json, see the example. You must disable the privacy mode for your bot.

  • botid: The number in the token before :
  • botname: Your bot's name
  • groupid: The Telegram group id to be forwarded. To get it, enable debug mode -d, add your bot into the group, say something in the group, and copy the 'message'/'chat'/'id' from the "Msg arrived" line (without -). This ID MUST be positive.
  • groupname: The group's name
  • i2t: true/false, Enable/disable IRC to Telegram forwarding
  • ircignore: Ignore users that match the regex. Don't be empty, use "^$" to disable.
  • ircbotid: The ID of the bot which forwards messages. Usually it should be the same as botid, except that there is another bot responsible for this.
  • ircbotname: The name (in Telegram) of the forwarding bot. Usually it should be the same as botname
  • ircchannel: The IRC channel to forward
  • ircnick: The bot's nickname in IRC
  • ircport, ircserver, ircssl, ircpass: How to connect to the IRC server. ircpass is optional, can be blank.
  • offset: Use 0 for the first time, don't manually change it after
  • shownick: true/false, Enable/disable prefixing of messages sent to Telegram with the IRC nick of the sender (enabled by default)
  • t2i: true/false, Enable/disable Telegram to IRC forwarding
  • token: Your bot's token
  • servemedia (Optional): Can be "" or "self" or "vim-cn".
  • cachepath (When "servemedia" is not empty): Where should the images be stored. YOU are responsible for clearing this directory. (eg. set up a cron job of find $CACHEPATH -type f -mtime +1 -delete.)
  • serveurl (When "servemedia" is "self"): The url prefix where the images can be retreived from your server, which should be an alias of cachepath.

See also