Created
December 29, 2016 20:08
-
-
Save dasu/045761882b4a791c480950c253a4eda8 to your computer and use it in GitHub Desktop.
shadowverse poc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sopel | |
import requests | |
@sopel.module.commands('sv','shadowverse') | |
def sv(bot,trigger): | |
if not trigger.group(2): | |
return bot.say("Please enter a card name.") | |
svcards = requests.get("https://shadowverse-portal.com/api/v1/cards?format=json&lang=en").json() | |
for index,card in enumerate(svcards['data']['cards']): | |
if trigger.group(2).lower() in card['card_name'].lower(): | |
return bot.say("Name:{} Description: {}".format(svcards['data']['cards'][index]['card_name'],svcards['data']['cards'][index]['description'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the proper thing to do would be to save the json file locally and call that instead. Have it update either via an interval (once a week?), or at bot startup.