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

squadron['sessionMessage'].content exceeding 2000 characters after ~30 games, thus rejected by Discord, resulting in error stopping execution. #1

Open
GettingWhiter opened this issue Jul 17, 2023 · 5 comments
Assignees

Comments

@GettingWhiter
Copy link
Owner

'Hybrid command raised an error: Command 'tracker' raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In content: Must be 2000 or fewer in length.'

Find a way to request a simpler page from the WT website.

@GettingWhiter GettingWhiter self-assigned this Jul 17, 2023
@MikeSorokin
Copy link

MikeSorokin commented Jul 18, 2023

@GettingWhiter it looks more like Discord API error.
There is a way to fix it: stop updating message every 10 games and create a new one. Yes, we'll get more messages in log channel, but it is still acceptable

@MikeSorokin
Copy link

Next time would be a good idea to add log file to an issue: it helps in finding real problem.

@GettingWhiter GettingWhiter changed the title Content scraped can on rare occasions be too large? squadron['sessionMessage'].content exceeding 2000 characters after ~30 games, thus rejected by Discord, resulting in error stopping execution. Jul 18, 2023
@GettingWhiter
Copy link
Owner Author

Yep, you're right - message got too long to post in discord.

This was ~1995 characters, the limit is 2000, so when the bot tried to add the next line, the message was rejected:
block1

This is what it would look like broken into blocks of 10, which would never approach the limit:
block10

Blocks of 20 would work, using about 1300 chars:
block20

We could also go for multiples of three (9, 12, 15, 18, 21, 24, 27) to somewhat align with rotations, but that is unnecessary.

@MikeSorokin
Copy link

20 would be enough. Also we can add opponent's squadron tag to sync it with hand-written logs.

@GettingWhiter
Copy link
Owner Author

That isn't as simple as it sounds, I wish we could do that in a reasonably straightforward manner but the bot determines wins/losses by counting the number of players who have gained/lost points on the monitored squadron's page (https://warthunder.com/en/community/claninfo/Try%20Hard%20Coalition), which Gaijin only updates every three to five minutes, as far as I can tell.

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

No branches or pull requests

2 participants