Comments (28)
Yes, I agree. I'm going to study how to implement these features. MCDC 2.0.0 is coming 😂
from discord-mc-chat.
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
from discord-mc-chat.
ohhh nice! even better than i thought!
from discord-mc-chat.
from discord-mc-chat.
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: <t:1647937380:f>
note: you could also use realive time then from discord. <t:1647937380:R>
When using Relative time From Discord you have the Huge advatage of formatting, even thou you have less options what you can do.
✅ 7/6969 players online | 102 unique players ever joined | Server started<t:1647937380:R>.
from discord-mc-chat.
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. 🤔
from discord-mc-chat.
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.
from discord-mc-chat.
or just decide on one server to take the priority on status then... which would be easier
from discord-mc-chat.
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.
from discord-mc-chat.
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...
from discord-mc-chat.
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? 🤦♂️
from discord-mc-chat.
Communicate and modify by reading count and status. I understand your idea, thank you!
from discord-mc-chat.
Only unique players would be impossible using that approach. Then you need to define the master in the config of each server
from discord-mc-chat.
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. 😆
from discord-mc-chat.
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 281ff19 with reference to your demo image, as shown below.
from discord-mc-chat.
The new MCDC MultiServer is very powerful. I believe it will be feasible and convenient to implement the function of automatically updating channel topics.
from discord-mc-chat.
Server offline:
Server online with Multi Server disabled:
Server online with Multi Server enabled:
from discord-mc-chat.
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).
from discord-mc-chat.
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?
from discord-mc-chat.
{
"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...
from discord-mc-chat.
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.
from discord-mc-chat.
"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...
from discord-mc-chat.
"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?
from discord-mc-chat.
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
.
from discord-mc-chat.
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.
from discord-mc-chat.
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?
from discord-mc-chat.
Are you currently using the MultiServer feature of MCDC?
nope... but i can stuff out if you want.
from discord-mc-chat.
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.
from discord-mc-chat.
Related Issues (20)
- [Question] - Multiple Bots for Multiple Channels HOT 12
- [Bug] Discord -> Minecraft messages don't show up HOT 9
- [Bug] Minecraft player nicknames (display names) are used inconsistently in messages sent to Discord HOT 2
- TODO List
- [Bug] Delay between sending a message in minecraft and its appearance in the minecraft chat HOT 3
- [Enhancement] ChatImage Support HOT 6
- [Bug] Exception "Content may not be longer than 2000 characters" occurs in /stats command HOT 1
- [Question] How to customize messages sent from discord? HOT 2
- [Enhancement] Move documentation from blog to github
- [Support] 1/2 servers set up in multi server mode fails to send messages to discord and both fail to send messages to each other HOT 20
- [Bug] Incorrect Display of Server TPS HOT 1
- [Bug] Links containing multiple underscores are italicized (and cannot be opened correctly from Minecraft) HOT 1
- [Bug] broadcastPlayerCommandExecution and broadcastSlashCommandExecution not applying when set to false HOT 2
- [Bug] Commands are being broadcasted despite the config toggle being turned off HOT 2
- [Question] How to see in-game chat while using Discord MC Chat with Styled Chat HOT 10
- [Enhancement] Add Geyser Skin API for avatars HOT 1
- [Bug] Server crashes due to player deaths caused by falling blocks and intentional game design HOT 3
- [Question] How does the "channelTopicUpdateInterval" field work? HOT 7
- [Question] Custom command to restart my server doesn't seem to work. HOT 13
- [Enhancement] Separate formatChatMessages into 2 (or more?) settings. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord-mc-chat.