-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresponses.py
More file actions
31 lines (24 loc) · 1008 Bytes
/
responses.py
File metadata and controls
31 lines (24 loc) · 1008 Bytes
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
import config
import setup
hubs = setup.hub
def get_response(message):
# Convert the message to lowercase
p_message = message.lower()
# Check if the message is in the list of server names
server_names = [x[3] for x in hubs]
if p_message in server_names:
index = server_names.index(p_message)
return f'```{config.ser(index)}```'
# Check if the message is in the list of client names
client_names = [x[4] for x in hubs]
if p_message in client_names:
index = client_names.index(p_message)
return f'```{config.client(index)}```'
# Check if the message is the command to respond with all servers
if p_message == setup.all_server:
return f'```{config.all_server()}```'
# Check if the message is the command to respond with all client
if p_message == setup.all_client:
return f'```{config.all_client()}```'
# Return None if no conditions are met
return