raider.io api for m+ rotation
This commit is contained in:
parent
b6f077aab8
commit
df7fcb4236
18
affixes.py
18
affixes.py
|
@ -3,17 +3,21 @@
|
||||||
Affixes Cron
|
Affixes Cron
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import datetime
|
import requests
|
||||||
import webhook
|
import webhook
|
||||||
import conf
|
import conf
|
||||||
|
|
||||||
wh = webhook.Webhook(conf.url_discord_webhook_news)
|
wh = webhook.Webhook(conf.url_discord_webhook_news)
|
||||||
|
|
||||||
week = (int(datetime.datetime.now().strftime("%V")) % len(conf.affix_rotation)) - 1
|
rio_api = "https://raider.io/api/v1/mythic-plus/affixes?region=eu&locale=es"
|
||||||
|
api = requests.get(url=rio_api).json()
|
||||||
|
|
||||||
f = []
|
if api is not None and "affix_details" in api:
|
||||||
for s in conf.affix_rotation[week]:
|
fields = []
|
||||||
f.append(webhook.field("{1} {0}".format(s, conf.affixes[s]), conf.affix_human[s], True))
|
|
||||||
|
|
||||||
wh.add_embed(webhook.embed(color=0x3f89ff, fields=f))
|
for d in api["affix_details"]:
|
||||||
wh.send("**[Affixes de esta semana](<https://mythicpl.us/>)**")
|
name = d["name"]
|
||||||
|
fields.append(webhook.field("{1} {0}".format(name, conf.affixes[name]), conf.affix_human[name], True))
|
||||||
|
|
||||||
|
wh.add_embed(webhook.embed(color=0x3f89ff, fields=fields))
|
||||||
|
wh.send("**[Affixes de esta semana](<https://mythicpl.us/>)**")
|
||||||
|
|
Loading…
Reference in New Issue