-
Notifications
You must be signed in to change notification settings - Fork 335
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
Cross platform issue: replyImage and sendImage #264
Comments
Hi @tigercosmos , For the stable release ( if (context.platform === 'messenger') {
// messenger code
} In the beta version ( const bot = new LineBot({
sendMethod: 'reply', // or 'push'
shouldBatch: true,
...otherConfig
}); Then you can call send methods like Furthermore, with the // or you can use sendText() if you set sendMethod to 'reply'
await context.replyText('aaa');
await context.replyText('bbb');
// will call Reply API only once with array of 2 messages The beta features are not documented yet, but you can see the PRs here: |
I have another question about how to const bot = (process.env.chatbotPlatform == 'messenger') ? new MessengerBot() : new LineBot(); I am worried about there is a smarter way. |
Hi @tigercosmos , It's OK to construct different type of Bot with environment variables. In fact, we are currently using something like const bot =
process.env.USE_CONSOLE_BOT === 'true'
? new ConsoleBot({
fallbackMethods: true,
})
: new MessengerBot({ /* messengerConfig */ }); when developing our own projects. |
This question has been well-answered, so I am going to close this issue. By the way, |
Considering a condition:
A bot for two platform: a free account Line bot and a Messenger bot.
If I want to reply an image for a message. For Line, I would call
replyImage
(because I use free account), but there's noreplyImage
for Messenger, so I would need to callsendImage
. But I cannot callsendImage
directly, because I use free account for Line.A simple way to solve this, I write a tricky code for this:
I think it can be a feature for later version to solve this kind problem.(so as
sendText
)The text was updated successfully, but these errors were encountered: