🐛 Fix some bugs (mock,re,selfprune) (#116)

🐛 修复 mock, re, selfprune 运行错误。
This commit is contained in:
Xtao_dada 2021-08-16 22:34:37 +08:00 committed by GitHub
parent bf9ea775c3
commit 177823f46e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 9 deletions

View File

@ -74,13 +74,16 @@ async def mock(context):
reply = await context.get_reply_message()
await context.edit(result)
if reply:
if reply.sender.is_self:
try:
await reply.edit(result)
except MessageNotModifiedError:
await context.edit("A rare event of two mocking messages being the same just occurred.")
return
await context.delete()
try:
if reply.sender.is_self:
try:
await reply.edit(result)
except MessageNotModifiedError:
await context.edit("A rare event of two mocking messages being the same just occurred.")
return
await context.delete()
except AttributeError:
pass
@listener(is_plugin=False, outgoing=True, command=alias_command("widen"),

View File

@ -147,7 +147,10 @@ async def re(context):
except:
await context.edit(lang('re_arg_error'))
return True
await context.delete()
try:
await context.delete()
except ValueError:
pass
try:
for nums in range(0, num):
await reply.forward_to(int(context.chat_id))

View File

@ -81,7 +81,10 @@ async def selfprune(context):
if msgs:
await context.client.delete_messages(context.chat_id, msgs)
await log(f"{lang('prune_hint1')}{lang('sp_hint')} {str(count_buffer)} / {str(count)} {lang('prune_hint2')}")
notification = await send_prune_notify(context, count_buffer, count)
try:
notification = await send_prune_notify(context, count_buffer, count)
except ValueError:
pass
await sleep(1)
await notification.delete()