Compare commits
No commits in common. "382b3ce1797baff4cd61e62b91da854a8c2ad721" and "63cdb8b84d0ef63ca1baf00fecc3f9ca6f076fdf" have entirely different histories.
382b3ce179
...
63cdb8b84d
|
@ -10,7 +10,6 @@ import config
|
||||||
from module import commands, example, require_admin
|
from module import commands, example, require_admin
|
||||||
|
|
||||||
URI = "https://coinlib.io/api/v1"
|
URI = "https://coinlib.io/api/v1"
|
||||||
HEADERS = {'cookie': "SESSIONID=91049a9e2e89f6a39f827378dd10184f;"}
|
|
||||||
|
|
||||||
@commands("crypto", "coin")
|
@commands("crypto", "coin")
|
||||||
@example(".crypto btc",
|
@example(".crypto btc",
|
||||||
|
@ -29,7 +28,7 @@ def crypto(bot, trigger):
|
||||||
symbol = trigger.args[1]
|
symbol = trigger.args[1]
|
||||||
if symbol:
|
if symbol:
|
||||||
params["symbol"] = symbol
|
params["symbol"] = symbol
|
||||||
res = requests.get(URI + "/coin", params=params, headers=HEADERS)
|
res = requests.get(URI + "/coin", params=params)
|
||||||
if res.status_code in [400, 401]:
|
if res.status_code in [400, 401]:
|
||||||
return bot.msg(f"Error: {res.json()['error']}")
|
return bot.msg(f"Error: {res.json()['error']}")
|
||||||
res.raise_for_status()
|
res.raise_for_status()
|
||||||
|
|
|
@ -46,22 +46,3 @@ def magic(bot, trigger):
|
||||||
if num >= len(data)-1:
|
if num >= len(data)-1:
|
||||||
num = len(data)-1
|
num = len(data)-1
|
||||||
bot.msg(data[num])
|
bot.msg(data[num])
|
||||||
|
|
||||||
|
|
||||||
@commands("ship")
|
|
||||||
def magic(bot, trigger):
|
|
||||||
"""
|
|
||||||
Prints a ship quirk. If an index is not given, a random one is chosen.
|
|
||||||
"""
|
|
||||||
with open(os.path.join(bot.static, "ship_quirks.txt"), "r") as file:
|
|
||||||
data = file.read().splitlines()
|
|
||||||
num = None
|
|
||||||
try:
|
|
||||||
num = int(trigger.args[1]) - 1
|
|
||||||
except (IndexError, ValueError):
|
|
||||||
pass
|
|
||||||
if num == None:
|
|
||||||
num = random.randint(0, len(data)-1)
|
|
||||||
if num >= len(data)-1:
|
|
||||||
num = len(data)-1
|
|
||||||
bot.msg(data[num])
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
Google translate that shit.
|
Google translate that shit.
|
||||||
"""
|
"""
|
||||||
import random
|
import random
|
||||||
import argparse
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user