I'm developing a command for my discord bot to keep track of ranked wars, and I want it to be able to see how many hits have been made in a ranked war. I don't see anything in the API response for ranked wars, and I'm not sure if this is possible. If anyone knows how I could do this, help would be appreciated.
Ranked war hits
Started by Warriordud [3177526] on in API Development.
About this thread
Posts archived: 12 / 12 posts (100%) · the total is Torn's reply count + the opening post at the last fetch
Counted by TornLife from the archived posts.
- Archived posts
- 12
- Discussion span
- →
- People posting
- 5
- Likes on archived posts
- 1
- Authority score
- 52 / 100
- Historical score
- 19 / 100
- Story score
- 29 / 100
- Engagement score
- 54 / 100
/faction/attacks returns ranked_war: 1
https://api.torn.com/faction/?selections=attacks&key=
You'll need to develop something to programmatically grab the attacks using the from and to parameters because (iirc) each call will only give you the first 100 attack logs in that period.
except i have no way of storing that data, i'm using a free bot hosting service (botghost)
You could defer the response to the slash command and perform the API calls on-demand though?
but if it only stores the last 100 attacks, any ranked war over 100 attacks (most of them) would stop working properly
Would recommend you to learn how to code the bot yourself and use free hosting on Render, Vercel etc where you can save to file. Gives you a lot more freedom to do what you want.
Sign up with a virtual card (Revolut, Monese, Privacy etc) and delete it to be sure you'll never have to pay a penny.
Worst case - you can store the attacks in a variable and have a way to reset / wipe it. Wouldn't recommend it for multiple reasons, but it would work for what you are trying to do.
Yeah the API returns the 100 most recent attacks. Just query and store all the attacks since the RW started on the heap when the command is run.
not possible due to limitations with the free bot provider we use
Its better to pull this information after the war. You dont need to track each attack individually, just rhe hit count at the end of the report.
Why not? Storing attack IDs in a hashset would require almost no memory (relatively). You could store the attack IDs from a 100k chain in less than 5 megabytes of memory in C++ iirc.
the idea behind it was to make it average out the respect per hit to give a rough estimate of how many more hits would be needed to finish the war