Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add(example): add a roger bot runs on wechaty telegram bot adaptor #684

Merged
merged 1 commit into from Jul 24, 2017

Conversation

hczhcz
Copy link
Member

@hczhcz hczhcz commented Jul 24, 2017

No description provided.

@coveralls
Copy link

coveralls commented Jul 24, 2017

Coverage Status

Coverage remained the same at 54.62% when pulling 2344566 on hczhcz:master into 95d6374 on Chatie:master.

@huan
Copy link
Member

huan commented Jul 24, 2017

Awesome!

Could you please also update the Example Wiki Page at here? https://github.com/Chatie/wechaty/wiki/Example

Thanks!

@huan huan merged commit bd6da54 into wechaty:master Jul 24, 2017
@hczhcz
Copy link
Member Author

hczhcz commented Jul 24, 2017

@zixia Got it. I have updated the Wiki.

@huan
Copy link
Member

huan commented Jul 24, 2017

Great!

@suntong
Copy link
Contributor

suntong commented Mar 6, 2018

@hczhcz, so what does this telegram-roger-bot.js do?

Roger Bot Uses Wechaty Telegram Bot Adaptor

which I found at https://github.com/hczhcz/wechaty-telegram

however, on looking into the readme, I still not quite understand what this Wechaty Telegram Bot Adaptor does.

Could you list what it is capable of (and maybe typical application scenario) please? Thx!

@suntong
Copy link
Contributor

suntong commented Mar 6, 2018

What I'm most eager to know is, is it possible to relay messages from weichat into a telegram room? If so, would you provide a sample code please? Thx!

@hczhcz
Copy link
Member Author

hczhcz commented Mar 6, 2018

@suntong

TL;DR:

Run your Telegram bot on WeChat!

The purpose is to run pre-exist Telegram bots on WeChat. If you have written a Telegram bot which uses node-telegram-bot-api, simply using the bot adaptor and you will get a WeChat bot.

Technically, it provides a different API from WeChaty's but runs on the same infrastructure as in WeChaty.


To forward messages between WeChat and Telegram, you need two bots (one for WeChat and another for Telegram).

const WechatyTelegramBot = require('wechaty-telegram');
const TelegramBot = require('node-telegram-bot-api');

const bot1 = new WechatyTelegramBot(...);
const bot2 = new TelegramBot(...);

Once a message comes into a bot, send it via another bot

bot1.on('message', (msg) => {
    bot2.sendMessage(...);
});
bot2.on('message', (msg) => {
    bot1.sendMessage(...);
});

That is probably what you are looking for.

@suntong
Copy link
Contributor

suntong commented Mar 6, 2018

Oh, thanks A LOT @hczhcz !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants