Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify #101

Merged
merged 5 commits into from
Aug 11, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
krofna committed Aug 11, 2019
commit b444b1726f30aebe1c2d918295f27bb6d2c5c5da
11 changes: 5 additions & 6 deletions tle/cogs/handles.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _make_pages(users):
class Handles(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.identify_map = dict()
self.identify_map = {}

@commands.group(brief='Commands that have to do with handles', invoke_without_command=True)
async def handle(self, ctx):
Expand Down Expand Up @@ -177,9 +177,8 @@ async def identify(self, ctx, handle: str):

invoker = str(ctx.author)
problem = random.choice(cf_common.cache2.problem_cache.problems)
handle, name, url = (users[0].handle, problem.name, problem.url)
self.identify_map[invoker] = (handle, name, url)
await ctx.send(f'`{invoker}`, submit a compile error to <{url}> and then run `;handle report`')
self.identify_map[invoker] = (users[0].handle, problem.name)
await ctx.send(f'`{invoker}`, submit a compile error to <{problem.url}> and then run `;handle report`')

@handle.command(brief='Report identification')
async def report(self, ctx):
Expand All @@ -188,10 +187,10 @@ async def report(self, ctx):
await ctx.send(f'`{invoker}`, you have nothing to report')
return

handle, prob, url = self.identify_map[invoker]
handle, prob = self.identify_map[invoker]
subs = await cf.user.status(handle=handle, count=5)
if any(sub.problem.name == prob and sub.verdict == 'COMPILATION_ERROR' for sub in subs):
self.identify_map.pop(invoker)
del self.identify_map[invoker]
users = await cf.user.info(handles=[handle])
await self._set(ctx, ctx.author, users[0])
else:
Expand Down