opensearch-project/demos
[FEATURE][DocBot] discord should create a conversation for each channel in discord
Offen
#80 geöffnet am 01.11.2023
OSCIenhancementgood first issuehelp wanted
Repository-Metriken
- Stars
- (4 Sterne)
- PR-Merge-Metriken
- (PR-Metriken ausstehend)
Beschreibung
Is your feature request related to a problem?
Right now when the discord bot is spun up it functionally does nothing. We need a conversations mechanism to track the conversations that are happening with our bot.
What solution would you like?
When the discord bot spins up it should do the following
- Check local state to see if there is a conversation for that channel already
- If none is found in state it should check OpenSearch for an existing conversation from that channel
- If there isn't already a conversation one should be created
After the conversation_id is found or created it should be tracked locally and used whenever new messages arrive on a channel.
Do you have any additional context?
class DocBot():
def __init__ (self):
self.conversations: {}
def handle_message(message_object):
# get conversation id form _conversation handler
# with conversation id call docbot.generate response(conversation_id, message)
# return response
def _conversation_handler(self, conversation_name):
# check if conversation in state
# check if conversation exists. If it exists track conversation id in self.conversations by name: id
# if conversation doesn't exists create and then track using the above method
# return id