Skip to content

Commit

Permalink
Merge pull request #74 from murpii/pr_mt_2_votes_before_fully_evaluated
Browse files Browse the repository at this point in the history
MT: Require 2 Ready's/Votes for a map to be fully evaluated and ready to be released
  • Loading branch information
def- authored Jan 18, 2024
2 parents 66038a8 + 8b24078 commit 5a8f62d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions cogs/map_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def is_testing(channel: discord.TextChannel) -> bool:
return isinstance(channel, discord.TextChannel) and channel.category_id in (CAT_MAP_TESTING, CAT_WAITING_MAPPER, CAT_EVALUATED_MAPS)

def is_staff(member: discord.Member) -> bool:
return any(r.id in (ROLE_ADMIN, ROLE_TESTER) for r in member.roles)
return any(r.id in (ROLE_ADMIN, ROLE_TESTER, ROLE_TRIAL_TESTER) for r in member.roles)

def by_releases_webhook(message: discord.Message) -> bool:
return message.webhook_id == WH_MAP_RELEASES
Expand Down Expand Up @@ -460,7 +460,13 @@ async def waiting(self, ctx: commands.Context):
async def ready(self, ctx: commands.Context):
"""Ready a map"""
map_channel = self.get_map_channel(ctx.channel.id)
await map_channel.set_state(state=MapState.READY)

if map_channel.state == MapState.RC:
await map_channel.set_state(state=MapState.READY)
await ctx.reply('The map is now ready to be released!')
else:
await ctx.reply('First ready set. It needs to be tested again by a different tester before fully evaluated.')
await map_channel.set_state(state=MapState.RC)

@commands.command()
@tester_check()
Expand Down
6 changes: 4 additions & 2 deletions cogs/map_testing/map_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

class MapState(enum.Enum):
TESTING = ''
RC = '☑️'
WAITING = '💤'
READY = '✅'
DECLINED = '❌'
Expand Down Expand Up @@ -95,6 +96,8 @@ async def set_state(self, *, state: MapState):
self.state = state
if state is MapState.TESTING:
category_id = CAT_MAP_TESTING
elif state is MapState.RC:
category_id = CAT_MAP_TESTING
elif state is MapState.WAITING:
category_id = CAT_WAITING_MAPPER
else:
Expand All @@ -115,10 +118,9 @@ async def from_submission(cls, isubm: InitialSubmission, **options):
self.server = isubm.server
self.state = MapState.TESTING
self.mapper_mentions = isubm.author.mention
logging.info(f"Topic: {self.topic}")
self._channel = await isubm.channel.category.create_text_channel(str(self), topic=self.topic, **options)

# Workaround for Discord API issue
await asyncio.sleep(2)
# await asyncio.sleep(2)
await self._channel.edit(topic=self.topic)
return self

0 comments on commit 5a8f62d

Please sign in to comment.