-
Notifications
You must be signed in to change notification settings - Fork 0
/
Salai.py
80 lines (71 loc) · 3.74 KB
/
Salai.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import Globals
import requests
def pass_prompt_to_self_bot(prompt: str):
payload = {"type": 2, "application_id": "936929561302675456", "guild_id": Globals.SERVER_ID,
"channel_id": Globals.CHANNEL_ID, "session_id": "2fb980f65e5c9a77c96ca01f2c242cf6",
"data": {"version": "1077969938624553050", "id": "938956540159881230", "name": "imagine", "type": 1,
"options": [{"type": 3, "name": "prompt", "value": prompt}],
"application_command": {"id": "938956540159881230",
"application_id": "936929561302675456",
"version": "1077969938624553050",
"default_permission": True,
"default_member_permissions": None,
"type": 1, "nsfw": False, "name": "imagine",
"description": "Create images with Midjourney",
"dm_permission": True,
"options": [{"type": 3, "name": "prompt",
"description": "The prompt to imagine",
"required": True}]},
"attachments": []}}
header = {
'authorization': Globals.SALAI_TOKEN
}
response = requests.post("https://discord.com/api/v9/interactions",
json=payload, headers=header)
return response
def upscale(index: int, messageId: str, messageHash: str):
payload = {"type": 3,
"guild_id": Globals.SERVER_ID,
"channel_id": Globals.CHANNEL_ID,
"message_flags": 0,
"message_id": messageId,
"application_id": "936929561302675456",
"session_id": "45bc04dd4da37141a5f73dfbfaf5bdcf",
"data": {"component_type": 2,
"custom_id": "MJ::JOB::upsample::{}::{}".format(index, messageHash)}
}
header = {
'authorization': Globals.SALAI_TOKEN
}
response = requests.post("https://discord.com/api/v9/interactions",
json=payload, headers=header)
return response
def max_upscale(messageId: str, messageHash: str):
payload = {"type": 3,
"guild_id": Globals.SERVER_ID,
"channel_id": Globals.CHANNEL_ID,
"message_flags": 0,
"message_id": messageId,
"application_id": "936929561302675456",
"session_id": "1f3dbdf09efdf93d81a3a6420882c92c", "data":
{"component_type": 2, "custom_id": "MJ::JOB::upsample_max::1::{}::SOLO".format(messageHash)}}
header = {
'authorization': Globals.SALAI_TOKEN
}
response = requests.post("https://discord.com/api/v9/interactions",
json=payload, headers=header)
return response
def variation(index: int, messageId: str, messageHash: str):
payload = {"type": 3, "guild_id": Globals.SERVER_ID,
"channel_id": Globals.CHANNEL_ID,
"message_flags": 0,
"message_id": messageId,
"application_id": "936929561302675456",
"session_id": "1f3dbdf09efdf93d81a3a6420882c92c",
"data": {"component_type": 2, "custom_id": "MJ::JOB::variation::{}::{}".format(index, messageHash)}}
header = {
'authorization': Globals.SALAI_TOKEN
}
response = requests.post("https://discord.com/api/v9/interactions",
json=payload, headers=header)
return response