Introduction
Having to analyze which members are active can be a long and tedious job. That's why I created a script that detects members that are not contributing enough. In this post it'll be explained how it was made. If you don't care about that, you can use the tool online here.
Development process
First we need to get the data that we can see in the Members tab of the guild. I'll be using as an example the guild Immortal Gods just because they are better than me.
Fetching the data
So... how to get that data? Most modern browsers have a Network tab in the Developer Tools. There you have to look which request gets the members data.
We can see in the image that an array with all the members data can be get with the a request to https://api2.splinterlands.com/guilds/members. However, we need to give the guild_id as a query parameter. So we can make the same process in the guilds tab in order to get the guilds list and filter by name.
Defining a kick criterion
Now that we have the data we need to define a formula that enables us to evaluate if a member contributed enough.
The formula to date (I'm sure that it will need tuning) is:
mj < (cd/ed + cq/eq) * help
where:
- mj = "months since the member joined"
- cd = "all time contributed DEC"
- cq = "all time constributed quests"
- ed = "expected DEC per month"
- eq = "expected quests per month"
- help = "multiplier that goes between 1 and 6 depending on the member league (can be disabled)"
The logic behind it is that the ideal member contributes the expected DEC or quests per month. But for diverse guilds that's not enough. We can't expect a champion and a novice to contribute the same. That's what the help is for. It is 1 when the member is in CHAMPION I and gets bigger the lower the member league.
Let's look at Immortal Gods. They, without the help enabled, would have to kick 15 more members with the parameters that were chosen:
Considering league | Not considering league |
---|---|
![]() | ![]() |
If you want to make your own criterion you can clone my repository and modify the function contributedEnough.
Implementation
This is not a programming tutorial, so how the HTML file is structured and what each JavaScript function does won't be discussed. However, the script isn't complicated. The basic idea is that we get the parameters for the formula from the inputs, fetch the data and get the members that are currently in the guild and don't contribute enough. It gets messy with the error handling and promises but the core idea is that.
Summary
In this post the Splinterlands Guild Kicker tool was presented. Hope someone finds it useful and that the little steps that were explained can help a programmer that never did a project involving fetching data and doing minor processing with the task.
Interesting tool! I have bumped it onto the SPT trending page so people get aware of it. Keep creating 3rd party tools for Splinterlands!
Congratulations @garuflax! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :
Your next target is to reach 50 upvotes.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out the last post from @hivebuzz:
Congratulations @garuflax! You received a personal badge!
You can view your badges on your board and compare yourself to others in the Ranking