🧹 Cleaned up starwars funcs
This commit is contained in:
@ -2,16 +2,9 @@ import discord, string, json
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord_slash import cog_ext
|
from discord_slash import cog_ext
|
||||||
|
|
||||||
from utils import Options, cap
|
from utils import getParams
|
||||||
|
|
||||||
with open("resources/slashParameters.json", "r") as f:
|
params = getParams()
|
||||||
params = json.load(f)
|
|
||||||
|
|
||||||
options = Options()
|
|
||||||
|
|
||||||
if options.testing:
|
|
||||||
for p in params:
|
|
||||||
params[p]["guild_ids"] = options.guildIds
|
|
||||||
|
|
||||||
class starWarsCog(commands.Cog):
|
class starWarsCog(commands.Cog):
|
||||||
|
|
||||||
@ -22,46 +15,23 @@ class starWarsCog(commands.Cog):
|
|||||||
# Rolls star wars dice
|
# Rolls star wars dice
|
||||||
@cog_ext.cog_slash(**params["starWarsRoll"])
|
@cog_ext.cog_slash(**params["starWarsRoll"])
|
||||||
async def starWarsRoll(self, ctx, dice = ""):
|
async def starWarsRoll(self, ctx, dice = ""):
|
||||||
command = cap(dice)
|
await self.bot.starWars.roll.parseRoll(ctx, dice)
|
||||||
newMessage = self.bot.starWars.roll.parseRoll("#"+str(ctx.author.id),command)
|
|
||||||
messageList = newMessage.split("\n")
|
|
||||||
await ctx.send(messageList[0])
|
|
||||||
if len(messageList) > 1:
|
|
||||||
for messageItem in messageList[1:]:
|
|
||||||
await ctx.channel.send(messageItem)
|
|
||||||
|
|
||||||
# Controls destiny points
|
# Controls destiny points
|
||||||
@cog_ext.cog_slash(**params["starWarsDestiny"])
|
@cog_ext.cog_slash(**params["starWarsDestiny"])
|
||||||
async def starWarsDestiny(self, ctx, parameters = ""):
|
async def starWarsDestiny(self, ctx, parameters = ""):
|
||||||
newMessage = self.bot.starWars.destiny.parseDestiny("#"+str(ctx.author.id),parameters)
|
await self.bot.starWars.destiny.parseDestiny(ctx, parameters)
|
||||||
messageList = newMessage.split("\n")
|
|
||||||
await ctx.send(messageList[0])
|
|
||||||
if len(messageList) > 1:
|
|
||||||
for messageItem in messageList[1:]:
|
|
||||||
await ctx.channel.send(messageItem)
|
|
||||||
|
|
||||||
# Rolls for critical injuries
|
# Rolls for critical injuries
|
||||||
@cog_ext.cog_slash(**params["starWarsCrit"])
|
@cog_ext.cog_slash(**params["starWarsCrit"])
|
||||||
async def starWarsCrit(self, ctx, severity : int = 0):
|
async def starWarsCrit(self, ctx, severity : int = 0):
|
||||||
newMessage = self.bot.starWars.roll.critRoll(int(severity))
|
await self.bot.starWars.roll.critRoll(ctx, severity)
|
||||||
|
|
||||||
messageList = newMessage.split("\n")
|
|
||||||
await ctx.send(messageList[0])
|
|
||||||
if len(messageList) > 1:
|
|
||||||
for messageItem in messageList[1:]:
|
|
||||||
await ctx.channel.send(messageItem)
|
|
||||||
|
|
||||||
# Accesses and changes character sheet data with the parseChar function
|
# Accesses and changes character sheet data with the parseChar function
|
||||||
# from funcs/starWarsFuncs/starWarsCharacter.py
|
# from funcs/starWarsFuncs/starWarsCharacter.py
|
||||||
@cog_ext.cog_slash(**params["starWarsCharacter"])
|
@cog_ext.cog_slash(**params["starWarsCharacter"])
|
||||||
async def starWarsCharacter(self, ctx, parameters = ""):
|
async def starWarsCharacter(self, ctx, parameters = ""):
|
||||||
command = string.capwords(parameters.replace("+","+ ").replace("-","- ").replace(",",", "))
|
await self.bot.starWars.character.parseChar(ctx, parameters)
|
||||||
title, desc = self.bot.starWars.character.parseChar("#"+str(ctx.author.id),command)
|
|
||||||
if title != "":
|
|
||||||
em1 = discord.Embed(title = title, description = desc, colour=0xDEADBF)
|
|
||||||
await ctx.send(embed = em1)
|
|
||||||
else:
|
|
||||||
await ctx.send(desc)
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(starWarsCog(bot))
|
bot.add_cog(starWarsCog(bot))
|
@ -1,5 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import string
|
import string
|
||||||
|
import discord
|
||||||
|
|
||||||
class StarWarsChar():
|
class StarWarsChar():
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
@ -470,7 +471,10 @@ class StarWarsChar():
|
|||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
def parseChar(self,user : str, cmd : str):
|
async def parseChar(self, ctx, parameters : str):
|
||||||
|
user = f"#{ctx.author.id}"
|
||||||
|
cmd = string.capwords(parameters.replace("+","+ ").replace("-","- ").replace(",",", "))
|
||||||
|
returnEmbed = False
|
||||||
|
|
||||||
cmd = self.replaceSpaces(cmd)
|
cmd = self.replaceSpaces(cmd)
|
||||||
|
|
||||||
@ -487,8 +491,9 @@ class StarWarsChar():
|
|||||||
|
|
||||||
if cmd == "":
|
if cmd == "":
|
||||||
if userCharacter != None:
|
if userCharacter != None:
|
||||||
text1, text2 = self.characterSheet(userCharacter)
|
title, text = self.characterSheet(userCharacter)
|
||||||
return text1, self.replaceWithSpaces(text2)
|
text = self.replaceWithSpaces(text)
|
||||||
|
returnEmbed = True
|
||||||
else:
|
else:
|
||||||
self.bot.log("Makin' a character for "+self.bot.databaseFuncs.getName(user))
|
self.bot.log("Makin' a character for "+self.bot.databaseFuncs.getName(user))
|
||||||
with open("resources/starWars/starwarstemplates.json", "r") as f:
|
with open("resources/starWars/starwarstemplates.json", "r") as f:
|
||||||
@ -496,14 +501,20 @@ class StarWarsChar():
|
|||||||
newChar = templates["Character"]
|
newChar = templates["Character"]
|
||||||
newChar["_id"] = user
|
newChar["_id"] = user
|
||||||
self.bot.database["starwars characters"].insert_one(newChar)
|
self.bot.database["starwars characters"].insert_one(newChar)
|
||||||
return "", "Character for " + self.bot.databaseFuncs.getName(user) + " created"
|
await ctx.send("Character for " + self.bot.databaseFuncs.getName(user) + " created")
|
||||||
else:
|
else:
|
||||||
if cmd == "Purge":
|
if cmd == "Purge":
|
||||||
self.bot.log("Deleting "+self.bot.databaseFuncs.getName(user)+"'s character")
|
self.bot.log("Deleting "+self.bot.databaseFuncs.getName(user)+"'s character")
|
||||||
self.bot.database["starwars characters"].delete_one({"_id":user})
|
self.bot.database["starwars characters"].delete_one({"_id":user})
|
||||||
return "", "Character for " + self.bot.databaseFuncs.getName(user) + " deleted"
|
await ctx.send("Character for " + self.bot.databaseFuncs.getName(user) + " deleted")
|
||||||
else:
|
else:
|
||||||
return "", self.replaceWithSpaces(str(self.charData(user,cmd)))
|
await ctx.send(self.replaceWithSpaces(str(self.charData(user,cmd))))
|
||||||
|
|
||||||
|
if returnEmbed:
|
||||||
|
em = discord.Embed(title = title, description = text, colour=0xDEADBF)
|
||||||
|
await ctx.send(embed = em)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def lightsaberChar(self,user : str):
|
def lightsaberChar(self,user : str):
|
||||||
userCharacter = self.bot.database["starwars characters"].find_one({"_id":user})
|
userCharacter = self.bot.database["starwars characters"].find_one({"_id":user})
|
||||||
|
@ -4,13 +4,13 @@ class StarWarsDestiny():
|
|||||||
|
|
||||||
def destinyNew(self, num : int):
|
def destinyNew(self, num : int):
|
||||||
self.bot.log("Creating a new destiny pool with "+str(num)+" players")
|
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))
|
roll = "".join(sorted(roll))
|
||||||
|
|
||||||
with open("resources/starWars/destinyPoints.txt","wt") as f:
|
with open("resources/starWars/destinyPoints.txt","wt") as f:
|
||||||
f.write(roll)
|
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):
|
def destinyUse(self, user : str):
|
||||||
with open("resources/starWars/destinyPoints.txt","rt") as f:
|
with open("resources/starWars/destinyPoints.txt","rt") as f:
|
||||||
@ -24,7 +24,7 @@ class StarWarsDestiny():
|
|||||||
with open("resources/starWars/destinyPoints.txt","wt") as f:
|
with open("resources/starWars/destinyPoints.txt","wt") as f:
|
||||||
f.write(points)
|
f.write(points)
|
||||||
self.bot.log("Did it")
|
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:
|
else:
|
||||||
self.bot.log("There were no dark side destiny points")
|
self.bot.log("There were no dark side destiny points")
|
||||||
return "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:
|
with open("resources/starWars/destinyPoints.txt","wt") as f:
|
||||||
f.write(points)
|
f.write(points)
|
||||||
self.bot.log("Did it")
|
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:
|
else:
|
||||||
self.bot.log("There were no dark side destiny points")
|
self.bot.log("There were no dark side destiny points")
|
||||||
return "No light 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 != "":
|
if cmd != "":
|
||||||
while cmd[0] == ' ':
|
while cmd[0] == ' ':
|
||||||
cmd = cmd[1:]
|
cmd = cmd[1:]
|
||||||
if cmd == "":
|
if cmd == "":
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
if cmd == "":
|
if cmd == "":
|
||||||
self.bot.log("Retrieving destiny pool info")
|
self.bot.log("Retrieving destiny pool info")
|
||||||
with open("resources/starWars/destinyPoints.txt","rt") as f:
|
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:
|
else:
|
||||||
commands = cmd.upper().split(" ")
|
commands = cmd.upper().split(" ")
|
||||||
if commands[0] == "N":
|
if commands[0] == "N":
|
||||||
if len(commands) > 1:
|
if len(commands) > 1:
|
||||||
return self.destinyNew(int(commands[1]))
|
sendMessage = self.destinyNew(int(commands[1]))
|
||||||
else:
|
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":
|
elif commands[0] == "U":
|
||||||
return self.destinyUse(user)
|
sendMessage = self.destinyUse(user)
|
||||||
else:
|
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)
|
||||||
|
@ -239,7 +239,7 @@ class StarWarsRoll():
|
|||||||
return random.choice(table)
|
return random.choice(table)
|
||||||
|
|
||||||
# Rolls for critical injury
|
# Rolls for critical injury
|
||||||
def critRoll(self, addington : int):
|
async def critRoll(self, ctx, addington : int):
|
||||||
dd = "<:difficulty:690973992470708296>"
|
dd = "<:difficulty:690973992470708296>"
|
||||||
sd = "<:setback:690972157890658415>"
|
sd = "<:setback:690972157890658415>"
|
||||||
bd = "<:boost:690972178216386561>"
|
bd = "<:boost:690972178216386561>"
|
||||||
@ -253,14 +253,14 @@ class StarWarsRoll():
|
|||||||
"**Discouraging Wound**: Flip one light side Destiny point to a dark side Destiny point (reverse if NPC), "+dd] * 5 + [
|
"**Discouraging Wound**: Flip one light side Destiny point to a dark side Destiny point (reverse if NPC), "+dd] * 5 + [
|
||||||
"**Stunned**: The target is staggered until the end of his next turn, "+dd] * 5 + [
|
"**Stunned**: The target is staggered until the end of his next turn, "+dd] * 5 + [
|
||||||
"**Stinger**: Increase the difficulty of next check by one, "+dd] * 5 + [
|
"**Stinger**: Increase the difficulty of next check by one, "+dd] * 5 + [
|
||||||
"**Bowled Over**: The target is knocked prone and suffers 1 sttrain, "+dd+dd] * 5 + [
|
"**Bowled Over**: The target is knocked prone and suffers 1 strain, "+dd+dd] * 5 + [
|
||||||
"**Head Ringer**: The target increases the difficulty of all Intellect and Cunning checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
"**Head Ringer**: The target increases the difficulty of all Intellect and Cunning checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
||||||
"**Fearsome Wound**: The target increases the difficulty of all Presence and Willpower checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
"**Fearsome Wound**: The target increases the difficulty of all Presence and Willpower checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
||||||
"**Agonizing Wound**: The target increases the difficulty of all Brawn and Agility checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
"**Agonizing Wound**: The target increases the difficulty of all Brawn and Agility checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
||||||
"**Slightly Dazed**: The target is disoriented until the end of the encounter, "+dd+dd] * 5 + [
|
"**Slightly Dazed**: The target is disoriented until the end of the encounter, "+dd+dd] * 5 + [
|
||||||
"**Scattered Senses**: The target removes all "+bd+" from skill checks until the end of the encounter, "+dd+dd] * 5 + [
|
"**Scattered Senses**: The target removes all "+bd+" from skill checks until the end of the encounter, "+dd+dd] * 5 + [
|
||||||
"**Hamstrung**: The target loses his free maneuver until the end of the encounter, "+dd+dd] * 5 + [
|
"**Hamstrung**: The target loses his free maneuver until the end of the encounter, "+dd+dd] * 5 + [
|
||||||
"**Overpowered**: The target leaves himselp open, and the attacker may immediately attempt another free attack agains him, using the exact same pool as the original, "+dd+dd] * 5 + [
|
"**Overpowered**: The target leaves himself open, and the attacker may immediately attempt another free attack agains him, using the exact same pool as the original, "+dd+dd] * 5 + [
|
||||||
"**Winded**: Until the end of the encounter, the target cannot voluntarily suffer strain to activate any abilities or gain additional maneuvers, "+dd+dd] * 5 + [
|
"**Winded**: Until the end of the encounter, the target cannot voluntarily suffer strain to activate any abilities or gain additional maneuvers, "+dd+dd] * 5 + [
|
||||||
"**Compromised**: Incerase difficulty of all skill checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
"**Compromised**: Incerase difficulty of all skill checks by one until the end of the encounter, "+dd+dd] * 5 + [
|
||||||
"**At the brink**: The target suffers 1 strain each time he performs an action, "+dd+dd+dd] * 5 + [
|
"**At the brink**: The target suffers 1 strain each time he performs an action, "+dd+dd+dd] * 5 + [
|
||||||
@ -288,56 +288,64 @@ class StarWarsRoll():
|
|||||||
characteristic = random.choice(["brawn"] * 3 + ["agility"] * 3 + ["intellect", "cunning", "presence"])
|
characteristic = random.choice(["brawn"] * 3 + ["agility"] * 3 + ["intellect", "cunning", "presence"])
|
||||||
results = "**Gruesome Injury**: The target's "+characteristic+" is permanently one lower, "+dd+dd+dd+dd
|
results = "**Gruesome Injury**: The target's "+characteristic+" is permanently one lower, "+dd+dd+dd+dd
|
||||||
|
|
||||||
return "Roll: "+str(roll)+"\nInjury:\n"+results
|
sendMessage = "Roll: "+str(roll)+"\nInjury:\n"+results
|
||||||
|
|
||||||
|
messageList = sendMessage.split("\n")
|
||||||
|
await ctx.send(messageList[0])
|
||||||
|
if len(messageList) > 1:
|
||||||
|
for messageItem in messageList[1:]:
|
||||||
|
await ctx.channel.send(messageItem)
|
||||||
|
|
||||||
# Parses the command into something the other functions understand
|
# Parses the command into something the other functions understand
|
||||||
def parseRoll(self, user : str,cmd : str = ""):
|
async def parseRoll(self, ctx, cmd : str = ""):
|
||||||
|
user = f"#{ctx.author.id}"
|
||||||
cmd = re.sub(' +',' ',cmd.upper()) + " "
|
cmd = re.sub(' +',' ',cmd.upper()) + " "
|
||||||
if cmd[0] == " ":
|
if cmd[0] == " ":
|
||||||
cmd = cmd[1:]
|
cmd = cmd[1:]
|
||||||
cmd = self.bot.starwarschar.replaceSpaces(string.capwords(cmd))
|
cmd = self.bot.starWars.character.replaceSpaces(string.capwords(cmd))
|
||||||
commands = cmd.split(" ")
|
commands = cmd.split(" ")
|
||||||
|
validCommand = False
|
||||||
|
|
||||||
if commands[0] == "":
|
if commands[0] == "":
|
||||||
rollParameters = [1,0,3,0,0,0,0]
|
rollParameters = [1,0,3,0,0,0,0]
|
||||||
else:
|
else:
|
||||||
rollParameters = [0,0,0,0,0,0,0]
|
rollParameters = [0,0,0,0,0,0,0]
|
||||||
|
|
||||||
if string.capwords(commands[0]) == "Obligations":
|
if string.capwords(commands[0]) == "Obligations":
|
||||||
try:
|
sendMessage = self.obligationRoll()
|
||||||
return self.obligationRoll()
|
|
||||||
except:
|
|
||||||
self.bot.log("Obligation fucked up (error code 911)")
|
|
||||||
return "An error ocurred (error code 911)"
|
|
||||||
|
|
||||||
elif string.capwords(commands[0]) in skillData:
|
elif string.capwords(commands[0]) in skillData:
|
||||||
self.bot.log("Oh look! This guy has skills!")
|
self.bot.log("Oh look! This guy has skills!")
|
||||||
if self.bot.starwarschar.userHasChar:
|
if self.bot.starWars.character.userHasChar(user):
|
||||||
self.bot.log("They have a character. That much we know")
|
self.bot.log("They have a character. That much we know")
|
||||||
skillLevel = self.bot.starwarschar.charData(user,"Skills " + string.capwords(commands[0]))
|
skillLevel = self.bot.starWars.character.charData(user,"Skills " + string.capwords(commands[0]))
|
||||||
|
|
||||||
if string.capwords(commands[0]) == "Lightsaber":
|
if string.capwords(commands[0]) == "Lightsaber":
|
||||||
self.bot.log("The skill is lightsaber")
|
self.bot.log("The skill is lightsaber")
|
||||||
charLevel = self.bot.starwarschar.charData(user,"Characteristics " + self.bot.starwarschar.lightsaberChar(user))
|
charLevel = self.bot.starWars.character.charData(user,"Characteristics " + self.bot.starWars.character.lightsaberChar(user))
|
||||||
else:
|
else:
|
||||||
charLevel = self.bot.starwarschar.charData(user,"Characteristics " + skillData[string.capwords(commands[0])])
|
charLevel = self.bot.starWars.character.charData(user,"Characteristics " + skillData[string.capwords(commands[0])])
|
||||||
|
|
||||||
abilityDice = abs(charLevel-skillLevel)
|
abilityDice = abs(charLevel-skillLevel)
|
||||||
proficiencyDice = min(skillLevel,charLevel)
|
proficiencyDice = min(skillLevel,charLevel)
|
||||||
|
|
||||||
commands = [str(abilityDice)] + [str(proficiencyDice)] + commands[1:]
|
commands = [str(abilityDice)] + [str(proficiencyDice)] + commands[1:]
|
||||||
self.bot.log("Converted skill to dice")
|
self.bot.log("Converted skill to dice")
|
||||||
|
validCommand = True
|
||||||
else:
|
else:
|
||||||
self.bot.log("Okay, no they don't i guess (error code 912)")
|
self.bot.log("Okay, no they don't i guess")
|
||||||
return "You don't have a user. You can make one with /starwarscharacter (error code 912)"
|
sendMessage = "You don't have a user. You can make one with /starwarscharacter"
|
||||||
|
|
||||||
elif string.capwords(commands[0]) in ["Ranged","Piloting"]:
|
elif string.capwords(commands[0]) in ["Ranged","Piloting"]:
|
||||||
self.bot.log("They fucked up writing the name of a ranged or piloting skill")
|
self.bot.log("They fucked up writing the name of a ranged or piloting skill")
|
||||||
if string.capwords(commands[0]) == "Ranged":
|
if string.capwords(commands[0]) == "Ranged":
|
||||||
return "Did you mean \"Ranged - Heavy\" or \"Ranged - Light\" (error code 913)"
|
sendMessage = "Did you mean \"Ranged - Heavy\" or \"Ranged - Light\" (error code 913)"
|
||||||
else:
|
else:
|
||||||
return "Did you mean \"Piloting - Planetary\" or \"Piloting - Space\" (error code 913)"
|
sendMessage = "Did you mean \"Piloting - Planetary\" or \"Piloting - Space\" (error code 913)"
|
||||||
|
else:
|
||||||
|
validCommand = True
|
||||||
|
|
||||||
try:
|
if validCommand:
|
||||||
self.bot.log("Converting commands to dice")
|
self.bot.log("Converting commands to dice")
|
||||||
for x, command in enumerate(commands):
|
for x, command in enumerate(commands):
|
||||||
if command != "":
|
if command != "":
|
||||||
@ -358,21 +366,26 @@ class StarWarsRoll():
|
|||||||
rollParameters[6] = int(command.replace("F",""))
|
rollParameters[6] = int(command.replace("F",""))
|
||||||
else:
|
else:
|
||||||
rollParameters[x] = int(command)
|
rollParameters[x] = int(command)
|
||||||
except:
|
|
||||||
self.bot.log("Someone fucked u-up! (it was them) (error code 914)")
|
|
||||||
return "Invalid input! (error code 914)"
|
|
||||||
|
|
||||||
self.bot.log("Rolling "+str(rollParameters))
|
self.bot.log("Rolling "+str(rollParameters))
|
||||||
rollResults, diceResults = self.roll(rollParameters[0],rollParameters[1],rollParameters[2],rollParameters[3],rollParameters[4],rollParameters[5],rollParameters[6])
|
rollResults, diceResults = self.roll(rollParameters[0],rollParameters[1],rollParameters[2],rollParameters[3],rollParameters[4],rollParameters[5],rollParameters[6])
|
||||||
|
|
||||||
simplified = self.simplify(rollResults)
|
simplified = self.simplify(rollResults)
|
||||||
|
|
||||||
name = self.bot.starwarschar.getCharName(user)
|
name = self.bot.starWars.character.getCharName(user)
|
||||||
|
|
||||||
self.bot.log("Returns results and simplified results")
|
self.bot.log("Returns results and simplified results")
|
||||||
|
|
||||||
if simplified == "":
|
if simplified == "":
|
||||||
return name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\nEverything cancels out!"
|
sendMessage = name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\nEverything cancels out!"
|
||||||
else:
|
else:
|
||||||
return name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\n" + self.resultToEmoji(simplified)
|
sendMessage = name + " rolls: " + "\n" + self.diceResultToEmoji(diceResults) + "\n" + self.resultToEmoji(simplified)
|
||||||
|
|
||||||
|
messageList = sendMessage.split("\n")
|
||||||
|
await ctx.send(messageList[0])
|
||||||
|
if len(messageList) > 1:
|
||||||
|
for messageItem in messageList[1:]:
|
||||||
|
if messageItem == "":
|
||||||
|
self.bot.log("Tried to send empty message")
|
||||||
|
else:
|
||||||
|
await ctx.channel.send(messageItem)
|
||||||
|
Reference in New Issue
Block a user