diff --git a/cogs/messages.py b/cogs/messages.py index ac22747..52c361b 100644 --- a/cogs/messages.py +++ b/cogs/messages.py @@ -31,7 +31,18 @@ async def ask(self, ctx, *, msg=None): else: team_name = team['NAME'] team_id = team['ID'] - await self.channel.send(f'💬 **Message from {ctx.author.mention} of team `{team_name}` (Team ID: `{team_id}`)**\n**' + '\~' * 31 + f'**\n{msg}', allowed_mentions=AllowedMentions(everyone=False, users=[ctx.author], roles=False)) + await self.channel.send( + f'💬 **Message from {ctx.author.mention} of team `{team_name}` (Team ID: `{team_id}`):**\n' + + '**' + '\~' * 31 + f'**\n' + + msg, + allowed_mentions=AllowedMentions(everyone=False, users=[ctx.author], roles=False) + ) + await self.broadcast(team, + f'💬 **Message from {ctx.author.mention} to organizers:**\n' + + '**' + '\~' * 31 + f'**\n' + + msg, + ctx.author.id + ) await ctx.send(f'Message successfully delivered! The organizers will get back to you soon.') @organizer_channel() @@ -47,7 +58,7 @@ async def message(self, ctx, team_id=None, *, msg=None): else: await self.broadcast(team, '💬 **Message from organizers:**\n' + - '**' + '\~' * 31 + '**\n'+ + '**' + '\~' * 31 + '**\n' + msg ) await ctx.send(f'Message successfully delivered!') diff --git a/cogs/novice.py b/cogs/novice.py index 56b298d..5fee49e 100644 --- a/cogs/novice.py +++ b/cogs/novice.py @@ -55,6 +55,8 @@ async def submit(self, ctx, problem=None): elif not ctx.message.attachments: await ctx.send(f'You must upload a code file as an attachment!') else: + return await ctx.send(f'The submission deadline has passed!') + team_name = team['NAME'] team_id = team['ID'] submission_id = new_id() @@ -68,7 +70,7 @@ async def submit(self, ctx, problem=None): 'TEAM': team_id, 'USER': str(ctx.author.id), 'MESSAGE': str((await self.channel.send( - f'📝 **Submission for problem `{problem}` (Submission ID: `{submission_id}`)**\n' + + f'📝 **Submission for problem `{problem}` (Submission ID: `{submission_id}`):**\n' + '**' + '\~' * 31 + '**\n' + f'Team: `{team_name}`\n' + f'Team ID: `{team_id}`\n' + diff --git a/cogs/teams.py b/cogs/teams.py index fcea70d..419074d 100644 --- a/cogs/teams.py +++ b/cogs/teams.py @@ -85,6 +85,7 @@ async def leave(self, ctx): if not team: await ctx.send('You are not yet on a team!') else: + return await ctx.send('You cannot leave your team now!') users = team['USERS'].split('|') users.remove(str(ctx.author.id)) if len(users) > 0: diff --git a/cogs/tests.py b/cogs/tests.py index f169697..8a13468 100644 --- a/cogs/tests.py +++ b/cogs/tests.py @@ -14,7 +14,7 @@ async def test(self, ctx, problem=None, test=None): except: await ctx.send('You must choose a problem number to receive a test case for!') else: - problems = os.listdir('test') + problems = sorted(os.listdir('test')) if not 0 < problem <= len(problems): await ctx.send(f'Invalid problem number! Valid problem numbers range from 1 to {len(problems)}.') else: @@ -23,7 +23,7 @@ async def test(self, ctx, problem=None, test=None): except: await ctx.send('You must choose a test case number to receive!') else: - tests = os.listdir(f'test/{problems[problem - 1]}') + tests = sorted(os.listdir(f'test/{problems[problem - 1]}')) if not 0 <= test < len(tests): await ctx.send(f'Invalid test case number! Valid test case numbers range from 0 to {len(tests) - 1}.') else: diff --git a/test/05/4.txt b/test/05/4.txt index 56105eb..a3fefdc 100644 --- a/test/05/4.txt +++ b/test/05/4.txt @@ -1,3 +1,3 @@ -5 +2 4 3 2 1 \ No newline at end of file diff --git a/test/05/6.txt b/test/05/6.txt index f12a716..67cc1ab 100644 --- a/test/05/6.txt +++ b/test/05/6.txt @@ -3,7 +3,7 @@ Sophia 26 Olivia 12 Riley 48 Emma 19 -Ava 25 +Ava 25 Isabella 85 Aria 44 Aaliyah 72 diff --git a/test/10/3.txt b/test/10/3.txt index c0dbd9e..4257051 100644 --- a/test/10/3.txt +++ b/test/10/3.txt @@ -1,9 +1,3 @@ -8 -10 -76 -1 -695 -0 -43 -24 -103 \ No newline at end of file +1 +10 +1 2 3 4 5 6 7 8 9 10 \ No newline at end of file diff --git a/test/15/1.txt b/test/15/1.txt index 20b49da..12aeee6 100644 --- a/test/15/1.txt +++ b/test/15/1.txt @@ -1,4 +1,7 @@ -3 -1 1 --10 0 -5 -4 \ No newline at end of file +February 22 +5 +February 28 +February 21 +March 7 +March 7 +March 8 \ No newline at end of file diff --git a/test/15/3.txt b/test/15/3.txt index 7509087..e23a024 100644 --- a/test/15/3.txt +++ b/test/15/3.txt @@ -1,8 +1,5 @@ --10 -10 -6 --20 -20 --10 -10 -0 0 -10 10 -20 20 -30 30 \ No newline at end of file +March 1 +3 +February 28 +March 31 +April 1 \ No newline at end of file diff --git a/test/22/2.txt b/test/22/2.txt index 7473aa1..66beea9 100644 --- a/test/22/2.txt +++ b/test/22/2.txt @@ -1,4 +1,5 @@ 4 6 000000 000000 +000000 000000 \ No newline at end of file diff --git a/test/23/1.txt b/test/23/1.txt index 198766e..5643360 100644 --- a/test/23/1.txt +++ b/test/23/1.txt @@ -1,3 +1,3 @@ -3 2 +2 3 4 5 \ No newline at end of file diff --git a/test/24/4.txt b/test/24/4.txt index e045042..c1c0321 100644 --- a/test/24/4.txt +++ b/test/24/4.txt @@ -1,4 +1,4 @@ -12 +10 0 8 4 2 5 2 diff --git a/test/26/2.txt b/test/26/2.txt index b04b6ea..7732cdb 100644 --- a/test/26/2.txt +++ b/test/26/2.txt @@ -1,4 +1,4 @@ -100 3 +3 100 1 100 10000 \ No newline at end of file