Skip to content

Instantly share code, notes, and snippets.

@dasu
Created December 29, 2016 20:08
Show Gist options
  • Save dasu/045761882b4a791c480950c253a4eda8 to your computer and use it in GitHub Desktop.
Save dasu/045761882b4a791c480950c253a4eda8 to your computer and use it in GitHub Desktop.
shadowverse poc
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']))
@dasu
Copy link
Author

dasu commented Dec 29, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment