Amazebot / bbot

An adaptable conversation engine for building bespoke bots.
MIT License
55 stars 2 forks source link

How can i unsubscribe? #111

Closed MarcosEllys closed 4 years ago

MarcosEllys commented 5 years ago

Hi @timkinnane, first congratulations about Bbot, it's amazing and easily to use, but, i have one question, when a forward one chat on livechat i keep getting events, do you know how can cancel the subscription and stop stream messages for my bot?

timkinnane commented 5 years ago

@MarcosEllys that is an excellent question. I haven't had that requirement yet, so there's no high level method to control per-room subscriptions. Assuming you mean Rocket.Chat Livechat, the subscription receives all messages from all rooms the bot has joined. What you can do is use the Rocket.Chat SDK driver exposed within the bot adapter to manually call a server method to leave the room with the bot.

I think it would be something like: bot.adapters.message.driver.callMethod('leaveRoom', rid)

I've got a new release of bBot ready to go, just missing docs and the time to write them currently. This new release uses an entirely new library to connect to Rocket.Chat, that offers better control for this kind of stuff and I'm making examples specifically for Livechat, because that seems very popular. I'll try and include something to address your need, if you can describe the requirement further. I'm assuming you're doing first response via bot then hand-off to a live agent and you need the bot to go away?