✨ Fix repeat command forward error (#154)
This commit is contained in:
parent
7a01d3a0d0
commit
b5428ea0f0
@ -3,7 +3,7 @@
|
|||||||
from telethon.tl.functions.messages import DeleteChatUserRequest
|
from telethon.tl.functions.messages import DeleteChatUserRequest
|
||||||
from telethon.tl.functions.channels import LeaveChannelRequest
|
from telethon.tl.functions.channels import LeaveChannelRequest
|
||||||
from telethon.errors import ForbiddenError, AuthKeyError
|
from telethon.errors import ForbiddenError, AuthKeyError
|
||||||
from telethon.errors.rpcerrorlist import ChatIdInvalidError, FloodWaitError, UserNotParticipantError
|
from telethon.errors.rpcerrorlist import ChatIdInvalidError, FloodWaitError, UserNotParticipantError, MessageIdInvalidError
|
||||||
from distutils.util import strtobool
|
from distutils.util import strtobool
|
||||||
|
|
||||||
from telethon.tl.types import ChannelForbidden
|
from telethon.tl.types import ChannelForbidden
|
||||||
@ -160,18 +160,29 @@ async def re(context):
|
|||||||
await context.delete()
|
await context.delete()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
try:
|
forward_allowed = True
|
||||||
for nums in range(0, num):
|
for nums in range(0, num):
|
||||||
await reply.forward_to(int(context.chat_id))
|
try:
|
||||||
except ForbiddenError:
|
if forward_allowed:
|
||||||
return
|
await reply.forward_to(reply.peer_id)
|
||||||
except FloodWaitError:
|
else:
|
||||||
return
|
await bot.send_message(reply.peer_id, reply)
|
||||||
except ValueError:
|
except MessageIdInvalidError:
|
||||||
return
|
if forward_allowed:
|
||||||
except AuthKeyError:
|
forward_allowed = False
|
||||||
await context.respond(lang('re_forbidden'))
|
await bot.send_message(reply.peer_id, reply)
|
||||||
return
|
else:
|
||||||
|
await context.respond(lang('re_forbidden'))
|
||||||
|
return
|
||||||
|
except ForbiddenError:
|
||||||
|
return
|
||||||
|
except FloodWaitError:
|
||||||
|
return
|
||||||
|
except ValueError:
|
||||||
|
return
|
||||||
|
except AuthKeyError:
|
||||||
|
await context.respond(lang('re_forbidden'))
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
await context.edit(lang('not_reply'))
|
await context.edit(lang('not_reply'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user