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

Add end command #32

Open
cameronshinn opened this issue Jul 30, 2020 · 5 comments
Open

Add end command #32

cameronshinn opened this issue Jul 30, 2020 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@cameronshinn
Copy link
Member

Add a command to end a match by the match's ID. There is now an endpoint to do this on the web side, so a corresponding method needs to be added into the ApiHelper as well as the command in the MatchCog. Should require admin permissions.

Calling the command should look like: q!end 123456

Open to other ideas on names for the command.

@cameronshinn cameronshinn added enhancement New feature or request good first issue Good for newcomers labels Jul 30, 2020
@thboss
Copy link
Member

thboss commented Aug 2, 2020

I already did that by change /end method to post here because endMatch function required to get inputs (ip & port of match id) from the bot

like this

@cameronshinn
Copy link
Member Author

Okay @thboss we'd have to change the endpoint to a POST request instead so we can give the match ID.

@thewickerman22
Copy link

q!end is not working throwing this error
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 83, in
wrapped
ret = await coro(args, **kwargs)
File "/home/sammy/ftp/files/bot/cogs/match.py", line 1032, in end
if await self.bot.api_helper.end_match(args[0]):
File "/home/sammy/ftp/files/bot/helpers/api.py", line 252, in end_match
resp_json = await resp.json()
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client_reqrep.py", line 1031, in js
on
headers=self.headers)
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpe
cted mimetype: text/html; charset=utf-8', url=URL('https://karma5v5.comnow.club/home%27)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/bot.py", line 892, in
invoke
await ctx.command.invoke(ctx)
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 797, in
invoke
await injected(ctx.args, **ctx.kwargs)
File "/usr/local/lib/python3.6/dist-packages/discord/ext/commands/core.py", line 92, in
wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ContentTypeEr
ror: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8
', url=URL('https://karma5v5.comnow.club/home%27)

@cameronshinn
Copy link
Member Author

@thewickerman22 the issue looks like somehow the endpoint to end the match is redirecting you to the home page, and the error is cause the homepage is returning an HTML response when a JSON is expected. I am not sure that the endpoint for the end command is working properly yet? The bot doesn't even have and end command right now, so I am assuming you are using @thboss's fork

@thewickerman22
Copy link

@thewickerman22 the issue looks like somehow the endpoint to end the match is redirecting you to the home page, and the error is cause the homepage is returning an HTML response when a JSON is expected. I am not sure that the endpoint for the end command is working properly yet? The bot doesn't even have and end command right now, so I am assuming you are using @thboss's fork
yes i m using his fork. before his latest update it was working fine. after his last update as well as update of the web panel broke something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants