🧹 Cleaned up starwars funcs
This commit is contained in:
@ -4,13 +4,13 @@ class StarWarsDestiny():
|
||||
|
||||
def destinyNew(self, num : int):
|
||||
self.bot.log("Creating a new destiny pool with "+str(num)+" players")
|
||||
roll, diceResults = self.bot.starwarsroll.roll(0,0,0,0,0,0,num)
|
||||
roll, diceResults = self.bot.starWars.roll.roll(0,0,0,0,0,0,num)
|
||||
roll = "".join(sorted(roll))
|
||||
|
||||
with open("resources/starWars/destinyPoints.txt","wt") as f:
|
||||
f.write(roll)
|
||||
|
||||
return "Rolled for Destiny Points and got:\n"+self.bot.starwarsroll.diceResultToEmoji(diceResults)+"\n"+self.bot.starwarsroll.resultToEmoji(roll)
|
||||
return "Rolled for Destiny Points and got:\n"+self.bot.starWars.roll.diceResultToEmoji(diceResults)+"\n"+self.bot.starWars.roll.resultToEmoji(roll)
|
||||
|
||||
def destinyUse(self, user : str):
|
||||
with open("resources/starWars/destinyPoints.txt","rt") as f:
|
||||
@ -24,7 +24,7 @@ class StarWarsDestiny():
|
||||
with open("resources/starWars/destinyPoints.txt","wt") as f:
|
||||
f.write(points)
|
||||
self.bot.log("Did it")
|
||||
return "Used a dark side destiny point. Destiny pool is now:\n"+self.bot.starwarsroll.resultToEmoji(points)
|
||||
return "Used a dark side destiny point. Destiny pool is now:\n"+self.bot.starWars.roll.resultToEmoji(points)
|
||||
else:
|
||||
self.bot.log("There were no dark side destiny points")
|
||||
return "No dark side destiny points"
|
||||
@ -36,31 +36,37 @@ class StarWarsDestiny():
|
||||
with open("resources/starWars/destinyPoints.txt","wt") as f:
|
||||
f.write(points)
|
||||
self.bot.log("Did it")
|
||||
return "Used a light side destiny point. Destiny pool is now:\n"+self.bot.starwarsroll.resultToEmoji(points)
|
||||
return "Used a light side destiny point. Destiny pool is now:\n"+self.bot.starWars.roll.resultToEmoji(points)
|
||||
else:
|
||||
self.bot.log("There were no dark side destiny points")
|
||||
return "No light side destiny points"
|
||||
|
||||
def parseDestiny(self, user : str, cmd : str):
|
||||
async def parseDestiny(self, ctx, cmd : str):
|
||||
user = f"#{ctx.author.id}"
|
||||
if cmd != "":
|
||||
while cmd[0] == ' ':
|
||||
cmd = cmd[1:]
|
||||
if cmd == "":
|
||||
break
|
||||
|
||||
|
||||
if cmd == "":
|
||||
self.bot.log("Retrieving destiny pool info")
|
||||
with open("resources/starWars/destinyPoints.txt","rt") as f:
|
||||
return self.bot.starwarsroll.resultToEmoji(f.read())
|
||||
sendMessage = self.bot.starWars.roll.resultToEmoji(f.read())
|
||||
else:
|
||||
commands = cmd.upper().split(" ")
|
||||
if commands[0] == "N":
|
||||
if len(commands) > 1:
|
||||
return self.destinyNew(int(commands[1]))
|
||||
sendMessage = self.destinyNew(int(commands[1]))
|
||||
else:
|
||||
return "You need to give an amount of players (error code 921)"
|
||||
sendMessage = "You need to give an amount of players (error code 921)"
|
||||
elif commands[0] == "U":
|
||||
return self.destinyUse(user)
|
||||
sendMessage = self.destinyUse(user)
|
||||
else:
|
||||
return "I didn't quite understand that (error code 922)"
|
||||
sendMessage = "I didn't quite understand that (error code 922)"
|
||||
|
||||
messageList = sendMessage.split("\n")
|
||||
await ctx.send(messageList[0])
|
||||
if len(messageList) > 1:
|
||||
for messageItem in messageList[1:]:
|
||||
await ctx.channel.send(messageItem)
|
||||
|
Reference in New Issue
Block a user