fight-fixes
Bobloy 7 years ago
parent 66ecc15536
commit 0c809ab85d

@ -13,11 +13,11 @@ class Game:
Base class to run a single game of Werewolf
"""
def __init__(self, role_code):
def __init__(self, game_code):
self.roles = []
self.role_code = role_code
self.game_code = game_code
if self.role_code:
if self.game_code:
self.get_roles()
self.players = []
@ -191,14 +191,14 @@ class Game:
except IndexError
async def get_roles(self, role_code=None):
if role_code:
self.role_code=role_code
async def get_roles(self, game_code=None):
if game_code:
self.game_code=game_code
if not self.role_code:
if not self.game_code:
return False
self.roles = await parse_code(self.role_code)
self.roles = await parse_code(self.game_code)
if not self.roles:
return False

@ -36,12 +36,12 @@ class Werewolf:
await ctx.send_help()
@ww.command()
async def join(self, ctx, role_code):
async def join(self, ctx, game_code):
"""
Joins a game of Werewolf or start a new one
"""
game = self._get_game(ctx.guild, role_code)
game = self._get_game(ctx.guild, game_code)
if not game:
ctx.send("Please provide a role code to get started!")
@ -76,11 +76,11 @@ class Werewolf:
if channel in (c for id,c in game.secret_channels.items()):
await game.vote(ctx.author, id, channel)
def _get_game(self, guild, role_code = None):
def _get_game(self, guild, game_code = None):
if guild.id not in self.games:
if not role_code:
if not game_code:
return None
self.games[guild.id] = Game(role_code)
self.games[guild.id] = Game(game_code)
return self.games[guild.id]

Loading…
Cancel
Save