1
mirror of git://git.acid.vegas/scroll.git synced 2024-11-24 17:16:39 +00:00

Finally fixed character encoding issue not playing files with UTF-16 & other encodings

This commit is contained in:
Dionysus 2023-06-07 00:59:52 -04:00
parent 24a3e1b1fc
commit 9d120737c3
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE

View File

@ -155,7 +155,11 @@ class Bot():
else:
await self.action(chan, 'the ascii gods have chosen... ' + color(name, cyan))
for line in ascii:
await self.sendmsg(chan, line.decode(chardet.detect(line)['encoding']).replace('\n','').replace('\r','') + reset)
try:
line = line.decode().replace('\n','').replace('\r','')
else:
line = line.encode(chardet.detect(line)['encoding']).decode() # Get fucked UTF-16
await self.sendmsg(chan, line + reset)
await asyncio.sleep(throttle.message)
else:
await self.irc_error(chan, 'invalid name', name)