Skip to content

Commit 36d5d14

Browse files
authored
Handle Floodwait
Signed-off-by: AsmSafone <asmsafone@gmail.com>
1 parent 71ca405 commit 36d5d14

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from pyrogram.raw.types import InputGroupCall
4242
from pyrogram.raw.functions.phone import EditGroupCallTitle, CreateGroupCall
4343
from random import randint
44+
from pyrogram.errors import FloodWait
4445

4546

4647
bot = Client(
@@ -204,7 +205,7 @@ async def start_radio(self):
204205
# credits: https://t.me/c/1480232458/6825
205206
os.mkfifo(f'radio-{CHAT}.raw')
206207
group_call.input_filename = f'radio-{CHAT}.raw'
207-
if not CALL_STATUS.get(CHAT):
208+
if not group_call.is_connected:
208209
await self.start_call()
209210
ffmpeg_log = open("ffmpeg.log", "w+")
210211
command=["ffmpeg", "-y", "-i", station_stream_url, "-f", "s16le", "-ac", "2",
@@ -262,6 +263,10 @@ async def start_call(self):
262263
group_call = self.group_call
263264
try:
264265
await group_call.start(CHAT)
266+
except FloodWait as e:
267+
await sleep(e.x)
268+
if not group_call.is_connected:
269+
await group_call.start(CHAT)
265270
except GroupCallNotFoundError:
266271
try:
267272
await USER.send(CreateGroupCall(

0 commit comments

Comments
 (0)