Manishx commited on
Commit
d30be39
1 Parent(s): 5bbc5fd
main.py CHANGED
@@ -1,4 +1,10 @@
1
  import asyncio
 
 
 
 
 
 
2
 
3
  # uvloop is optional, but it's recommended to install it for better performance of pyrogram
4
  try:
@@ -7,15 +13,45 @@ except:
7
  print("uvloop is not installed")
8
 
9
  from pyrogram import Client
10
- from config import API_ID, API_HASH, BOT_TOKEN
11
- from utils import keep_alive
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  if __name__ == '__main__':
14
 
15
- # If you are deploying on Replit, you can use this code to keep your bot alive
16
- if 'y' in input('Are you deploying on Replit? (y/n): ').lower():
17
- from config import REPL_URL
18
- keep_alive.awake(REPL_URL, False)
19
 
20
  # Setting up uvloop
21
  try:
 
1
  import asyncio
2
+ from flask import Flask
3
+ from threading import Thread
4
+ import random
5
+ import time
6
+ import requests
7
+ import logging
8
 
9
  # uvloop is optional, but it's recommended to install it for better performance of pyrogram
10
  try:
 
13
  print("uvloop is not installed")
14
 
15
  from pyrogram import Client
16
+ from config import API_ID, API_HASH, BOT_TOKEN, REPL_URL
17
+
18
+ app = Flask("")
19
+
20
+ @app.route("/")
21
+ def home():
22
+ return "You have found the home of a Python program!"
23
+
24
+ def run():
25
+ app.run()
26
+
27
+ # def ping(target, debug):
28
+ # while True:
29
+ # r = requests.get(target)
30
+ # if debug == True:
31
+ # print("Status Code: " + str(r.status_code))
32
+ # time.sleep(random.randint(
33
+ # 180, 300)) # alternate ping time between 3 and 5 minutes
34
+
35
+ # def awake(target, debug=False):
36
+ # log = logging.getLogger("werkzeug")
37
+ # log.disabled = True
38
+ # app.logger.disabled = True
39
+ # t = Thread(target=run)
40
+ # r = Thread(
41
+ # target=ping,
42
+ # args=(
43
+ # target,
44
+ # debug,
45
+ # ),
46
+ # )
47
+ # t.start()
48
+ # r.start()
49
 
50
  if __name__ == '__main__':
51
 
52
+ # # If you are deploying on Replit, you can use this code to keep your bot alive
53
+ # if 'y' in input('Are you deploying on Replit? (y/n): ').lower():
54
+ # awake(REPL_URL, False)
 
55
 
56
  # Setting up uvloop
57
  try:
utils/__pycache__/keep_alive.cpython-311.pyc DELETED
Binary file (1.98 kB)
 
utils/__pycache__/keep_alive.cpython-312.pyc DELETED
Binary file (1.71 kB)
 
utils/keep_alive.py DELETED
@@ -1,42 +0,0 @@
1
- from flask import Flask
2
- from threading import Thread
3
- import random
4
- import time
5
- import requests
6
- import logging
7
-
8
- app = Flask("")
9
-
10
-
11
- @app.route("/")
12
- def home():
13
- return "You have found the home of a Python program!"
14
-
15
-
16
- def run():
17
- app.run()
18
-
19
-
20
- def ping(target, debug):
21
- while True:
22
- r = requests.get(target)
23
- if debug == True:
24
- print("Status Code: " + str(r.status_code))
25
- time.sleep(random.randint(
26
- 180, 300)) # alternate ping time between 3 and 5 minutes
27
-
28
-
29
- def awake(target, debug=False):
30
- log = logging.getLogger("werkzeug")
31
- log.disabled = True
32
- app.logger.disabled = True
33
- t = Thread(target=run)
34
- r = Thread(
35
- target=ping,
36
- args=(
37
- target,
38
- debug,
39
- ),
40
- )
41
- t.start()
42
- r.start()