KarlOfDuty / SCPDiscord

A NWAPI plugin which adds remote interaction to an SCP:SL server through Discord.
https://karlofduty.com
GNU General Public License v3.0
14 stars 15 forks source link

don't wait for discord api initialise. #176

Closed TiBarification closed 4 weeks ago

TiBarification commented 2 months ago

no need to force server spam connection errors while we didn't fully connected to discord api

KarlOfDuty commented 2 months ago

I don't know if this is a great idea, many thing in the bot assume that the discord client is set up before starting to send messages.

I also don't understand exactly what the issue is? It takes less than a second for the bot to start, if I start both the bot and server at the same time I haven't ever seen any connection errors? And the plugin only tries to connect once every 5 seconds anyway, so it would only be one message.

TiBarification commented 2 months ago

I don't know if this is a great idea, many thing in the bot assume that the discord client is set up before starting to send messages.

I also don't understand exactly what the issue is? It takes less than a second for the bot to start, if I start both the bot and server at the same time I haven't ever seen any connection errors? And the plugin only tries to connect once every 5 seconds anyway, so it would only be one message.

For me I found if bot goes offline or didn't started for some reason , but connection with plugin established, plugin spamming its trying to connect when connection between plugin and discord bot is good, but discordapi wants to go away.

KarlOfDuty commented 2 months ago

Are you having connection issues to discord or what do you mean?

I think it is much more likely for discord to work properly than for the server to be up within the first few seconds as most would start the bot first and then the server.

TiBarification commented 2 months ago

Are you having connection issues to discord or what do you mean?

I think it is much more likely for discord to work properly than for the server to be up within the first few seconds as most would start the bot first and then the server.

I had issues with connection to Discord and that change fixes that for me.

KarlOfDuty commented 2 months ago

Can you describe your issues? Do you know what causes it? How long is your connection down for? Not being able to connect to discord doesn't seem like it should be a common issue.

I will have to do some testing on this branch, I don't know if accepting connections before the discord client is ready is safe.

KarlOfDuty commented 4 weeks ago

This change breaks message buffering.

When the bot cannot connect to discord on this branch: The plugin connects to the bot and all messages sent are discarded by the bot until a connection to discord is made.

When the bot cannot connect to discord on the main branch: The plugin will not be able to connect to the bot so it will not send the messages until the connection is resolved, keeping them in the queue.