affixes.py 623 B

1234567891011121314151617181920212223
  1. #! /usr/bin/python3
  2. """
  3. Affixes Cron
  4. """
  5. import requests
  6. import webhook
  7. import conf
  8. wh = webhook.Webhook(conf.url_discord_webhook_news)
  9. rio_api = "https://raider.io/api/v1/mythic-plus/affixes?region=eu&locale=es"
  10. api = requests.get(url=rio_api).json()
  11. if api is not None and "affix_details" in api:
  12. fields = []
  13. for d in api["affix_details"]:
  14. name = d["name"]
  15. fields.append(webhook.field("{1} {0}".format(name, conf.affixes[name]), conf.affix_human[name], True))
  16. wh.add_embed(webhook.embed(color=0x3f89ff, fields=fields))
  17. wh.send("**[Affixes de esta semana](<https://mythicpl.us/>)**")