-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (33 loc) · 1.15 KB
/
main.py
File metadata and controls
40 lines (33 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import customtkinter as ctk
from utils import load_config
from net import validate_token
from ui.login import LoginWindow
from ui.builder import BotBuilderApp
ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("blue")
class MainApp(ctk.CTk):
def __init__(self):
super().__init__()
self.title("VreD 4.1")
self.geometry("820x400")
self.config = load_config()
print("VreD 4.1 | Loading modules.")
self.valid_token = None
api_keys = self.config.get("api_keys", [])
for key in api_keys:
if validate_token(key):
self.valid_token = key
break
if not self.valid_token:
self.withdraw()
LoginWindow(self, self.start_builder)
else:
print(f"Found valid telegram bot apikey: {self.valid_token[:6]}... Logging in.")
self.start_builder()
def start_builder(self):
self.deiconify()
app = BotBuilderApp(self)
app.pack(fill="both", expand=True)
print("Starting GUI Module..")
if __name__ == "__main__":
MainApp().mainloop()