Browse Source

raider.io api for m+ rotation

master
Sergio Álvarez 4 years ago
parent
commit
df7fcb4236
  1. 18
      affixes.py

18
affixes.py

@ -3,17 +3,21 @@
Affixes Cron
"""
import datetime
import requests
import webhook
import conf
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 = []
for s in conf.affix_rotation[week]:
f.append(webhook.field("{1} {0}".format(s, conf.affixes[s]), conf.affix_human[s], True))
if api is not None and "affix_details" in api:
fields = []
wh.add_embed(webhook.embed(color=0x3f89ff, fields=f))
wh.send("**[Affixes de esta semana](<https://mythicpl.us/>)**")
for d in api["affix_details"]:
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…
Cancel
Save