✨
This commit is contained in:
@@ -103,7 +103,7 @@ class GamesCog(commands.Cog):
|
|||||||
# Runs a game of Love Letter
|
# Runs a game of Love Letter
|
||||||
@commands.command(aliases = ["ll"])
|
@commands.command(aliases = ["ll"])
|
||||||
async def loveletter(self, ctx, *, content = ""):
|
async def loveletter(self, ctx, *, content = ""):
|
||||||
await self.client.gameLoops.runLoveletter(ctx.message.channel,content,"#"+str(ctx.message.author.id))
|
await self.client.gameLoops.runLoveletter(ctx.message.channel,content,"#"+str(ctx.message.author.id),ctx.message.author)
|
||||||
|
|
||||||
def setup(client):
|
def setup(client):
|
||||||
client.add_cog(GamesCog(client))
|
client.add_cog(GamesCog(client))
|
||||||
@@ -176,6 +176,7 @@ class GameLoops():
|
|||||||
logThis("Error parsing command (error code 1510)")
|
logThis("Error parsing command (error code 1510)")
|
||||||
|
|
||||||
await channel.send(response)
|
await channel.send(response)
|
||||||
|
|
||||||
logThis(response,str(channel.id))
|
logThis(response,str(channel.id))
|
||||||
if showImage:
|
if showImage:
|
||||||
if deleteImage:
|
if deleteImage:
|
||||||
@@ -214,10 +215,9 @@ class GameLoops():
|
|||||||
|
|
||||||
|
|
||||||
# Runs Love letter
|
# Runs Love letter
|
||||||
|
async def runLoveletter(self,channel,command,user,userchannel):
|
||||||
async def runLoveletter(self,channel,command,user):
|
|
||||||
try:
|
try:
|
||||||
response, showImage, deleteImage = self.bot.hex.parseLove(command,str(channel.id),user)
|
response, showImage, deleteImage = self.bot.loveletter.parseLove(command,str(channel.id),user,userchannel)
|
||||||
except:
|
except:
|
||||||
logThis("Error parsing command (error code 1810)")
|
logThis("Error parsing command (error code 1810)")
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ class HexGame():
|
|||||||
def parseHex(self, command, channel, user):
|
def parseHex(self, command, channel, user):
|
||||||
commands = command.lower().split()
|
commands = command.lower().split()
|
||||||
game = self.bot.database["hex games"].find_one({"_id":channel})
|
game = self.bot.database["hex games"].find_one({"_id":channel})
|
||||||
|
|
||||||
if command == "" or command == " ":
|
if command == "" or command == " ":
|
||||||
return "I didn't get that. Use \"!hex start [opponent]\" to start a game.", False, False, False, False
|
return "I didn't get that. Use \"!hex start [opponent]\" to start a game.", False, False, False, False
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ class LoveLetter():
|
|||||||
self.draw = DrawLove(bot)
|
self.draw = DrawLove(bot)
|
||||||
|
|
||||||
# Parses command
|
# Parses command
|
||||||
def parseLove(self, command, channel, user):
|
def parseLove(self, command, channel, user, userchannel):
|
||||||
commands = command.lower().split()
|
commands = command.lower().split()
|
||||||
game = self.bot.database["loveletter games"].find_one({"_id":channel})
|
game = self.bot.database["loveletter games"].find_one({"_id":channel})
|
||||||
|
|
||||||
if command == "" or command == " ":
|
if command == "" or command == " ":
|
||||||
logThis(str(user)+" started a Love Letter game with loveStart(). ")
|
logThis(str(user)+" created a Love Letter game with loveStart(). ")
|
||||||
return self.loveStart(channel)
|
return self.loveStart(channel)
|
||||||
|
|
||||||
# If using a command with no game, return error
|
# If using a command with no game, return error
|
||||||
@@ -30,6 +30,7 @@ class LoveLetter():
|
|||||||
username = self.bot.funcs.getName(user)
|
username = self.bot.funcs.getName(user)
|
||||||
game["player hands"][username] = card
|
game["player hands"][username] = card
|
||||||
game["discard piles"][username] = []
|
game["discard piles"][username] = []
|
||||||
|
game["user channel"][username] = userchannel # Used for direct (private) messages to the users
|
||||||
self.bot.database["loveletter games"].replace_one({"_id":channel},game)
|
self.bot.database["loveletter games"].replace_one({"_id":channel},game)
|
||||||
return username+" joined the game! Type \"!loveletter begin\" once all players have joined.", False, False
|
return username+" joined the game! Type \"!loveletter begin\" once all players have joined.", False, False
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user