TF2Maps / VBot

Automated bot software for interacting with Steam Trade
http://scrap.tf
MIT License
1 stars 0 forks source link

Update server information posts to correctly filter out extraneous workshop data #14

Closed Geit closed 8 years ago

Geit commented 8 years ago

Messages like:

21:03 - [6] VBot.exe: Map changed to: workshop/arena_discovery_b4.ugc on the EU Server 4/24 - Join at: steam://connect/91.121.155.109:27015 21:08 - [6] VBot.exe: workshop/arena_discovery_b4.ugc 6/24 - Join at: steam://connect/91.121.155.109:27015

Should be updated to filter out the "workshop/" and ".ugc[0-9]*" sections. The relevant code used to do this on the forums is: $serverData["map"] = str_replace("workshop/", "", $serverData["map"]); $serverData["map"] = preg_replace("/\.ugc[0-9]+/", "", $serverData["map"]);

Winwardo commented 8 years ago

@Fantasmos if you want to do this, this is a fantastic opportunity to put this into Utilities.cs and write several tests for it in UtilitiesTests.cs. Just do it in a new branch and open a pull-request when you're done - Travis will run the tests you wrote and verify they all pass :)

I can take it otherwise.

Supernova4422 commented 8 years ago

I don't think I have the time to do it fairly soon, I've got some study and assignments to work on in the coming weeks

Winwardo commented 8 years ago

I'll look into this tomorrow / Tuesday then

Geit commented 8 years ago

Update, the regex replace needs to be $serverData["map"] = preg_replace("/\..*$/", "", $serverData["map"]); because the maximum map display name length is 32 characters, this means maps with longer names don't return the full "ugc0123456" code, making the regex I originally posted fail.