uezo / minette-symphony

Adapter for Symphony to create chatbot using Minette framework.
MIT License
1 stars 0 forks source link

Sending to an additional token/Symphony streamId chatroom #1

Closed forkandspoon closed 4 years ago

forkandspoon commented 4 years ago

Hello (Uezo)

This is not an issue but rather just inquiring for suggestions, The adapter and minette-python is a really useful chatbot library.

I am trying to develop a Symphony bot that receives a message in one chat room, but I would like to post the result in another chat room or IM (streamId) For example User1 stream1> request message Minette stream1> response message Minette to another stream2> response message >> stream2 streamId would be hard coded in the chatbot settings

I have read through the code and it seems best to edit base.py in minette-python or _extract_token in the adapter to take in an additional value, but I am not too sure. I was wondering if there was any preferred way or method to do this?

Thank you!

uezo commented 4 years ago

Hi Jian,

To send message to another chatroom/IM, no changes to framework or adapter are needed I think. The easiest way is sending message to another streamId in your DialogService like below. (I'm sorry but it's not tested)

# bot_client is the instance of SymBotClient. Get instance from adapter or create new one.
# stream_id is the one of another channel, msg should be formatted for Symphony
bot_client.get_message_client().send_msg(stream_id, msg)

Note that in this way the sequence is not same as the one you showed me.

forkandspoon commented 4 years ago

Great- thank you, is the sequence does not matter. I used a decorator to use the same instantiated adapter, like you said, which seems to have worked as intended. If there is a better way please let me know.