Either find a way to integrate furhat and other systems to the aiogram handlers currently in use, or write from scratch a similar system.
The lamest, untested, not yet improved idea:
async def iterations_startswith(bot):
## Should return the text which the sentence should start with to trigger, and the callback to be awaited
return database_iterations_startswith(bot)
async def handling_startswith(bot, sentence):
for iteration in await iterations_startswith(bot):
if sentence.startswith(iteration.text):
return iteration.callback
return None
async def iterations_contains(bot):
## Should return the text which the sentence should start with to trigger, and the callback to be awaited
return database_iterations_contains(bot)
async def handling_contains(bot, sentence):
for iteration in await iterations_contains(bot):
## This is the Python implementation for string.contains()
if iteration.text in sentence:
return iteration.callback
return None
## This argument is a aiogram.Message
async def universal_handler(message):
for dispatcher in dispatchers:
## We will only check full message if it doesn't starts with something pre defined
callback = await handling_startswith(message.text)
if callback is None:
callback = await handling_contains(message.text)
if callback is not None:
await callback()
This approach uses the same mindset of the aiogram handlers in the sense that first match determines what callback will handle the given command. To change behavior for multiple triggers, the handling_ methods should return a list of callbacks instead of just one.
Either find a way to integrate furhat and other systems to the aiogram handlers currently in use, or write from scratch a similar system.
The lamest, untested, not yet improved idea:
This approach uses the same mindset of the aiogram handlers in the sense that first match determines what callback will handle the given command. To change behavior for multiple triggers, the handling_ methods should return a list of callbacks instead of just one.