-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
50 lines (39 loc) · 1.68 KB
/
bot.py
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
41
42
43
44
45
46
47
48
49
50
from selenium.webdriver.common.keys import Keys
import time
import settings
import Classes.login as login
import Classes.utils as utils
import Classes.CheckClass as check
from Classes.polls import do_polls
from termcolor import colored
print(colored('Welcome to CodeTantra Bot', 'green'))
print(colored('Maintained by crypticani, originally developed by iron-war ', 'green'))
def main():
have_class = False
while True:
JOINED_TIME = time.strftime("%H:%M:%S",time.localtime())
print("current time: ", JOINED_TIME)
login.open()
hr = check.get_time()
if int(hr) >= 20:
print(colored('[-] No classes are scheduled after 8 pm', 'cyan', attrs=['reverse', 'blink']))
utils.abort()
have_class = check.check_for_class(hr)
if have_class and login.join():
print(colored("[+] Joined the Class", 'green'))
JOINED_TIME = time.strftime("%H:%M:%S",time.localtime())
print("current time: ", JOINED_TIME)
do_polls()
settings.driver.refresh()
# settings.driver.close()
print(colored("[+] Wait for 30 Seconds.", 'blue'))
time.sleep(30)
print(colored('[+] Refreshing Daemon For other classes', 'cyan'))
login.join_again()
else:
print(colored("[+] No ongoing lectures found at", 'blue'), colored(check.ryt_now(), 'blue'))
print(colored('[+] Sleeping for', 'blue'), colored('30', 'blue'), colored('seconds', 'blue'))
time.sleep(30)
settings.driver.refresh()
if __name__ == "__main__":
main()