From 4b4e4c202b4cf4a148e8797b93902ba9f38d4c74 Mon Sep 17 00:00:00 2001 From: Nyo Date: Thu, 19 May 2016 23:31:48 +0200 Subject: [PATCH] .BANCHO. .FIX. Fokabot np command fixes, changed packets encoding --- constants/fokabotCommands.py | 12 ++++++++++-- helpers/packetHelper.py | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/constants/fokabotCommands.py b/constants/fokabotCommands.py index 308c9d0..e455711 100644 --- a/constants/fokabotCommands.py +++ b/constants/fokabotCommands.py @@ -367,10 +367,15 @@ def tillerinoNp(fro, chan, message): return False # Get URL from message - beatmapURL = str(message[3][1:]) + if message[1] == "listening": + beatmapURL = str(message[3][1:]) + elif message[1] == "playing": + beatmapURL = str(message[2][1:]) + else: + return False # Get beatmap id from URL - p = re.compile("https:\\/\\/osu\\.ppy\\.sh\\/b\\/(\\d*)") + p = re.compile("^https?:\\/\\/osu\\.ppy\\.sh\\/b\\/(\\d*)") beatmapID = p.search(beatmapURL).groups(0)[0] # Update latest tillerino song for current token @@ -564,6 +569,9 @@ commands = [ }, { "trigger": "ACTION is listening to [", "callback": tillerinoNp + }, { + "trigger": "ACTION is playing [", + "callback": tillerinoNp }, { "trigger": "!with", "callback": tillerinoMods, diff --git a/helpers/packetHelper.py b/helpers/packetHelper.py index 0b7fd92..42f085d 100644 --- a/helpers/packetHelper.py +++ b/helpers/packetHelper.py @@ -110,7 +110,7 @@ def packData(__data, __dataType): # Non empty string data += b"\x0B" data += uleb128Encode(len(__data)) - data += str.encode(__data, "utf-8") + data += str.encode(__data, "latin_1") elif __dataType == dataTypes.uInt16: packType = "