Thaimozhi commited on
Commit
4743369
·
1 Parent(s): 84b1741

channel feature and keep audio track

Browse files
Files changed (1) hide show
  1. bot.py +12 -1
bot.py CHANGED
@@ -5,6 +5,7 @@ import aiohttp
5
  import asyncio
6
  import warnings
7
  import pytz
 
8
 
9
  try:
10
  req = urllib.request.urlopen("https://google.com", timeout=3)
@@ -41,15 +42,25 @@ else:
41
  class Bot(Client):
42
 
43
  def __init__(self):
 
 
 
 
 
 
 
 
 
 
44
  super().__init__(
45
  name="codeflixbots",
46
  api_id=Config.API_ID,
47
  api_hash=Config.API_HASH,
48
  bot_token=Config.BOT_TOKEN,
49
  workers=20,
50
- max_concurrent_transmissions=4,
51
  plugins={"root": "plugins"},
52
  sleep_threshold=15,
 
53
  )
54
  self.start_time = time.time()
55
 
 
5
  import asyncio
6
  import warnings
7
  import pytz
8
+ import inspect
9
 
10
  try:
11
  req = urllib.request.urlopen("https://google.com", timeout=3)
 
42
  class Bot(Client):
43
 
44
  def __init__(self):
45
+ # max_concurrent_transmissions exists in newer Pyrogram builds but is
46
+ # missing from some deployed/forked versions. Keep startup compatible.
47
+ try:
48
+ transmission_options = (
49
+ {"max_concurrent_transmissions": 4}
50
+ if "max_concurrent_transmissions" in inspect.signature(Client.__init__).parameters
51
+ else {}
52
+ )
53
+ except (TypeError, ValueError):
54
+ transmission_options = {}
55
  super().__init__(
56
  name="codeflixbots",
57
  api_id=Config.API_ID,
58
  api_hash=Config.API_HASH,
59
  bot_token=Config.BOT_TOKEN,
60
  workers=20,
 
61
  plugins={"root": "plugins"},
62
  sleep_threshold=15,
63
+ **transmission_options,
64
  )
65
  self.start_time = time.time()
66