🐛 Fix some bugs (mock,re,selfprune) (#116)
🐛 修复 mock, re, selfprune 运行错误。
This commit is contained in:
parent
bf9ea775c3
commit
177823f46e
@ -74,13 +74,16 @@ async def mock(context):
|
|||||||
reply = await context.get_reply_message()
|
reply = await context.get_reply_message()
|
||||||
await context.edit(result)
|
await context.edit(result)
|
||||||
if reply:
|
if reply:
|
||||||
if reply.sender.is_self:
|
try:
|
||||||
try:
|
if reply.sender.is_self:
|
||||||
await reply.edit(result)
|
try:
|
||||||
except MessageNotModifiedError:
|
await reply.edit(result)
|
||||||
await context.edit("A rare event of two mocking messages being the same just occurred.")
|
except MessageNotModifiedError:
|
||||||
return
|
await context.edit("A rare event of two mocking messages being the same just occurred.")
|
||||||
await context.delete()
|
return
|
||||||
|
await context.delete()
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@listener(is_plugin=False, outgoing=True, command=alias_command("widen"),
|
@listener(is_plugin=False, outgoing=True, command=alias_command("widen"),
|
||||||
|
@ -147,7 +147,10 @@ async def re(context):
|
|||||||
except:
|
except:
|
||||||
await context.edit(lang('re_arg_error'))
|
await context.edit(lang('re_arg_error'))
|
||||||
return True
|
return True
|
||||||
await context.delete()
|
try:
|
||||||
|
await context.delete()
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
try:
|
try:
|
||||||
for nums in range(0, num):
|
for nums in range(0, num):
|
||||||
await reply.forward_to(int(context.chat_id))
|
await reply.forward_to(int(context.chat_id))
|
||||||
|
@ -81,7 +81,10 @@ async def selfprune(context):
|
|||||||
if msgs:
|
if msgs:
|
||||||
await context.client.delete_messages(context.chat_id, 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')}")
|
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 sleep(1)
|
||||||
await notification.delete()
|
await notification.delete()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user