✨ 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,9 +160,20 @@ 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:
|
||||||
|
if forward_allowed:
|
||||||
|
await reply.forward_to(reply.peer_id)
|
||||||
|
else:
|
||||||
|
await bot.send_message(reply.peer_id, reply)
|
||||||
|
except MessageIdInvalidError:
|
||||||
|
if forward_allowed:
|
||||||
|
forward_allowed = False
|
||||||
|
await bot.send_message(reply.peer_id, reply)
|
||||||
|
else:
|
||||||
|
await context.respond(lang('re_forbidden'))
|
||||||
|
return
|
||||||
except ForbiddenError:
|
except ForbiddenError:
|
||||||
return
|
return
|
||||||
except FloodWaitError:
|
except FloodWaitError:
|
||||||
|
Loading…
Reference in New Issue
Block a user