use reaction to communicate thinking state
This commit is contained in:
1 parent
29040d6dfc
commit
2a39686d43
1 file changed
+8
-2
+8
-2
@@ -76,7 +76,8 @@ async def on_message(message):
|
|||||||
await message.channel.send('What can I do for you?', reference=message)
|
await message.channel.send('What can I do for you?', reference=message)
|
||||||
return
|
return
|
||||||
|
|
||||||
response = await message.reply(':thinking:')
|
await message.add_reaction('🤔')
|
||||||
|
response = None
|
||||||
|
|
||||||
# TODO: discord has a 2000 character limit, so we need to split the response
|
# TODO: discord has a 2000 character limit, so we need to split the response
|
||||||
buffer = ''
|
buffer = ''
|
||||||
@@ -92,7 +93,12 @@ async def on_message(message):
|
|||||||
if len(buffer) >= args.buffer_size:
|
if len(buffer) >= args.buffer_size:
|
||||||
# buffer the edit so as to not call Discord API too often
|
# buffer the edit so as to not call Discord API too often
|
||||||
response_content += buffer
|
response_content += buffer
|
||||||
await response.edit(content=response_content + '...')
|
|
||||||
|
if response:
|
||||||
|
await response.edit(content=response_content + '...')
|
||||||
|
else:
|
||||||
|
response = await message.reply(response_content)
|
||||||
|
await message.remove_reaction('🤔', client.user)
|
||||||
|
|
||||||
buffer = ''
|
buffer = ''
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user