diff --git a/.eslintrc.yml b/.eslintrc.yml index ba9678d..e2edcf2 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -10,6 +10,3 @@ parserOptions: plugins: - "@typescript-eslint" - "prettier" -rules: { - linebreak-style: ["error", "windows"] -} diff --git a/config/config-sample.yaml b/config/config-sample.yaml index 1ce3f2d..cf0d017 100644 --- a/config/config-sample.yaml +++ b/config/config-sample.yaml @@ -5,7 +5,7 @@ owner_id: 'YOUR_TELEGRAM_ID' spam_time: 5 * 60 * 1000 # time (in MS) in which user may send 5 messages spam_cant_msg: 5 -parse_mode: 'MarkdownV2' # DO NOT CHANGE! +parse_mode: 'Markdown' # Experimental. Do not change unless you know what you are doing. Options: Markdown/MarkdownV2/HTML allow_private: false # Allow / disallow option for staff to chat privately direct_reply: false # Set this to true to just forward staff users to a user chat when allow_private diff --git a/src/middleware.ts b/src/middleware.ts index faf5291..9b921df 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -26,7 +26,7 @@ const escapeText = function(str: string | string[]) { .replace(//g, '>') .replace(/"/g, '"'); - } else { + } else if (cache.config.parse_mode == 'MarkdownV2') { // '[', ']', '(', ')', are skipped as they are usally for urls // '_', '*', '~', '`', are used for actualy markdown const chars = ['>', '#', '+', '-', '=', '|', '{', '}', '.', '!']; @@ -47,7 +47,8 @@ const escapeText = function(str: string | string[]) { } } return newStr; - } + } + return str.toString(); }; // handle messages to web socket