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

[Survey] Large Server Survey Bug #75

Closed
HenrickTheBull opened this issue Aug 25, 2017 · 5 comments
Closed

[Survey] Large Server Survey Bug #75

HenrickTheBull opened this issue Aug 25, 2017 · 5 comments

Comments

@HenrickTheBull
Copy link

I am submitting a...

 [x] Bug report
 [ ] Feature request or improvement for an existing cog

Name of the cog in question:

Survey

Description of my issue/request:

Trying to send a survey to a server with almost 300 people. The bot just throws an exception

If it's a bug, steps to reproduce:

  1. Send command .startsurvey @shimin #surveys "How do you rate your current experience in Phantom? On a scale of 1 to 5. Just respond back to glitch with the number representing your experience." 1;2;3;4;5 8/29/2017 13:00 CST

  2. Watch as bot throws an error trying to PM 280 People

If it's a bug, a stack trace:

Exception in command 'startsurvey'
Traceback (most recent call last):
  File "lib/discord/ext/commands/core.py", line 50, in wrapped
    ret = yield from coro(*args, **kwargs)
  File "/root/glitch/Red-DiscordBot/cogs/survey.py", line 527, in _startsurvey
    await self._update_answers_message(server.id, new_survey_id)
  File "/root/glitch/Red-DiscordBot/cogs/survey.py", line 301, in _update_answers_message
    "{}\n{}".format("Awaiting answers from:", cf.box(waiting)))
  File "red.py", line 92, in send_message
    return await super().send_message(*args, **kwargs)
  File "lib/discord/client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "lib/discord/http.py", line 200, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: BAD REQUEST (status code: 400)

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

Traceback (most recent call last):
  File "lib/discord/ext/commands/bot.py", line 846, in process_commands
    yield from command.invoke(ctx)
  File "lib/discord/ext/commands/core.py", line 374, in invoke
    yield from injected(*ctx.args, **ctx.kwargs)
  File "lib/discord/ext/commands/core.py", line 54, in wrapped
    raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: BAD REQUEST (status code: 400)
@skeith
Copy link
Contributor

skeith commented Aug 25, 2017

Does anyone with the role @shimin received the DM survey?. I just tried it with my bot and it works.

Can you test with a role that has smaller number of users and see if the same error occurring?

@HenrickTheBull
Copy link
Author

I tested it with the Samuari which is a smaller role and it works fine. No one received the DM survey in the Shimin role.

@tmercswims
Copy link
Owner

tmercswims commented Aug 25, 2017

The error is actually originating from when the bot attempts to send a list of all the users who have yet to respond to the survey - since you asked so many people, the resulting list was more than 2000 characters long, so Discord rejected it. I hadn't thought of that situation, to be honest. I'll look into a solution when I'm able, probably this weekend.

@skeith
Copy link
Contributor

skeith commented Aug 28, 2017

I think it's better not to display the list when 2000 char limit is hit. Instead show a snippet like

Too many users to be displayed, do [p]survey waitlist <id> to get the list

@tmercswims
Copy link
Owner

Quick fixed for V2 in 79ca938. In V3 this will be handled differently, most likely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants