Skip to content

Commit

Permalink
Handle Floodwait
Browse files Browse the repository at this point in the history
Signed-off-by: AsmSafone <[email protected]>
  • Loading branch information
AsmSafone authored Sep 2, 2021
1 parent 71ca405 commit 36d5d14
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from pyrogram.raw.types import InputGroupCall
from pyrogram.raw.functions.phone import EditGroupCallTitle, CreateGroupCall
from random import randint
from pyrogram.errors import FloodWait


bot = Client(
Expand Down Expand Up @@ -204,7 +205,7 @@ async def start_radio(self):
# credits: https://t.me/c/1480232458/6825
os.mkfifo(f'radio-{CHAT}.raw')
group_call.input_filename = f'radio-{CHAT}.raw'
if not CALL_STATUS.get(CHAT):
if not group_call.is_connected:
await self.start_call()
ffmpeg_log = open("ffmpeg.log", "w+")
command=["ffmpeg", "-y", "-i", station_stream_url, "-f", "s16le", "-ac", "2",
Expand Down Expand Up @@ -262,6 +263,10 @@ async def start_call(self):
group_call = self.group_call
try:
await group_call.start(CHAT)
except FloodWait as e:
await sleep(e.x)
if not group_call.is_connected:
await group_call.start(CHAT)
except GroupCallNotFoundError:
try:
await USER.send(CreateGroupCall(
Expand Down

0 comments on commit 36d5d14

Please sign in to comment.