string roles and other nonsense

pull/5/head
Bobloy 7 years ago
parent d206ea2cb9
commit 4d9ac39e82

@ -164,21 +164,21 @@ async def encode(roles, rand_roles):
if digit_sort:
out_code += "T"
for role in digit_sort:
out_code += role
out_code += str(role)
# werewolf sort
digit_sort = sorted(role for role in rand_roles if 10 < role <= 20)
if digit_sort:
out_code += "W"
for role in digit_sort:
out_code += role
out_code += str(role)
# neutral sort
digit_sort = sorted(role for role in rand_roles if 20 < role <= 30)
if digit_sort:
out_code += "N"
for role in digit_sort:
out_code += role
out_code += str(role)
return out_code
@ -242,7 +242,7 @@ def role_from_name(name: str):
for idx, role in enumerate(ROLE_LIST) if name in role.__name__]
def say_role_list(code_list):
def say_role_list(code_list, rand_roles):
roles = [ROLE_LIST[idx] for idx in code_list]
embed = discord.Embed(title="Currently selected roles")
role_dict = defaultdict(int)
@ -290,7 +290,7 @@ class GameBuilder:
except discord.NotFound:
pass
await ctx.send(embed=say_role_list(self.code))
await ctx.send(embed=say_role_list(self.code, self.rand_roles))
return await menu(ctx, pages, controls, message=message,
page=page, timeout=timeout)

@ -150,7 +150,7 @@ class Game:
"Grant Bot appropriate permissions or assign a game_channel")
return False
else:
self.save_perms[self.village_channel] = self.village_channel.overwrites()
self.save_perms[self.village_channel] = self.village_channel.overwrites
try:
await self.village_channel.edit(name="🔵Werewolf",
category=self.channel_category,
@ -790,6 +790,8 @@ class Game:
try:
await self.village_channel.edit(reason=reason, name="Werewolf")
for target, overwrites in self.save_perms[self.village_channel]:
await self.village_channel.set_permissions(target, overwrite=overwrites, reason=reason)
await self.village_channel.set_permissions(self.game_role, overwrite=None, reason=reason)
except (discord.HTTPException, discord.NotFound, discord.errors.NotFound):
pass

@ -387,4 +387,5 @@ class Werewolf:
await ctx.send("Log Channel is invalid")
return False, None, None, None, None
return True, role, category, channel, log_channel
return True, role, category, channel, log_channel

Loading…
Cancel
Save