Skip to content

Instantly share code, notes, and snippets.

@peko
Last active April 20, 2016 16:17
Show Gist options
  • Select an option

  • Save peko/6a5a634c27772e772e798ffcb3204cea to your computer and use it in GitHub Desktop.

Select an option

Save peko/6a5a634c27772e772e798ffcb3204cea to your computer and use it in GitHub Desktop.
Irc to telegram and back
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
@peko
Copy link
Author

peko commented Apr 20, 2016

Все посты из телеграм-группы с номером chat_id, ретранслируются в irc канал channel

И обратно, все посты из irc канала channel публикуются в телеграм группу с номером chat_id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment