CloudBotIRC / CloudBot

CloudBot - The simple, fast, expandable, open-source Python IRC Bot!
GNU General Public License v3.0
273 stars 250 forks source link

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

Open astrutt opened 8 years ago

astrutt commented 8 years ago

.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 commented 8 years ago

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 commented 8 years ago

GOD DAMN IT, MOJANG

On Sat, Mar 19, 2016 at 5:16 AM, Andrew Strutt notifications@github.com 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 https://github.com/CloudBotIRC/CloudBot/issues/224#issuecomment-198431650

ctian1 commented 8 years ago

It's a problem with the mcstatus library.

astrutt commented 7 years ago

No one can fix this?

daboross commented 7 years ago

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 commented 7 years ago

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

astrutt commented 7 years ago

I most definitely want it, it was one of the main reasons I was using CloudBot. :-/

Hosting minecraft servers w/ IRC chat it's a great feature to check on server status and activity.

Please fix!

On Mon, May 1, 2017 at 10:33 PM, Chris notifications@github.com wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CloudBotIRC/CloudBot/issues/224#issuecomment-298483024, or mute the thread https://github.com/notifications/unsubscribe-auth/ALFImiKwyR_5qCKAt0lqz5U-_QHepmHeks5r1pYMgaJpZM4Hxdrp .

-- Andrew Strutt andrew.strutt@gmail.com https://keybase.io/astrutt GV# : +1.702.514.0650 AF# : +93.07962.80801

edwardslabs commented 7 years ago

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 commented 7 years ago

Thank you!!!

On Tue, May 2, 2017 at 12:30 AM, Andy Edwards notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CloudBotIRC/CloudBot/issues/224#issuecomment-298494840, or mute the thread https://github.com/notifications/unsubscribe-auth/ALFImkUMJB7kEq87KHWULas5iBbz5b3sks5r1rFwgaJpZM4Hxdrp .

-- Andrew Strutt andrew.strutt@gmail.com https://keybase.io/astrutt GV# : +1.702.514.0650 AF# : +93.07962.80801

astrutt commented 7 years ago

Don't forget to submit the PR please =)

On Tue, May 2, 2017 at 12:30 AM, Andy Edwards notifications@github.com wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CloudBotIRC/CloudBot/issues/224#issuecomment-298494840, or mute the thread https://github.com/notifications/unsubscribe-auth/ALFImkUMJB7kEq87KHWULas5iBbz5b3sks5r1rFwgaJpZM4Hxdrp .

-- Andrew Strutt andrew.strutt@gmail.com https://keybase.io/astrutt GV# : +1.702.514.0650 AF# : +93.07962.80801

edwardslabs commented 7 years ago

It's already been done. https://github.com/CloudBotIRC/mcstatus/pull/2

astrutt commented 7 years ago

Thanks my mistake!! Much appreciate you patching it.

On Wed, May 3, 2017 at 2:18 PM, Andy Edwards notifications@github.com wrote:

It's already been done. CloudBotIRC/mcstatus#2 https://github.com/CloudBotIRC/mcstatus/pull/2

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CloudBotIRC/CloudBot/issues/224#issuecomment-298993061, or mute the thread https://github.com/notifications/unsubscribe-auth/ALFImrhZBu0jsv54RJvvxbIOOGyLa6aVks5r2MTjgaJpZM4Hxdrp .

-- Andrew Strutt andrew.strutt@gmail.com https://keybase.io/astrutt GV# : +1.702.514.0650 AF# : +93.07962.80801

astrutt commented 7 years ago

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 commented 7 years ago

@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.