fix encoding order

This commit is contained in:
Flummi 2022-05-09 18:39:27 +02:00
parent 3b75d441f0
commit ba96fd0869
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "cuffeo", "name": "cuffeo",
"version": "1.1.0", "version": "1.1.1",
"description": "A multi-protocol chatbot library with nearly zero dependencies.", "description": "A multi-protocol chatbot library with nearly zero dependencies.",
"main": "src/index.mjs", "main": "src/index.mjs",
"scripts": {}, "scripts": {},

View File

@ -147,9 +147,9 @@ export default class tg extends EventEmitter {
} }
format(msg) { format(msg) {
return msg.toString() return msg.toString()
.split("&").join("&")
.split("<").join("&lt;") .split("<").join("&lt;")
.split(">").join("&gt;") .split(">").join("&gt;")
.split("&").join("&amp;")
.replace(/\[b\](.*?)\[\/b\]/g, "<b>$1</b>") // bold .replace(/\[b\](.*?)\[\/b\]/g, "<b>$1</b>") // bold
.replace(/\[i\](.*?)\[\/i\]/g, "<i>$1</i>") // italic .replace(/\[i\](.*?)\[\/i\]/g, "<i>$1</i>") // italic
.replace(/\[color=(.*?)](.*?)\[\/color\]/g, "$2") .replace(/\[color=(.*?)](.*?)\[\/color\]/g, "$2")