First working version! Woo!
I figured out what the issue was. Discord was trying to tell me there was a problem with the embed I was sending. The provider value was removed, and with some other tweaks it all started working. Heavy, heavy facepalm.
This commit is contained in:
parent
e6c43876ac
commit
bd2af92ec9
1 changed files with 16 additions and 12 deletions
28
discorss.py
28
discorss.py
|
@ -54,29 +54,33 @@ def main():
|
||||||
print(feed.entries[0]["published"], published_time, now)
|
print(feed.entries[0]["published"], published_time, now)
|
||||||
# Generate the webhook
|
# Generate the webhook
|
||||||
webhook = {
|
webhook = {
|
||||||
|
"content": "RSS Feed Update from " + str(hook["name"]),
|
||||||
"embeds": [
|
"embeds": [
|
||||||
{
|
{
|
||||||
"title": str(feed.entries[0]["title"]),
|
"title": str(feed.entries[0]["title"]),
|
||||||
"url": str(feed.entries[0]["link"]),
|
"url": str(feed.entries[0]["link"]),
|
||||||
"description": getDescription(feed),
|
"color": 5814783,
|
||||||
"provider": "DiscoRSS",
|
"fields": [
|
||||||
|
{
|
||||||
|
"name": str(feed.entries[0]["title"]),
|
||||||
|
"value": getDescription(feed),
|
||||||
|
}
|
||||||
|
],
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"attachments": [],
|
||||||
}
|
}
|
||||||
customHeader = {
|
customHeader = {
|
||||||
"user-agent": "DiscoRSS (https://git.frzn.dev/amr/discorss, 0.1)",
|
"user-agent": "DiscoRSS (https://git.frzn.dev/amr/discorss, 0.1)",
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
}
|
}
|
||||||
|
webhookStr = json.dumps(webhook)
|
||||||
|
print(webhookStr)
|
||||||
if published_time > last_check and published_time < now:
|
if published_time > last_check and published_time < now:
|
||||||
print(json.dumps(webhook))
|
r = requests.post(hook["webhook"], data=webhookStr, headers=customHeader)
|
||||||
r = requests.post(
|
app_config["lastupdate"] = now
|
||||||
hook["webhook"], data=json.dumps(webhook), headers=customHeader
|
with open(config_file_path, "w") as config_file:
|
||||||
)
|
json.dump(app_config, config_file, indent=4)
|
||||||
print(webhook["embeds"][0]["title"])
|
|
||||||
print(r.text, r.status_code, r.json())
|
|
||||||
app_config["lastupdate"] = now
|
|
||||||
with open(config_file_path, "w") as config_file:
|
|
||||||
json.dump(app_config, config_file, indent=4)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue