warera-goBy https://app.warera.io/user/6aa7ad06d91c79361d0b0673
Hello everyone,
Like many of you, I’ve spent plenty of time using and admiring existing community tools. They are very cool and make it easy to plan and decide on what to do here. From build optimisers to economic overview.
Naturally, as someone who likes to tinker and code, I wanted to try building a few small tools and automated scripts of my own. But when I sat down to write them in Go (my language of choice), I quickly ran into a stumbling block: There was no Go SDK for the WarEra API.
So I wrote one myself. Once it came together and started working smoothly for my own experiments, I decided to clean it up and open-source it. If you write Go or like to tinker with scripts, hopefully this saves you the trouble of reinventing the wheel.
It’s called warera-go, and it’s a simple, lightweight Go library that wraps WarEra’s API.
This isn’t trying to reinvent the wheel or compete with big platforms like Arcana. It’s simply a straightforward toolkit for anyone who enjoys writing a bit of Go code and wants direct access to game data without having to manually construct HTTP requests and JSON parsers every time. But it can be used to build some great tools!
I tried to keep it as simple and dependency-free as possible (it uses only Go's standard library).
For instance, checking the top buy and sell orders for ammo is just a few lines:
package main
import (
"context"
"fmt"
"github.com/onprem/warera-go"
)
func main() {
client := warera.NewClient()
defer client.Close()
orders, _ := client.Trading.GetTopOrders(context.Background(), "ammo", 5)
if buy := orders.BestBuy(); buy != nil {
fmt.Printf("Top Buy: %.3f G (%d units)\n", buy.Price, buy.Quantity)
}
if sell := orders.BestSell(); sell != nil {
fmt.Printf("Top Sell: %.3f G (%d units)\n", sell.Price, sell.Quantity)
}}
Or seeing the live timer and damage on an active battle:
live, _ := client.Battles.GetLiveBattleData(ctx, battleID, roundNumber)fmt.Printf("Next tick: %s | Attacker: %d dmg | Defender: %d dmg\n",
live.Round.NextTickAt, live.Round.AttackerDamages, live.Round.DefenderDamages)
Behind the scenes, if you make multiple calls concurrently (like fetching 10 player profiles), it automatically groups them into single batched requests so it's gentle on the game servers.
If you like writing Go or have an idea for a simple script, bot, or spreadsheet helper for your country or MU, feel free to use it:
- GitHub Repository: https://github.com/onprem/warera-go
- Install command: go get github.com/onprem/warera-go
I’ve also included a few small runnable scripts in the repository’s examples/ folder showing basic workflows for traders, soldiers, and unit commanders.
It’s just a personal project, so if you spot any bugs, have ideas, or want to contribute, feel free to open an issue on GitHub or drop a message here.
Hope someone finds it useful, and see you on the battlefield! ⚔️