Compare commits
3 Commits
63cdb8b84d
...
382b3ce179
Author | SHA1 | Date | |
---|---|---|---|
382b3ce179 | |||
90d59aff50 | |||
784310e162 |
|
@ -10,6 +10,7 @@ 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",
|
||||||
|
@ -28,7 +29,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)
|
res = requests.get(URI + "/coin", params=params, headers=HEADERS)
|
||||||
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,3 +46,22 @@ 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,6 +3,7 @@
|
||||||
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