discord-guild-notifications/affixes.py

24 lines
623 B
Python
Raw Permalink Normal View History

2017-07-10 08:58:51 +00:00
#! /usr/bin/python3
2017-12-13 11:37:31 +00:00
"""
Affixes Cron
"""
2017-07-10 08:58:51 +00:00
2018-01-16 10:00:12 +00:00
import requests
2017-07-10 08:58:51 +00:00
import webhook
import conf
wh = webhook.Webhook(conf.url_discord_webhook_news)
2017-07-10 08:58:51 +00:00
2018-01-16 10:00:12 +00:00
rio_api = "https://raider.io/api/v1/mythic-plus/affixes?region=eu&locale=es"
api = requests.get(url=rio_api).json()
2017-07-10 08:58:51 +00:00
2018-01-16 10:00:12 +00:00
if api is not None and "affix_details" in api:
fields = []
2017-07-10 08:58:51 +00:00
2018-01-16 10:00:12 +00:00
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/>)**")