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

Projects
None yet
4 participants
@hczhcz
Member

hczhcz commented Jul 24, 2017

No description provided.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jul 24, 2017

Coverage Status

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

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.

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Jul 24, 2017

Member

Awesome!

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

Thanks!

Member

zixia commented Jul 24, 2017

Awesome!

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

Thanks!

@zixia zixia merged commit bd6da54 into Chatie:master Jul 24, 2017

3 of 7 checks passed

ci/circleci Your tests failed on CircleCI
Details
codacy/pr Not so good... This pull request quality could be better.
Details
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
codeclimate All good!
Details
coverage/coveralls Coverage remained the same at 54.62%
Details
security/snyk No new vulnerabilities
Details
@hczhcz

This comment has been minimized.

Show comment
Hide comment
@hczhcz

hczhcz Jul 24, 2017

Member

@zixia Got it. I have updated the Wiki.

Member

hczhcz commented Jul 24, 2017

@zixia Got it. I have updated the Wiki.

@zixia

This comment has been minimized.

Show comment
Hide comment
@zixia

zixia Jul 24, 2017

Member

Great!

Member

zixia commented Jul 24, 2017

Great!

@suntong

This comment has been minimized.

Show comment
Hide comment
@suntong

suntong Mar 6, 2018

Contributor

@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!

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

This comment has been minimized.

Show comment
Hide comment
@suntong

suntong Mar 6, 2018

Contributor

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!

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

This comment has been minimized.

Show comment
Hide comment
@hczhcz

hczhcz Mar 6, 2018

Member

@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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@suntong

suntong Mar 6, 2018

Contributor

Oh, thanks A LOT @hczhcz !!

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