Dinnerbone / mcstatus

A Python class for checking the status of an enabled Minecraft server
http://dinnerbone.com/minecraft/tools/status/
1.11k stars 146 forks source link

minecrafBedrockServer failing to connect to a server #188

Closed KarsonTheFoxx closed 2 years ago

KarsonTheFoxx commented 2 years ago

While making a discord bot that has a feature that displays the current ping and number of players on the server it keeps returning a TimeoutError despite me being able to join the server myself. ive checked the ip and port multiple times and have tried both entering the server information as minecraftBedrockServer(ip=ip, port=port) and minecraftBedrockServer("{0}:{1}".format(ip, port))

if you're wondering heres my code

try:
  mcServer = MinecraftServer(f"{server['ip']}:{server['port']}")
  status = mcServer.status()
  emb2 = discord.Embed(title="Server status", description="current status of the server", color=discord.Colr.green())
  emb2.add_field(name="players online", value="{0}/{1}".format(status.players_online, status.players_max))
  emb2.add_field(name="replied in", value="{0}MS".format(round(status.ping()*100, 1)))
except TimeoutError:
  emb2 = discord.Embed(title="Servers offline", description="no data available", color=discord.Color.red())
Iapetus-11 commented 2 years ago

This is most likely due to a network issue or misconfiguration. Check port forwarding or your firewall(s), you've probably done something weird there. Also, MinecraftBedrockServer does take the host and port as separate arguments, not a single string.

kevinkjt2000 commented 2 years ago

The example code is showing MinecraftServer instead of MinecraftBedrockServer. There's a note about trying minecraftBedrockServer(ip=ip, port=port), but that casing is incorrect.

Have you tried running this code without the overhead of a discord bot? I would verify that the machine running the discord bot is capable of a simplified script first, then layer in the complexities of the discord bot.

Probably there's a firewall issue somewhere along the way.

kevinkjt2000 commented 2 years ago

Closing, as there has been no response for a while on this.

KarsonTheFoxx commented 2 years ago

Thank you, i have tried both ways of entering the port and ip however neither have worked. On another note i have used this with a discord bot in the past... is is possible that the hosting platform is reusing a connection? They have their own api i believe.

On Tue., Jan. 11, 2022, 10:28 a.m. Kevin Tindall, @.***> wrote:

The example code is showing MinecraftServer instead of MinecraftBedrockServer. There's a note about trying minecraftBedrockServer(ip=ip, port=port), but that casing is incorrect.

Have you tried running this code without the overhead of a discord bot? I would verify that the machine running the discord bot is capable of a simplified script first, then layer in the complexities of the discord bot.

— Reply to this email directly, view it on GitHub https://github.com/Dinnerbone/mcstatus/issues/188#issuecomment-1010194237, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW2UYZYQH4WUI4DZ7UM2VBLUVRSDXANCNFSM5LRESQ3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

KarsonTheFoxx commented 2 years ago

Sorry, this went to my spam folder.

On Tue., Feb. 22, 2022, 9:59 a.m. Cole Payne-sexton, < @.***> wrote:

Thank you, i have tried both ways of entering the port and ip however neither have worked. On another note i have used this with a discord bot in the past... is is possible that the hosting platform is reusing a connection? They have their own api i believe.

On Tue., Jan. 11, 2022, 10:28 a.m. Kevin Tindall, < @.***> wrote:

The example code is showing MinecraftServer instead of MinecraftBedrockServer. There's a note about trying minecraftBedrockServer(ip=ip, port=port), but that casing is incorrect.

Have you tried running this code without the overhead of a discord bot? I would verify that the machine running the discord bot is capable of a simplified script first, then layer in the complexities of the discord bot.

— Reply to this email directly, view it on GitHub https://github.com/Dinnerbone/mcstatus/issues/188#issuecomment-1010194237, or unsubscribe https://github.com/notifications/unsubscribe-auth/AW2UYZYQH4WUI4DZ7UM2VBLUVRSDXANCNFSM5LRESQ3A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>