-
Notifications
You must be signed in to change notification settings - Fork 0
/
logsConsole.py
63 lines (51 loc) · 2.18 KB
/
logsConsole.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
51
52
53
54
55
56
57
58
59
60
61
62
63
# back end to control the bot
class console:
def __init__(self,logs) -> None:
# flag 0, is 0ff 1 is on
self.flg = 1
self.logs = logs
def Consolecmd(self):
self.flg = 0
inpt = input('disc_console>')
if inpt:
if inpt[0] == '+':
self.logs.white_list(inpt[2:])
return
elif inpt[0] == '-':
self.logs.ban(inpt[2:])
return
elif inpt.startswith("api"):
#
cmd = inpt[4:]
if (cmd == 'on') or (cmd == 'off'):
status = self.logs.api_access(cmd)
print(status)
return
elif cmd.startswith("lockdown") or cmd == "-ld":
self.logs.cmdLockout = True
print(f'console level lockout on bot function {self.logs.cmdLockout}')
return
elif cmd.startswith("release") or cmd == "-r":
self.logs.cmdLockout = False
print(f'console level lockout on bot function {self.logs.cmdLockout}')
return
elif inpt.startswith('encrypt'):
currFlag = self.logs.DBsec.isEncrypted
if not currFlag:
self.logs.DBsec.encryptWhitelist()
return
else:
print(f'logs could not encrypt \nDBsec.isEncrypted: {currFlag}')
elif inpt.startswith('decrypt'):
currFlag = self.logs.DBsec.isEncrypted
if currFlag:
self.logs.DBsec.decryptWhitelist()
print('MUST BE ENCRYPTED TO RUN BOT!!!! PLEASE DO "api -ld" to prevent crash')
return
else:
print(f'logs could not decrypt \nDBsec.isEncrypted: {currFlag}')
def main(self):
while True:
if self.flg == 0:
self.flg = 1
self.Consolecmd()