Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.mcping broke after MC 1.9 was released - Broken in 1.0.8 and 1.0.9 CloudBot #224

Open
astrutt opened this issue Mar 15, 2016 · 14 comments
Open

Comments

@astrutt
Copy link

astrutt commented Mar 15, 2016

.mcping and .mcstatus worked great for a long time. After MC 1.9 was released, Cloutbot 1.0.8 .mcping is broken. We've since update CloudBot to 1.0.9, and the issue still remains. Invalid Hostname. On irc it fails silently, no response, that behavior is broken too, it should report some sort of error, vs. silently failing to IRC.

Testing with mc.scuttled.net and brain.ratman.org , both are valid hostnames, and currently operating 1.9 Minecraft Servers. mc.scuttled.net is public, and brain.ratman.org has a whitelist.

Logs from the Cloudbot Console:

[16:34:18] [INFO] [JARVIS:#minecraft] .mcping brain.ratman.org
[16:34:18] [ERROR] Error in hook minecraft_ping:mcping
Traceback (most recent call last):
File "/home/jarvis/CloudBot/cloudbot/plugin.py", line 376, in _execute_hook
out = yield from self.bot.loop.run_in_executor(None, self._execute_hook_threaded, hook, event)
File "/usr/lib64/python3.4/asyncio/futures.py", line 386, in iter
yield self # This tells Task to wait for completion.
File "/usr/lib64/python3.4/asyncio/tasks.py", line 287, in _wakeup
value = future.result()
File "/usr/lib64/python3.4/asyncio/futures.py", line 275, in result
raise self._exception
File "/usr/lib64/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(_self.args, *_self.kwargs)
File "/home/jarvis/CloudBot/cloudbot/plugin.py", line 340, in _execute_hook_threaded
return hook.function(*parameters)
File "/home/jarvis/CloudBot/plugins/minecraft_ping.py", line 30, in mcping
s = server.status()
File "/home/jarvis/CloudBot/venv/lib/python3.4/site-packages/mcstatus/server.py", line 77, in status
raise exception
File "/home/jarvis/CloudBot/venv/lib/python3.4/site-packages/mcstatus/server.py", line 61, in status
result = pinger.read_status()
File "/home/jarvis/CloudBot/venv/lib/python3.4/site-packages/mcstatus/pinger.py", line 44, in read_status
return PingResponse(raw)
File "/home/jarvis/CloudBot/venv/lib/python3.4/site-packages/mcstatus/pinger.py", line 143, in init
self.description_clean = re.sub(r'\u00A7.', '', raw["description"])
File "/home/jarvis/CloudBot/venv/lib64/python3.4/re.py", line 179, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or buffer

Please Advise!

Thanks!

@astrutt
Copy link
Author

astrutt commented Mar 18, 2016

Apparently, what changed is now the response from MC 1.9 servers is formatted in JSON, and the .mcping module breaks on the description field.

Still works fine for MC 1.8 servers, old format, but new format is in JSON for MC 1.9+ servers.

.mcping mc.eldercraft.de
[13:46:43] <+CloudBot> (requesting nick) Wirtschafts-Server mit RPG und klarem Konzept | SKY-Server | Minigames | Creative | Community von 8 - 66 Jahren | Aktive Admins - BungeeCord 1.8 - 256.4ms - 160/777 players

.mcping battlecraft.minecraft.to
[13:47:09] <+CloudBot> (requesting nick) [Battle: PvP | Skyblock | GTA :Craft] Ts3: tsbattlecraft.minecraft.to - BungeeCord 1.8 - 239.3ms - 274/400 players

@dmptrluke
Copy link
Member

GOD DAMN IT, MOJANG

On Sat, Mar 19, 2016 at 5:16 AM, Andrew Strutt [email protected]
wrote:

Apparently, what changed is now the response from MC 1.9 servers is
formatted in JSON, and the .mcping module breaks on the description field.

Still works fine for MC 1.8 servers, old format, but new format is in JSON
for MC 1.9+ servers.

.mcping mc.eldercraft.de
[13:46:43] <+CloudBot> (requesting nick) Wirtschafts-Server mit RPG und
klarem Konzept | SKY-Server | Minigames | Creative | Community von 8 - 66
Jahren | Aktive Admins - BungeeCord 1.8 - 256.4ms - 160/777 players

.mcping battlecraft.minecraft.to
[13:47:09] <+CloudBot> (requesting nick) [Battle: PvP | Skyblock | GTA
:Craft] Ts3: tsbattlecraft.minecraft.to - BungeeCord 1.8 - 239.3ms -
274/400 players


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#224 (comment)

@ctian1
Copy link
Contributor

ctian1 commented May 28, 2016

It's a problem with the mcstatus library.

@astrutt
Copy link
Author

astrutt commented Apr 27, 2017

No one can fix this?

@daboross
Copy link
Contributor

This is definitely fixable, but would require someone with knowledge of the minecraft json chat format to make the fix, and no one has done it yet.

@ctian1
Copy link
Contributor

ctian1 commented May 2, 2017

I might try to fix it later if people still want the feature.

@astrutt
Copy link
Author

astrutt commented May 2, 2017 via email

@edwardslabs
Copy link
Member

I took a look at this and fixed it. I don't have write access to the CloudBotIRC/mcstatus repo but I will put in a PR later.

For an emergency patch you can replace the contents of
/usr/local/lib/python3.4/dist-packages/mcstatus/pinger.py with
https://gist.github.com/edwardslabs/24695b3183dea7db12488c4c2eaecbb5

After restarting the bot you should be set.

@astrutt
Copy link
Author

astrutt commented May 2, 2017 via email

@astrutt
Copy link
Author

astrutt commented May 3, 2017 via email

@edwardslabs
Copy link
Member

It's already been done. CloudBotIRC/mcstatus#2

@astrutt
Copy link
Author

astrutt commented May 3, 2017 via email

@astrutt
Copy link
Author

astrutt commented May 31, 2017

Still didn't get pulled in, strange.

.rekt get's merged and that spreads malware, but this long standing bug can't seem to get fixed?

This project's priorities seem to be lost in the ether...

@daboross
Copy link
Contributor

@astrutt I'd like to merge the mcstatus pull, I just literally can't. I don't have access to the repository, and forking it to a new organization would not be helpful for users.

Rekt may or may not have been a mistake, it seemed like a fairly harmless plugin when it was submitted as a PR. I merged it because it was fairly small, and ready to be included - because it was a harmless small addition.

linuxdaemon pushed a commit to linuxdaemon/CloudBot that referenced this issue Nov 21, 2017
linuxdaemon pushed a commit to linuxdaemon/CloudBot that referenced this issue Dec 25, 2018
* Add verysmart plugin and data

* Add final new line to pass CodeFactor test

* Reformat to preload quote data via on_start

* Move vsquotes and refactor to extend

* Add docstrings to functions

* Add hyphen to docstrings

`bot` argument is injected, no arguments accepted by users. Added hyphen to both docstrings.
linuxdaemon pushed a commit to linuxdaemon/CloudBot that referenced this issue Jan 21, 2019
* Add verysmart plugin and data

* Add final new line to pass CodeFactor test

* Reformat to preload quote data via on_start

* Move vsquotes and refactor to extend

* Add docstrings to functions

* Add hyphen to docstrings

`bot` argument is injected, no arguments accepted by users. Added hyphen to both docstrings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants