{"id":15821153,"url":"https://github.com/eomm/telegraf-safe-md-reply","last_synced_at":"2025-09-04T23:31:37.462Z","repository":{"id":200110998,"uuid":"705172371","full_name":"Eomm/telegraf-safe-md-reply","owner":"Eomm","description":"Reply safely with markdown!","archived":false,"fork":false,"pushed_at":"2023-10-15T09:29:33.000Z","size":6,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-19T23:19:51.288Z","etag":null,"topics":["middleware","telegraf","telegraf-plugin","telegram"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Eomm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-15T08:48:01.000Z","updated_at":"2024-04-16T16:26:16.000Z","dependencies_parsed_at":"2023-10-15T20:10:34.760Z","dependency_job_id":null,"html_url":"https://github.com/Eomm/telegraf-safe-md-reply","commit_stats":null,"previous_names":["eomm/telegraf-safe-md-reply"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eomm%2Ftelegraf-safe-md-reply","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eomm%2Ftelegraf-safe-md-reply/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eomm%2Ftelegraf-safe-md-reply/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Eomm%2Ftelegraf-safe-md-reply/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Eomm","download_url":"https://codeload.github.com/Eomm/telegraf-safe-md-reply/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232005157,"owners_count":18459032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["middleware","telegraf","telegraf-plugin","telegram"],"created_at":"2024-10-05T07:20:39.667Z","updated_at":"2024-12-31T15:36:45.088Z","avatar_url":"https://github.com/Eomm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# telegraf-safe-md-reply\n\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![ci](https://github.com/Eomm/telegraf-safe-md-reply/actions/workflows/ci.yml/badge.svg)](https://github.com/Eomm/telegraf-safe-md-reply/actions/workflows/ci.yml)\n\nReply safely with markdown!\n\nAre you tired of this error?!\n\n```\n\"type\": \"TelegramError\",\n\"message\": \"400: Bad Request: can't parse entities: Character '-' is reserved and must be escaped with the preceding '\\\\'\",\n```\n\nThis package is for you!\n\n## Usage\n\nThe `telegraf-safe-md-reply` middleware will add new methods to the `ctx` object:\n\n- `replyWithSafeMarkdownV2`: reply with markdown escaping all the reserved characters\n- `escapeMarkdown`: escape a string escaping all the reserved markdown characters\n\n```js\nconst Telegraf = require('telegraf')\nconst safeReply = require('telegraf-safe-md-reply')\n\nconst bot = new Telegraf(process.env.BOT_TOKEN)\n\nbot.use(safeReply())\n\nbot.command('test', async (ctx) =\u003e {\n  // use the new method to reply\n  ctx.replyWithSafeMarkdownV2('Hello-World(?)')\n\n  // or escape manually:\n  ctx.replyWithMarkdownV2(`*Hello*${ctx.escapeMarkdown('-World(?)')}`)\n})\n```\n\n## Options\n\nYou can pass an object with options to the middleware:\n\n```js\nbot.use(safeReply({\n  methodName: 'safeReply'\n}))\n\nbot.command('test', (ctx) =\u003e {\n  ctx.safeReply('Hello-World(?)')\n})\n```\n\n\n## License\n\nCopyright [Manuel Spigolon](https://github.com/Eomm), Licensed under [MIT](./LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feomm%2Ftelegraf-safe-md-reply","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feomm%2Ftelegraf-safe-md-reply","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feomm%2Ftelegraf-safe-md-reply/lists"}