tuna / telegram2irc

A bot connect IRC and Telegram. Multiple binding is supported.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

This is a bot who can connect IRC channels with Telegram chat groups.

Dependencies

Notice

A new version of this software is now available at bigeagle branch. This version includes many great features, and is implemented based on JSON data support of telegram-cli. I highly recommad you to use the new version to get a better experience.

But I may not merge it into master branch, for it is mainly written by @bigeagle. I do not want to take credit for the work that @bigeagle does. XD

Thanks @bigeagle again for his hard working.

Usage

  1. If you have not used telegram-cli before, run it first, and set the correct phone number to log in.
  2. Create chat groups using create_group_chat command in telegram-cli, and use dialog_list to check wheather the groups are created successfully. Then exit the client.
  3. Run telegram-cli --json. Run dialog_list to get chat group IDs and run contact_list to get your IDs. Then exit the client.
  4. If you want to send telegram photos to imgur, register a imgur API id on https://api.imgur.com/oauth2/addclient , select "Anonymous usage" and fill a random URL to callback.
  5. Rename the config.py.example to config.py and edit it.
    1. Set the me to your user id formated as user#<id> to avoid the bot sending duplicated message.
    2. Set bindings to bind IRC channels with Telegram chats. Elements in binddings tuple are tuples, whose first element is IRC channel and the second element is Telegram chat ID formated as chat#<id>.
    3. blacklist in irc is a list which contains some nicks in IRC. The messages of these nicks won't be forwarded to Telegram.
    4. If you want to use imgur, set photo_store.provider to imgur and set API client_id in photo_store.options.
  6. Start the telegram-cli using telegram -d --json -P <port>, where <port> is the telegram client port you filled in config.py file, and --json is needed, -d is optional.
  7. Start the bot using python3 teleirc.py, then it will join the channels automatically and forwards the messages between Telegram and IRC.
  8. Add the bot as a contact on other Telegram accounts, and send .help to it, you can get the information about how to join a chat group, how to change the nick and etc.

TODO

License

This software is released with MIT License. See LICENSE file for more details.

About

A bot connect IRC and Telegram. Multiple binding is supported.

License:MIT License


Languages

Language:Python 100.0%