Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 870dd0f

Browse files
authored
change sleep value due to new pyro
* Change sleep value due to new pyro * Adding more anti floodwait
1 parent 661389a commit 870dd0f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎plugins/channel_post.py‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async def channel_post(client: Client, message: Message):
1515
try:
1616
post_message = await message.copy(chat_id = client.db_channel.id, disable_notification=True)
1717
except FloodWait as e:
18-
await asyncio.sleep(e.x)
18+
await asyncio.sleep(e.value)
1919
post_message = await message.copy(chat_id = client.db_channel.id, disable_notification=True)
2020
except Exception as e:
2121
print(e)
@@ -31,7 +31,13 @@ async def channel_post(client: Client, message: Message):
3131
await reply_text.edit(f"<b>Here is your link</b>\n\n{link}", reply_markup=reply_markup, disable_web_page_preview = True)
3232

3333
if not DISABLE_CHANNEL_BUTTON:
34-
await post_message.edit_reply_markup(reply_markup)
34+
try:
35+
await post_message.edit_reply_markup(reply_markup)
36+
except FloodWait as e:
37+
await asyncio.sleep(e.value)
38+
await post_message.edit_reply_markup(reply_markup)
39+
except Exception:
40+
pass
3541

3642
@Bot.on_message(filters.channel & filters.incoming & filters.chat(CHANNEL_ID))
3743
async def new_post(client: Client, message: Message):
@@ -46,6 +52,8 @@ async def new_post(client: Client, message: Message):
4652
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("🔁 Share URL", url=f'https://telegram.me/share/url?url={link}')]])
4753
try:
4854
await message.edit_reply_markup(reply_markup)
49-
except Exception as e:
50-
print(e)
55+
except FloodWait as e:
56+
await asyncio.sleep(e.value)
57+
await message.edit_reply_markup(reply_markup)
58+
except Exception:
5159
pass

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /