Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape brackets in the mealplan title in Markdown #34

Closed
ikelax opened this issue Jan 7, 2025 · 0 comments · Fixed by #37
Closed

Escape brackets in the mealplan title in Markdown #34

ikelax opened this issue Jan 7, 2025 · 0 comments · Fixed by #37
Labels
bug Something isn't working

Comments

@ikelax
Copy link
Owner

ikelax commented Jan 7, 2025

GrammyError: Call to 'answerInlineQuery' failed! (400: Bad Request: can't parse inline query result: Can't parse entities: Character '(' is reserved and must be escaped with the preceding '\')
    at toGrammyError (file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/core/error.js:47:12)
    at ApiClient.callApi (file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/core/client.js:97:48)
    at Object.runMicrotasks (ext:core/01_core.js:691:26)
    at processTicksAndRejections (ext:deno_node/_next_tick.ts:57:10)
    at runNextTicks (ext:deno_node/_next_tick.ts:75:3)
    at eventLoopTick (ext:core/01_core.js:182:21)
    at async file:///src/bot.js:82:5
    at async file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/composer.js:578:13
    at async file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/composer.js:62:13
    at async file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/composer.js:578:13 {
  error: GrammyError: Call to 'answerInlineQuery' failed! (400: Bad Request: can't parse inline query result: Can't parse entities: Character '(' is reserved and must be escaped with the preceding '\')
    at toGrammyError (file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/core/error.js:47:12)
    at ApiClient.callApi (file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/core/client.js:97:48)
    at Object.runMicrotasks (ext:core/01_core.js:691:26)
    at processTicksAndRejections (ext:deno_node/_next_tick.ts:57:10)
    at runNextTicks (ext:deno_node/_next_tick.ts:75:3)
    at eventLoopTick (ext:core/01_core.js:182:21)
    at async file:///src/bot.js:82:5
    at async file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/composer.js:578:13
    at async file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/composer.js:62:13
    at async file:///node_modules/.deno/grammy@1.34.0/node_modules/grammy/out/composer.js:578:13 {
    method: "answerInlineQuery",
    payload: {
      inline_query_id: XXX

I removed the inline_query_id.

If a mealplan is for today or from a day in the past, the title includes (heute) or (vergangen). The mealplans are formatted in Markdown. Therefore, I have to escape the brackets there.

@ikelax ikelax added the bug Something isn't working label Jan 7, 2025
@ikelax ikelax changed the title Escape the brackets () in the mealplan title Escape brackets () in the mealplan title Jan 7, 2025
@ikelax ikelax changed the title Escape brackets () in the mealplan title Escape brackets in the mealplan title in Markdown Jan 7, 2025
ikelax added a commit that referenced this issue Jan 7, 2025
If the meal plan is for today or for a date in past, (heute) or
(vergangen) is appended to it. The bot sends the meal plan in the
Markdown style of Telegram. There, brackets are reserved characters and
must therefore be escaped with \\. In the inline queries, the brackets
are not escaped because Markdown is not used there.

Closes #34
@ikelax ikelax closed this as completed in #37 Jan 7, 2025
ikelax added a commit that referenced this issue Jan 7, 2025
If the meal plan is for today or for a date in past, (heute) or
(vergangen) is appended to it. The bot sends the meal plan in the
Markdown style of Telegram. There, brackets are reserved characters and
must therefore be escaped with \\. In the inline queries, the brackets
are not escaped because Markdown is not used there.

Closes #34
See pull request #37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant