-
Notifications
You must be signed in to change notification settings - Fork 27
/
ws_wrapper.py
49 lines (40 loc) · 1.07 KB
/
ws_wrapper.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
import json
import global_var
def get_guild_bot_id():
global_var.ws.send(json.dumps({
"action": "get_guild_service_profile",
"params": {},
"echo": {
"type": "guild_bot_id"
}
}))
def send_message_to_group(message_source, message, group_id):
global_var.ws.send(json.dumps({
"action": "send_group_msg",
"params": {
"group_id": str(group_id),
"message": message
},
"echo": {
"message_source": message_source
}
}))
def send_message_to_channel(message_source, message, guild_id, channel_id):
global_var.ws.send(json.dumps({
"action": "send_guild_channel_msg",
"params": {
"guild_id": str(guild_id),
"channel_id": str(channel_id),
"message": message
},
"echo": {
"message_source": message_source
}
}))
def delete_msg(msg_id):
global_var.ws.send(json.dumps({
"action": "delete_msg",
"params": {
"message_id": msg_id,
}
}))