Skip to content

Commit

Permalink
add @reopening
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevnkkm committed Dec 27, 2024
1 parent 3079eaf commit a3dca5e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cogs/mogi/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async def apply(self, ctx: MogiApplicationContext):
ctx.mogi.finish()
for player in ctx.mogi.players:
await (await ctx.guild.fetch_member(player.discord_id)).remove_roles(
ctx.inmogi_role
ctx.inmogi_role, ctx.reopening_role
)
mogi_manager.destroy_mogi(ctx.channel.id)
return await ctx.respond("# This channel's Mogi is finished and closed.")
Expand Down
2 changes: 1 addition & 1 deletion cogs/mogi/mogi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def close(self, ctx: MogiApplicationContext):
if await confirmation(ctx, close_confirm_message):
for player in ctx.mogi.players:
await (await ctx.guild.fetch_member(player.discord_id)).remove_roles(
ctx.inmogi_role
ctx.inmogi_role, ctx.reopening_role
)

mogi_manager.destroy_mogi(ctx.mogi.channel_id)
Expand Down
4 changes: 2 additions & 2 deletions cogs/mogi/participation.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def join(self, ctx: MogiApplicationContext):
)

ctx.mogi.players.append(player)
await ctx.user.add_roles(ctx.inmogi_role)
await ctx.user.add_roles(ctx.inmogi_role, ctx.reopening_role)
await ctx.respond(
f"{ctx.author.mention} has joined the mogi!\n{len(ctx.mogi.players)} players are in!"
)
Expand All @@ -81,7 +81,7 @@ async def leave(self, ctx: MogiApplicationContext):
for player in ctx.mogi.players
if player.discord_id != ctx.author.id
]
await ctx.user.remove_roles(ctx.inmogi_role)
await ctx.user.remove_roles(ctx.inmogi_role, ctx.reopening_role)

if self.last_join.get(str(ctx.author.id), None):
if time.time() - self.last_join[str(ctx.author.id)] < 5:
Expand Down
1 change: 1 addition & 0 deletions models/CustomMogiContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, *args, **kwargs):

self.main_guild: discord.Guild = get(self.bot.guilds, id=GUILD_IDS[0])
self.inmogi_role: discord.Role = get(self.main_guild.roles, name="InMogi")
self.reopening_role: discord.Role = get(self.main_guild.roles, name="Reopening")

self.register_channel: discord.TextChannel = get(
self.main_guild.text_channels, id=REGISTER_CHANNEL_ID
Expand Down

0 comments on commit a3dca5e

Please sign in to comment.