Add reaction on message edit.

This commit is contained in:
OK 2024-03-17 13:46:37 +01:00
parent 1bff1c9719
commit 29b0d6efca
3 changed files with 7 additions and 2 deletions

View File

@ -298,8 +298,8 @@ class AIResponder(AIResponderBase):
async def memoize_reaction(self, message_user: str, reaction_user: str, operation: str, reaction: str, message: str) -> None: async def memoize_reaction(self, message_user: str, reaction_user: str, operation: str, reaction: str, message: str) -> None:
quoted_message = message.replace('\n', '\n> ') quoted_message = message.replace('\n', '\n> ')
await self.memoize(message_user, reaction_user, await self.memoize(message_user, 'assistant',
f'> {quoted_message}', f'\n> {quoted_message}',
f'User {reaction_user} has {operation} this raction: {reaction}') f'User {reaction_user} has {operation} this raction: {reaction}')
async def send(self, message: AIMessage) -> AIResponse: async def send(self, message: AIMessage) -> AIResponse:

View File

@ -125,6 +125,11 @@ class FjerkroaBot(commands.Bot):
async def on_reaction_clear(self, reaction, user): async def on_reaction_clear(self, reaction, user):
await self.on_reaction_operation(reaction, user, 'clearing') await self.on_reaction_operation(reaction, user, 'clearing')
async def on_message_edit(self, before, after):
await self.memoize(before.author.name, 'assistant',
'\n> ' + before.content.replace('\n', '\n> '),
'User changed this message to:\n> ' + after.content.replace('\n', '\n> '))
def on_config_file_modified(self, event): def on_config_file_modified(self, event):
if event.src_path == self.config_file: if event.src_path == self.config_file:
new_config = self.load_config(self.config_file) new_config = self.load_config(self.config_file)

Binary file not shown.