add ship quirks command
This commit is contained in:
parent
90d59aff50
commit
382b3ce179
|
@ -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])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user