Closed SaiCode-DEV closed 2 years ago
Perhaps on shutdown it would be nice to change the status to
❌ Server offline | Last updated: 22.03.2022 9:22
Of course the local timestamp might be difficult for everyone, but Relative time stamps might help:
https://hammertime.djdavid98.art/en-GB
❌ Server offline | Last updated:
note: you could also use realive time then from discord.
When using Relative time From Discord you have the Huge advatage of formatting, even thou you have less options what you can do.
:white_check_mark: 7/6969 players online | 102 unique players ever joined | Server started
This is a good suggestion, but my server is a multi server of SMP+CMP. In this case, two MCDCs cannot use channel topic at the same time. 🤔
This is a good suggestion, but my server is a multi server of SMP+CMP. In this case, two MCDCs cannot use channel topic at the same time. 🤔
Technically you could go make a sum of both servers to get the players, and for the uptime use both.
Furthermore you could just create a menu which can be accessed via a /status in discord, and let that plugin pop up.
That were the assets i used: https://share.discohook.app/go/57kn8p8i The Coloring depending on server state would be a great touch.
or just decide on one server to take the priority on status then... which would be easier
OK. Also I would like to ask your opinion on applying embedded message to every broadcast messages of MCDC? Because the implementation of that is much more complicated than normal messages.
Embedding everyting is kinda unescessary due to the webhook Styling being already quite nice.
of course you could go overkill on enverything, but it is totally fine.
(https://minecraft-archive.fandom.com/wiki/Achievements) - taking the pic of every achievement and putting it into an nice looking embed might look nice, but is a lot of work...
Yes, I agree. I'm going to study how to implement these features. MCDC 2.0.0 is coming 😂
Technically you could go make a sum of both servers to get the players, and for the uptime use both.
Since bots cannot send private messages to each other (limit from Discord's side), I think it is difficult to communicate between servers without using an external server. 🤔
And because of that, the implementation of the entire multi server feature becomes complicated... 😢
Any suggestions or solutions you can think of to communicate between servers? 🤦♂️
Sure... You can either just let the user Decide while configuring the servers, by adding IsMaster=true/false. If he is the master he will also change such stuff.
Another approach ist to let each server listen and write shortly afterwards.
Example: server starts: isStatus == ❌ Server offline? -> yes therefore he is now the Master and stores it in a variable changes server to online, and status to: ✅ 0/6969 players online
then a sub server starts: isStatus == ❌ Server offline? -> false, therefore not the master hence there are no players on, he ignores the counter.
Player Joins:
get Status: in case there was an main server issue/crash check isStatus == ❌ Server offline? -> takes over the Mein server role
in case ✅ #/6969 players online -> get the # by splitting cutting from the string "✅ " and "/6969 players online" -> # is toInt(beforePlayerCount) -> beforePlayerCount = newplayercount+1 -> set status to ✅ "newplayercount"/6969 players online
That is not a perfect solution, but it might work. The advantage: no additional varialbes needed. Problem: when 2 servers edit it at the same time (unlikely, except when hopping from one to another server, but then you might be able to sort it out via a 2 sek delay) the event might occur to display the wrong player count.
But i would prefer to have a wrong player count over having none.
When Leaving a server its the same like joining, just removing one and checking if it goes into negative, it shouls just change to 0 -> correcting errors automatically when noone plays any more
if you can't understand my thoughts i am happy to draw it out for better understanding
Communicate and modify by reading count and status. I understand your idea, thank you!
Only unique players would be impossible using that approach. Then you need to define the master in the config of each server
For players online I can add and subtract the counter sequentially when a player join and leave the server.
For unique players, I might be able to use the count of stats files (uuid.json) in the world folder to count how many players and exclude duplicate uuids. In this case, as long as the server's onlineMode is on, the uuid can match and be excluded. 😆
Furthermore you could just create a menu which can be accessed via a /status in discord, and let that plugin pop up.
That were the assets i used: https://share.discohook.app/go/57kn8p8i The Coloring depending on server state would be a great touch.
Hello!
For this, I think it is unrealistic. Discord Bot does not seem to have a way to reply when the server (bot) is offline.
Moreover, I think the /info
command of the latest version of MCDC can replace this /status
command, only differing the lack of offline server status. Displaying status for offline servers will add complex code to MCDC's MultiServer feature. The existing way of distinguishing servers by bot nicknames for /info
command messages will no longer work.
Btw, I added the display of max player count to the info command message in 281ff191630724de2a5e7ac057398d794d4bae94 with reference to your demo image, as shown below.
The new MCDC MultiServer is very powerful. I believe it will be feasible and convenient to implement the function of automatically updating channel topics.
Server offline:
Server online with Multi Server disabled:
Server online with Multi Server enabled:
ohhh nice! even better than i thought!
Updating the channel topic when a player joins or leaves is impossible to implement, as this would exceed the rate limit of Discord (Code 429).
429 responses are avoided by inspecting the rate limit headers documented above and by not making requests on exhausted buckets until after they have reset. 429 errors returned with
X-RateLimit-Scope: shared
are not counted against you.
Nor sure, but the rate limit of 10,000 requests per 10 minutes isn't enought? or just update it every minute 1-2 times?
{ "message": "You are being rate limited.", "retry_after": 64.57, "global": true }
if it fails you might be able to schedule it in (retry_after) seconds...
It seems like the rate limit of changing the name/topic of a channel or creating/deleting a channel is different from the normal one?
In my testing, I set the interval to 5 minutes but it still returned the exceed message and failed to update randomly (sometimes success but sometimes fail). All Retry-Later
are between 1 and 10 minutes, so I don't think schedule it again is a good option.
I had a look at the source code of DiscordSRV. They set the interval to at least 10 minutes.
"the allowed amount of requests to change the channel description is two requests in 10 minutes"
so every 5 minutes and 10 sekonds it is?
only issue is with stopping the server.... can you try changing 2 after a short time? because then you couls "save" it...
"the allowed amount of requests to change the channel description is two requests in 10 minutes"
Ah, that explains everything.
can you try changing 2 after a short time? because then you couls "save" it...
What does this mean?
After testing, I think it's best to set it to update every 10 minutes and no immediate update when players join and leave the server. Setting it to less than 10 minutes is more likely to encounter code 429 when restarting the server or using the /reload
command.
Also, I found that JDA will automatically re-execute at the time of Retry-After
after a failure. So encountering code 429 while the server is running is fine because JDA will automatically fix it after a while.
As for stopping the server, I added code that waits for the channel topic of "server offline" to set successfully. The server will wait until JDA has successfully set the channel topic before stopping the process. If you don't like it, stop the process immediately with Ctrl+C
.
What does this mean?
If you just changed the channel topic and shutdown the server shortly after, check if the topic changes anyway... or if you cant do it due to rate limits.
After testing, I think it's best to set it to update every 10 minutes and no immediate update when players join and leave the server. Setting it to less than 10 minutes is more likely to encounter code 429 when restarting the server or using the
/reload
command.Also, I found that JDA will automatically re-execute at the time of
Retry-After
after a failure. So encountering code 429 while the server is running is fine because JDA will automatically fix it after a while.As for stopping the server, I added code that waits for the channel topic of "server offline" to set successfully. The server will wait until JDA has successfully set the channel topic before stopping the process. If you don't like it, stop the process immediately with
Ctrl+C
.
I have solved all rate limit related issues perfectly using the method mentioned in my last comment.
Are you currently using the MultiServer feature of MCDC?
Are you currently using the MultiServer feature of MCDC?
nope... but i can stuff out if you want.
I will release 2.0.0-alpha.2 once this feature is complete for MultiServer use and I will not fix any enhancements for now.
Okay. Sounds nice. I sadly can't test stuff for you until Tuesday, but definitely a good plan. On 15 Apr 2022, 18:49 +0200, Jason Xu @.***>, wrote:
I will release 2.0.0-alpha.2 once this feature is complete for MultiServer use and I will not fix any enhancements for now. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Could you please add the option to change the channel theme depending on server Staus, Player Count, uptime and similar stuff?
:white_check_mark: 5/6969 players online | 102 unique players ever joined | Server online for 30 minutes
For the Relative time i suggest this or sth similar: https://v8.dev/features/intl-relativetimeformat
It might be a good idea to also enable custom user interval ( every 5 minutes would be totally fine), as well as using a player Join event as a update trigger to keep the player count up2date.
It might be also nice to integrate rich presence then:
:white_check_mark: %playerCount%/%maxPlayers% players online | %uniquePlayers% unique players ever joined | Server online for %uptime%