.BANCHO. .FIX. Fokabot np command fixes, changed packets encoding

This commit is contained in:
Nyo 2016-05-19 23:31:48 +02:00
parent 035c934d99
commit 4b4e4c202b
2 changed files with 11 additions and 3 deletions

View File

@ -367,10 +367,15 @@ def tillerinoNp(fro, chan, message):
return False return False
# Get URL from message # 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 # 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] beatmapID = p.search(beatmapURL).groups(0)[0]
# Update latest tillerino song for current token # Update latest tillerino song for current token
@ -564,6 +569,9 @@ commands = [
}, { }, {
"trigger": "ACTION is listening to [", "trigger": "ACTION is listening to [",
"callback": tillerinoNp "callback": tillerinoNp
}, {
"trigger": "ACTION is playing [",
"callback": tillerinoNp
}, { }, {
"trigger": "!with", "trigger": "!with",
"callback": tillerinoMods, "callback": tillerinoMods,

View File

@ -110,7 +110,7 @@ def packData(__data, __dataType):
# Non empty string # Non empty string
data += b"\x0B" data += b"\x0B"
data += uleb128Encode(len(__data)) data += uleb128Encode(len(__data))
data += str.encode(__data, "utf-8") data += str.encode(__data, "latin_1")
elif __dataType == dataTypes.uInt16: elif __dataType == dataTypes.uInt16:
packType = "<H" packType = "<H"
elif __dataType == dataTypes.sInt16: elif __dataType == dataTypes.sInt16: