~exprez135/go-hypixel

ec1dcb27d6a9fa59537f073fff898e57d84dc893 — Nate Ijams 3 years ago 4591162
Fix map link URLs when space is in name.
2 files changed, 4 insertions(+), 4 deletions(-)

M engine/api.go
M engine/discord.go
M engine/api.go => engine/api.go +1 -3
@@ 297,9 297,7 @@ func GetPlayerStatus(uuid string) (bool, error) {
	return online, nil
}

// TODO: add functions for recentGames

// Returns: (mode string,
// Returns: (mode string, map string, ended f64)
func GetRecentGame(uuid string) (string, string, int, error) {
	rawResponse, err := Hclient.RecentGamesByUUID(uuid)
	if err != nil {

M engine/discord.go => engine/discord.go +3 -1
@@ 297,7 297,9 @@ func playerRecent(ctx *exrouter.Context) {
		message += " They haven't played any Bed Wars games in the last hour. :("
	} else {
		// game was within hour
		message += " Their last game in Bed Wars " + gameMode + " on the " + gameMap + " map ended " + strconv.FormatFloat(timeSince.Minutes(), 'f', 2, 64) + " minutes ago. https://hypixel.fandom.com/wiki/" + gameMap
		mapURL := "https://hypixel.fandom.com/wiki/" + strings.ReplaceAll(gameMap, " ", "_")
		// TODO fix link in case of two words
		message += " Their last game in Bed Wars " + gameMode + " on the " + gameMap + " map ended " + strconv.FormatFloat(timeSince.Minutes(), 'f', 2, 64) + " minutes ago. " + mapURL
	}

	// put together message