Ufoptg commited on
Commit
c58d191
1 Parent(s): b5df798

Update Hellbot/__main__.py

Browse files
Files changed (1) hide show
  1. Hellbot/__main__.py +54 -33
Hellbot/__main__.py CHANGED
@@ -1,33 +1,54 @@
1
- from pyrogram import idle
2
-
3
- from Hellbot import __version__
4
- from Hellbot.core import (
5
- Config,
6
- ForcesubSetup,
7
- GachaBotsSetup,
8
- TemplateSetup,
9
- UserSetup,
10
- db,
11
- hellbot,
12
- )
13
- from Hellbot.functions.tools import initialize_git
14
- from Hellbot.functions.utility import BList, Flood, TGraph
15
-
16
-
17
- async def main():
18
- await hellbot.startup()
19
- await db.connect()
20
- await UserSetup()
21
- await ForcesubSetup()
22
- await GachaBotsSetup()
23
- await TemplateSetup()
24
- await Flood.updateFromDB()
25
- await BList.updateBlacklists()
26
- await TGraph.setup()
27
- await initialize_git(Config.PLUGINS_REPO)
28
- await hellbot.start_message(__version__)
29
- await idle()
30
-
31
-
32
- if __name__ == "__main__":
33
- hellbot.run(main())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pyrogram import idle
2
+ import dns.resolver
3
+ import socket
4
+
5
+ from Hellbot import __version__
6
+ from Hellbot.core import (
7
+ Config,
8
+ ForcesubSetup,
9
+ GachaBotsSetup,
10
+ TemplateSetup,
11
+ UserSetup,
12
+ db,
13
+ hellbot,
14
+ )
15
+ from Hellbot.functions.tools import initialize_git
16
+ from Hellbot.functions.utility import BList, Flood, TGraph
17
+
18
+ def custom_resolver(hostname):
19
+ resolver = dns.resolver.Resolver()
20
+ resolver.nameservers = ["8.8.8.8", "8.8.4.4"] # Using Google's DNS servers
21
+ answers = resolver.resolve(hostname, "A")
22
+ return answers[0].address
23
+
24
+
25
+ original_getaddrinfo = socket.getaddrinfo
26
+
27
+
28
+ def custom_getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
29
+ try:
30
+ ip = custom_resolver(host)
31
+ return [(socket.AF_INET, socket.SOCK_STREAM, proto, "", (ip, port))]
32
+ except Exception as e:
33
+ return original_getaddrinfo(host, port, family, type, proto, flags)
34
+
35
+
36
+ socket.getaddrinfo = custom_getaddrinfo
37
+
38
+ async def main():
39
+ await hellbot.startup()
40
+ await db.connect()
41
+ await UserSetup()
42
+ await ForcesubSetup()
43
+ await GachaBotsSetup()
44
+ await TemplateSetup()
45
+ await Flood.updateFromDB()
46
+ await BList.updateBlacklists()
47
+ await TGraph.setup()
48
+ await initialize_git(Config.PLUGINS_REPO)
49
+ await hellbot.start_message(__version__)
50
+ await idle()
51
+
52
+
53
+ if __name__ == "__main__":
54
+ hellbot.run(main())