Last active
April 20, 2016 16:17
-
-
Save peko/6a5a634c27772e772e798ffcb3204cea to your computer and use it in GitHub Desktop.
Irc to telegram and back
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| irc = require 'irc' | |
| TelegramBot = require 'node-telegram-bot-api' | |
| token = '' # INSERT YOUR BOT TOKEN HERE | |
| tele = new TelegramBot token, polling: true | |
| channel = #INSERT YOUR IRC CHANNEL HERE "#mytestchannel" | |
| chat_id = #INSERT YOUR TELEGRAM GROUP ID HERE -123456789 | |
| client = new irc.Client 'irc.usenet.net', 'myircname', | |
| port: 6666 | |
| millisecondsOfSilenceBeforePingSent: 60 * 1000, | |
| millisecondsBeforePingTimeout: 30 * 1000 | |
| channels: [channel] | |
| debug: true | |
| client.addListener 'message', (from, to, message)-> | |
| msg = "#{from}: #{ message }" | |
| console.log msg | |
| tele.sendMessage chat_id, msg | |
| tele.on 'message', (msg)-> | |
| console.log msg | |
| client.say channel, msg.text if client? and msg.chat.id is chat_id |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Все посты из телеграм-группы с номером chat_id, ретранслируются в irc канал channel
И обратно, все посты из irc канала channel публикуются в телеграм группу с номером chat_id