【发布时间】:2022-08-05 20:46:10
【问题描述】:
因此,作为信息,我尝试制作一个脚本来检查 SessionID 在 Minecraft 中是否有效,然后将其发送到 webhook。
File \"c:\\Users\\PC\\Desktop\\RandomShit\\dhook.py\", line 43, in <module>
isValid = post_request()
TypeError: post_request() missing 2 required positional arguments: \'token\' and \'uuid\'
所以这是代码,但由于某种原因它不起作用,我对 python 和一般编码很陌生,需要帮助。
from cgitb import text
from dhooks import Webhook, Embed
import requests
import json
hook = Webhook(\'https://discord.com/api/webhooks/1000036496658669619/OChDQ2Whz86jlIrXDelDUUybjQ0DPXkEWRB9QRInBJb18Ww4W-NPo_ZM_fVwnHQ88gh0\')
token = \"Token Here\"
uuid = \"UUID Here\"
def send(token, uuid):
#embed json
embed = Embed(
title= \"Token Validator\",
color=0x68228B,
timestamp=\'now\' # sets the timestamp to current time
)
embed.add_field(name=\'UUID\', value=uuid, inline=\'false\')
embed.add_field(name=\'Token\', value=token, inline=\'false\')
hook.send(embed=embed)
def post_request(token, uuid):
url = \"https://sessionserver.mojang.com/session/minecraft/join\"
payload = {
\"accessToken\": token,
\"selectedProfile\": uuid,
\"serverId\": uuid
}
headers = {
\'Content-Type\': \"application/json\"
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
if response.status_code == 204:
return True
else:
print(response.text)
return False
isValid = post_request()
if isValid:
print(\"token is valid\")
send(token, uuid)
else:
print(\"token is invalid\")
感谢我能得到的所有帮助。
标签: python