more API key stuff
This commit is contained in:
parent
8b1f46cb83
commit
c0fb393b52
|
@ -33,6 +33,7 @@ if not os.path.exists('config'):
|
|||
"bitly_user": "INSERT USERNAME FROM bitly.com HERE",
|
||||
"bitly_api": "INSERT API KEY FROM bitly.com HERE",
|
||||
"wolframalpha": "INSERT API KEY FROM wolframalpha.com HERE",
|
||||
"lastfm": "INSERT API KEY FROM lastfm HERE",
|
||||
"mc_user": "INSERT MINECRAFT USERNAME HERE (used to check login servers in mctools.py)",
|
||||
"mc_pass": "INSERT MINECRAFT PASSWORD HERE (used to check login servers in mctools.py)"
|
||||
},
|
||||
|
|
|
@ -34,7 +34,7 @@ answers = [g + "As I see it, yes",
|
|||
r + "Very doubtful"]
|
||||
|
||||
@hook.command('8ball')
|
||||
def ask(inp, me=None):
|
||||
def eightball(inp, me=None):
|
||||
".8ball <question> - The all knowing magic eight ball, in electronic form. Ask a question and the answer shall be provided."
|
||||
global nextresponsenumber
|
||||
inp = inp.strip()
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
from util import hook, http
|
||||
|
||||
|
||||
api_key = "71ebca1c7e6b12ccd900efed95f7c1e0"
|
||||
|
||||
api_url = "http://ws.audioscrobbler.com/2.0/?format=json"
|
||||
|
||||
|
||||
@hook.command
|
||||
def lastfm(inp, nick='', say=None):
|
||||
def lastfm(inp, nick='', say=None, bot=None):
|
||||
if inp:
|
||||
user = inp
|
||||
else:
|
||||
user = nick
|
||||
|
||||
api_key = bot.config.get("api_keys", {}).get("lastfm", None)
|
||||
if api_key is None:
|
||||
return "error: no api key set"
|
||||
|
||||
response = http.get_json(api_url, method="user.getrecenttracks",
|
||||
api_key=api_key, user=user, limit=1)
|
||||
|
||||
|
|
Reference in a new issue