-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathupsender.py
46 lines (38 loc) · 1.59 KB
/
upsender.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
import requests
import json
class Sender:
def __init__(self,
params,
index):
self.index = index
self.params = params
self.sender_initializer()
def sender_initializer(self):
with open(self.params, "r") as json_file:
params = json.load(json_file)
self.channelid = params['channelid']
self.authorization = params['authorization']
self.application_id = params['application_id']
self.guild_id = params['guild_id']
self.session_id = params['session_id']
self.version = params['version']
self.id = params['id']
self.flags = params['flags']
def send(self, message_id, number,uuid):
header = {'authorization': self.authorization}
payload = {'type': 3,
'application_id': self.application_id,
'guild_id': self.guild_id,
'channel_id': self.channelid[self.index],
'session_id': self.session_id,
"message_flags": 0,
"message_id": message_id,
"data": {"component_type": 2, "custom_id": f"MJ::JOB::upsample::{number}::{uuid}"}}
r = requests.post('https://discord.com/api/v9/interactions',
json=payload,
headers=header)
while r.status_code != 204:
r = requests.post('https://discord.com/api/v9/interactions',
json=payload,
headers=header)
print('Upscale request for message_id [{}] and number [{}] successfully sent!'.format(message_id, number))