-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
92 lines (78 loc) · 2.95 KB
/
main.py
File metadata and controls
92 lines (78 loc) · 2.95 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import os
import traceback
from tabulate import tabulate
from pick import pick
from dotenv import load_dotenv
from colorama import Fore, init
from modules.cli.menu import menu
from modules.utils import wait
from modules.cli.cli_forms import choose_action
from modules.get_requests import Requests
from modules.operations import (
user_guilds,
user_friends,
guild_channels,
user_dm_channels,
user_account_data,
specific_channel_messages
)
init()
load_dotenv()
AUTH_TOKEN = os.getenv('AUTH_TOKEN')
req = Requests(AUTH_TOKEN)
def main():
menu()
while True:
user_input = input("Please choose one of the actions given above: ")
match user_input:
case "1":
selected_action = choose_action()
match selected_action:
case 0:
user_account_data(req)
case 1:
user_friends(req)
case 2:
user_dm_channels(req)
case 3:
user_guilds(req)
case 4:
channel_id = input("channel id: ")
specific_channel_messages(channel_id, req)
case 5:
title = "select a channel"
options = list()
channels = list()
for channel in req.get_dm_channels():
if not channel['recipients'][0]['username'].isascii():
continue
options.append(
f"{channel['recipients'][0]['username']}#{channel['recipients'][0]['discriminator']}"
)
channels.append(
f"{channel['id']}"
)
option, index = pick(options, title)
specific_channel_messages(channels[index], req)
case 6:
channels = guild_channels(req, input("Please enter a guild id: "))
for i in channels:
print(f"{i} channels\n=====================")
print(tabulate(channels[i], headers = 'keys') + "\n\n")
case _:
pass
print("Press any key to continue")
wait()
case "2":
print("info text")
case _:
print("Please choose a valid operation")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print(Fore.GREEN + "\nExit the program")
except Exception as error:
traceback.print_exc()
print(Fore.RED + str(error))
print("the program has been stopped" + Fore.RESET)