├── .gitignore ├── LICENSE ├── README.md ├── package-lock.json ├── package.json ├── src └── flaregram │ ├── api │ ├── answerCallbackQuery.js │ ├── copyMessage.js │ ├── copyMessages.js │ ├── forwardMessage.js │ ├── forwardMessages.js │ └── sendMessage.js │ ├── bot.js │ └── utils │ ├── router.js │ ├── strings.js │ └── webhook.js └── wrangler_sample.toml /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | todo.txt 3 | /dist 4 | .prettierrc 5 | src/plugins 6 | src/index.js 7 | src/config.js 8 | wrangler.toml 9 | /.wrangler 10 | src/flaregram/utils/registrar.js 11 | howtoKV.txt 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0) 2 | This is a human-readable summary of (and not a substitute for) the full license. 3 | 4 | You are free to: 5 | 6 | Share: Copy and redistribute the material in any medium or format. 7 | Adapt: Remix, transform, and build upon the material. 8 | Under the following terms: 9 | 10 | Attribution: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 11 | 12 | NonCommercial: You may not use the material for commercial purposes. 13 | 14 | No additional restrictions: You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 15 | 16 | Notices: 17 | 18 | You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation. 19 | 20 | No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material. 21 | 22 | Complete terms can be found at: CC BY-NC 4.0 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 |

4 | build 5 | GitHub package.json dynamic 6 | GitHub repo size 7 | GitHub last commit 8 | GitHub Repo stars 9 | GitHub Discussions 10 |

11 |
12 | 13 |

14 | 15 |

16 | 17 | 18 | 19 |

20 | super-light 21 | · 22 | blazing-fast 23 | · 24 | modular 25 |

26 | A light-weight, blazing fast, easy-to-use, Telegram HTTP bot API framework written in javascript. It runs on cloudflare workers and uses wrangler too. 27 |

28 | 29 |
30 | 31 | ## > Installation / Usage: 32 | > [Read the wiki](https://github.com/adityash4rma/flaregram/wiki) 33 | 34 |
35 | 36 | 37 | 38 | ## > License 39 | ![License Logo](https://www.gnu.org/graphics/agplv3-with-text-162x68.png) 40 | 41 | _flaregram © 2024 by Aditya Sharma is licensed under GNU AFFERO GENERAL PUBLIC LICENSE (GNU AGPL v3). To view a copy of this license_ 42 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flaregram", 3 | "version": "1.0.1", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "flaregram", 9 | "version": "1.0.1", 10 | "devDependencies": { 11 | "@cloudflare/workers-types": "^4.20230419.0", 12 | "typescript": "^5.0.4", 13 | "wrangler": "^3.30.1" 14 | } 15 | }, 16 | "node_modules/@cloudflare/kv-asset-handler": { 17 | "version": "0.3.1", 18 | "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.1.tgz", 19 | "integrity": "sha512-lKN2XCfKCmpKb86a1tl4GIwsJYDy9TGuwjhDELLmpKygQhw8X2xR4dusgpC5Tg7q1pB96Eb0rBo81kxSILQMwA==", 20 | "dev": true, 21 | "dependencies": { 22 | "mime": "^3.0.0" 23 | } 24 | }, 25 | "node_modules/@cloudflare/workerd-darwin-64": { 26 | "version": "1.20240223.1", 27 | "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240223.1.tgz", 28 | "integrity": "sha512-GgHnvkazLFZ7bmR96+dTX0+WS13a+5CHOOP3qNUSR9oEnR4hHzpNIO75MuZsm9RPAXrvtT7nSJmYwiGCZXh6og==", 29 | "cpu": [ 30 | "x64" 31 | ], 32 | "dev": true, 33 | "optional": true, 34 | "os": [ 35 | "darwin" 36 | ], 37 | "engines": { 38 | "node": ">=16" 39 | } 40 | }, 41 | "node_modules/@cloudflare/workerd-darwin-arm64": { 42 | "version": "1.20240223.1", 43 | "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240223.1.tgz", 44 | "integrity": "sha512-ZF98vUmVlC0EVEd3RRuhMq4HYWFcqmPtMIMPUN2+ivEHR92TE+6E/AvdeE6wcE7fKHQ+fk3dH+ZgB0GcfptfnA==", 45 | "cpu": [ 46 | "arm64" 47 | ], 48 | "dev": true, 49 | "optional": true, 50 | "os": [ 51 | "darwin" 52 | ], 53 | "engines": { 54 | "node": ">=16" 55 | } 56 | }, 57 | "node_modules/@cloudflare/workerd-linux-64": { 58 | "version": "1.20240223.1", 59 | "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240223.1.tgz", 60 | "integrity": "sha512-1kH41ewNTGMmAk2zUX0Xj9VSfidl26GQ0ZrWMdi5kwf6gAHd3oVWNigJN078Jx56SgQxNcqVGX1LunqF949asw==", 61 | "cpu": [ 62 | "x64" 63 | ], 64 | "dev": true, 65 | "optional": true, 66 | "os": [ 67 | "linux" 68 | ], 69 | "engines": { 70 | "node": ">=16" 71 | } 72 | }, 73 | "node_modules/@cloudflare/workerd-linux-arm64": { 74 | "version": "1.20240223.1", 75 | "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240223.1.tgz", 76 | "integrity": "sha512-Ro8Og5C4evh890JrRm0B8sHyumRtgL+mUqPeNcEsyG45jAQy5xHpapHnmJAMJV6ah+zDc1cZtQq+en39SojXvQ==", 77 | "cpu": [ 78 | "arm64" 79 | ], 80 | "dev": true, 81 | "optional": true, 82 | "os": [ 83 | "linux" 84 | ], 85 | "engines": { 86 | "node": ">=16" 87 | } 88 | }, 89 | "node_modules/@cloudflare/workerd-windows-64": { 90 | "version": "1.20240223.1", 91 | "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240223.1.tgz", 92 | "integrity": "sha512-eNP5sfaP6WL07DaoigYou5ASPF7jHsFiNzzD2vGOI7yFd5sPlb7sJ4SpIy+BCX0LdqFnjmlUo5Xr+/I6qJ2Nww==", 93 | "cpu": [ 94 | "x64" 95 | ], 96 | "dev": true, 97 | "optional": true, 98 | "os": [ 99 | "win32" 100 | ], 101 | "engines": { 102 | "node": ">=16" 103 | } 104 | }, 105 | "node_modules/@cloudflare/workers-types": { 106 | "version": "4.20240222.0", 107 | "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20240222.0.tgz", 108 | "integrity": "sha512-luO0BdK3rLlCv3B240+cTrfqm+XSbHtpk+88aJtGwzyVK9QF/Xz8lBgE/oZZLN8nCTmOvxAZnszyxUuZ8GP8Cg==", 109 | "dev": true 110 | }, 111 | "node_modules/@cspotcode/source-map-support": { 112 | "version": "0.8.1", 113 | "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", 114 | "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", 115 | "dev": true, 116 | "dependencies": { 117 | "@jridgewell/trace-mapping": "0.3.9" 118 | }, 119 | "engines": { 120 | "node": ">=12" 121 | } 122 | }, 123 | "node_modules/@esbuild-plugins/node-globals-polyfill": { 124 | "version": "0.2.3", 125 | "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz", 126 | "integrity": "sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==", 127 | "dev": true, 128 | "peerDependencies": { 129 | "esbuild": "*" 130 | } 131 | }, 132 | "node_modules/@esbuild-plugins/node-modules-polyfill": { 133 | "version": "0.2.2", 134 | "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz", 135 | "integrity": "sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==", 136 | "dev": true, 137 | "dependencies": { 138 | "escape-string-regexp": "^4.0.0", 139 | "rollup-plugin-node-polyfills": "^0.2.1" 140 | }, 141 | "peerDependencies": { 142 | "esbuild": "*" 143 | } 144 | }, 145 | "node_modules/@esbuild/android-arm": { 146 | "version": "0.17.19", 147 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz", 148 | "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==", 149 | "cpu": [ 150 | "arm" 151 | ], 152 | "dev": true, 153 | "optional": true, 154 | "os": [ 155 | "android" 156 | ], 157 | "engines": { 158 | "node": ">=12" 159 | } 160 | }, 161 | "node_modules/@esbuild/android-arm64": { 162 | "version": "0.17.19", 163 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz", 164 | "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==", 165 | "cpu": [ 166 | "arm64" 167 | ], 168 | "dev": true, 169 | "optional": true, 170 | "os": [ 171 | "android" 172 | ], 173 | "engines": { 174 | "node": ">=12" 175 | } 176 | }, 177 | "node_modules/@esbuild/android-x64": { 178 | "version": "0.17.19", 179 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz", 180 | "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==", 181 | "cpu": [ 182 | "x64" 183 | ], 184 | "dev": true, 185 | "optional": true, 186 | "os": [ 187 | "android" 188 | ], 189 | "engines": { 190 | "node": ">=12" 191 | } 192 | }, 193 | "node_modules/@esbuild/darwin-arm64": { 194 | "version": "0.17.19", 195 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz", 196 | "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==", 197 | "cpu": [ 198 | "arm64" 199 | ], 200 | "dev": true, 201 | "optional": true, 202 | "os": [ 203 | "darwin" 204 | ], 205 | "engines": { 206 | "node": ">=12" 207 | } 208 | }, 209 | "node_modules/@esbuild/darwin-x64": { 210 | "version": "0.17.19", 211 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz", 212 | "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==", 213 | "cpu": [ 214 | "x64" 215 | ], 216 | "dev": true, 217 | "optional": true, 218 | "os": [ 219 | "darwin" 220 | ], 221 | "engines": { 222 | "node": ">=12" 223 | } 224 | }, 225 | "node_modules/@esbuild/freebsd-arm64": { 226 | "version": "0.17.19", 227 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz", 228 | "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==", 229 | "cpu": [ 230 | "arm64" 231 | ], 232 | "dev": true, 233 | "optional": true, 234 | "os": [ 235 | "freebsd" 236 | ], 237 | "engines": { 238 | "node": ">=12" 239 | } 240 | }, 241 | "node_modules/@esbuild/freebsd-x64": { 242 | "version": "0.17.19", 243 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz", 244 | "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==", 245 | "cpu": [ 246 | "x64" 247 | ], 248 | "dev": true, 249 | "optional": true, 250 | "os": [ 251 | "freebsd" 252 | ], 253 | "engines": { 254 | "node": ">=12" 255 | } 256 | }, 257 | "node_modules/@esbuild/linux-arm": { 258 | "version": "0.17.19", 259 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz", 260 | "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==", 261 | "cpu": [ 262 | "arm" 263 | ], 264 | "dev": true, 265 | "optional": true, 266 | "os": [ 267 | "linux" 268 | ], 269 | "engines": { 270 | "node": ">=12" 271 | } 272 | }, 273 | "node_modules/@esbuild/linux-arm64": { 274 | "version": "0.17.19", 275 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz", 276 | "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==", 277 | "cpu": [ 278 | "arm64" 279 | ], 280 | "dev": true, 281 | "optional": true, 282 | "os": [ 283 | "linux" 284 | ], 285 | "engines": { 286 | "node": ">=12" 287 | } 288 | }, 289 | "node_modules/@esbuild/linux-ia32": { 290 | "version": "0.17.19", 291 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz", 292 | "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==", 293 | "cpu": [ 294 | "ia32" 295 | ], 296 | "dev": true, 297 | "optional": true, 298 | "os": [ 299 | "linux" 300 | ], 301 | "engines": { 302 | "node": ">=12" 303 | } 304 | }, 305 | "node_modules/@esbuild/linux-loong64": { 306 | "version": "0.17.19", 307 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz", 308 | "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==", 309 | "cpu": [ 310 | "loong64" 311 | ], 312 | "dev": true, 313 | "optional": true, 314 | "os": [ 315 | "linux" 316 | ], 317 | "engines": { 318 | "node": ">=12" 319 | } 320 | }, 321 | "node_modules/@esbuild/linux-mips64el": { 322 | "version": "0.17.19", 323 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz", 324 | "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==", 325 | "cpu": [ 326 | "mips64el" 327 | ], 328 | "dev": true, 329 | "optional": true, 330 | "os": [ 331 | "linux" 332 | ], 333 | "engines": { 334 | "node": ">=12" 335 | } 336 | }, 337 | "node_modules/@esbuild/linux-ppc64": { 338 | "version": "0.17.19", 339 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz", 340 | "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==", 341 | "cpu": [ 342 | "ppc64" 343 | ], 344 | "dev": true, 345 | "optional": true, 346 | "os": [ 347 | "linux" 348 | ], 349 | "engines": { 350 | "node": ">=12" 351 | } 352 | }, 353 | "node_modules/@esbuild/linux-riscv64": { 354 | "version": "0.17.19", 355 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz", 356 | "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==", 357 | "cpu": [ 358 | "riscv64" 359 | ], 360 | "dev": true, 361 | "optional": true, 362 | "os": [ 363 | "linux" 364 | ], 365 | "engines": { 366 | "node": ">=12" 367 | } 368 | }, 369 | "node_modules/@esbuild/linux-s390x": { 370 | "version": "0.17.19", 371 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz", 372 | "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==", 373 | "cpu": [ 374 | "s390x" 375 | ], 376 | "dev": true, 377 | "optional": true, 378 | "os": [ 379 | "linux" 380 | ], 381 | "engines": { 382 | "node": ">=12" 383 | } 384 | }, 385 | "node_modules/@esbuild/linux-x64": { 386 | "version": "0.17.19", 387 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz", 388 | "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==", 389 | "cpu": [ 390 | "x64" 391 | ], 392 | "dev": true, 393 | "optional": true, 394 | "os": [ 395 | "linux" 396 | ], 397 | "engines": { 398 | "node": ">=12" 399 | } 400 | }, 401 | "node_modules/@esbuild/netbsd-x64": { 402 | "version": "0.17.19", 403 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz", 404 | "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==", 405 | "cpu": [ 406 | "x64" 407 | ], 408 | "dev": true, 409 | "optional": true, 410 | "os": [ 411 | "netbsd" 412 | ], 413 | "engines": { 414 | "node": ">=12" 415 | } 416 | }, 417 | "node_modules/@esbuild/openbsd-x64": { 418 | "version": "0.17.19", 419 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz", 420 | "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==", 421 | "cpu": [ 422 | "x64" 423 | ], 424 | "dev": true, 425 | "optional": true, 426 | "os": [ 427 | "openbsd" 428 | ], 429 | "engines": { 430 | "node": ">=12" 431 | } 432 | }, 433 | "node_modules/@esbuild/sunos-x64": { 434 | "version": "0.17.19", 435 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz", 436 | "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==", 437 | "cpu": [ 438 | "x64" 439 | ], 440 | "dev": true, 441 | "optional": true, 442 | "os": [ 443 | "sunos" 444 | ], 445 | "engines": { 446 | "node": ">=12" 447 | } 448 | }, 449 | "node_modules/@esbuild/win32-arm64": { 450 | "version": "0.17.19", 451 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz", 452 | "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==", 453 | "cpu": [ 454 | "arm64" 455 | ], 456 | "dev": true, 457 | "optional": true, 458 | "os": [ 459 | "win32" 460 | ], 461 | "engines": { 462 | "node": ">=12" 463 | } 464 | }, 465 | "node_modules/@esbuild/win32-ia32": { 466 | "version": "0.17.19", 467 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz", 468 | "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==", 469 | "cpu": [ 470 | "ia32" 471 | ], 472 | "dev": true, 473 | "optional": true, 474 | "os": [ 475 | "win32" 476 | ], 477 | "engines": { 478 | "node": ">=12" 479 | } 480 | }, 481 | "node_modules/@esbuild/win32-x64": { 482 | "version": "0.17.19", 483 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz", 484 | "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==", 485 | "cpu": [ 486 | "x64" 487 | ], 488 | "dev": true, 489 | "optional": true, 490 | "os": [ 491 | "win32" 492 | ], 493 | "engines": { 494 | "node": ">=12" 495 | } 496 | }, 497 | "node_modules/@fastify/busboy": { 498 | "version": "2.1.1", 499 | "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", 500 | "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", 501 | "dev": true, 502 | "engines": { 503 | "node": ">=14" 504 | } 505 | }, 506 | "node_modules/@jridgewell/resolve-uri": { 507 | "version": "3.1.2", 508 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", 509 | "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", 510 | "dev": true, 511 | "engines": { 512 | "node": ">=6.0.0" 513 | } 514 | }, 515 | "node_modules/@jridgewell/sourcemap-codec": { 516 | "version": "1.4.15", 517 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", 518 | "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", 519 | "dev": true 520 | }, 521 | "node_modules/@jridgewell/trace-mapping": { 522 | "version": "0.3.9", 523 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", 524 | "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", 525 | "dev": true, 526 | "dependencies": { 527 | "@jridgewell/resolve-uri": "^3.0.3", 528 | "@jridgewell/sourcemap-codec": "^1.4.10" 529 | } 530 | }, 531 | "node_modules/acorn": { 532 | "version": "8.11.3", 533 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", 534 | "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", 535 | "dev": true, 536 | "bin": { 537 | "acorn": "bin/acorn" 538 | }, 539 | "engines": { 540 | "node": ">=0.4.0" 541 | } 542 | }, 543 | "node_modules/acorn-walk": { 544 | "version": "8.3.2", 545 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", 546 | "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", 547 | "dev": true, 548 | "engines": { 549 | "node": ">=0.4.0" 550 | } 551 | }, 552 | "node_modules/anymatch": { 553 | "version": "3.1.3", 554 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", 555 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", 556 | "dev": true, 557 | "dependencies": { 558 | "normalize-path": "^3.0.0", 559 | "picomatch": "^2.0.4" 560 | }, 561 | "engines": { 562 | "node": ">= 8" 563 | } 564 | }, 565 | "node_modules/as-table": { 566 | "version": "1.0.55", 567 | "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz", 568 | "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==", 569 | "dev": true, 570 | "dependencies": { 571 | "printable-characters": "^1.0.42" 572 | } 573 | }, 574 | "node_modules/binary-extensions": { 575 | "version": "2.2.0", 576 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", 577 | "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", 578 | "dev": true, 579 | "engines": { 580 | "node": ">=8" 581 | } 582 | }, 583 | "node_modules/blake3-wasm": { 584 | "version": "2.1.5", 585 | "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", 586 | "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", 587 | "dev": true 588 | }, 589 | "node_modules/braces": { 590 | "version": "3.0.2", 591 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", 592 | "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", 593 | "dev": true, 594 | "dependencies": { 595 | "fill-range": "^7.0.1" 596 | }, 597 | "engines": { 598 | "node": ">=8" 599 | } 600 | }, 601 | "node_modules/capnp-ts": { 602 | "version": "0.7.0", 603 | "resolved": "https://registry.npmjs.org/capnp-ts/-/capnp-ts-0.7.0.tgz", 604 | "integrity": "sha512-XKxXAC3HVPv7r674zP0VC3RTXz+/JKhfyw94ljvF80yynK6VkTnqE3jMuN8b3dUVmmc43TjyxjW4KTsmB3c86g==", 605 | "dev": true, 606 | "dependencies": { 607 | "debug": "^4.3.1", 608 | "tslib": "^2.2.0" 609 | } 610 | }, 611 | "node_modules/chokidar": { 612 | "version": "3.5.3", 613 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", 614 | "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", 615 | "dev": true, 616 | "funding": [ 617 | { 618 | "type": "individual", 619 | "url": "https://paulmillr.com/funding/" 620 | } 621 | ], 622 | "dependencies": { 623 | "anymatch": "~3.1.2", 624 | "braces": "~3.0.2", 625 | "glob-parent": "~5.1.2", 626 | "is-binary-path": "~2.1.0", 627 | "is-glob": "~4.0.1", 628 | "normalize-path": "~3.0.0", 629 | "readdirp": "~3.6.0" 630 | }, 631 | "engines": { 632 | "node": ">= 8.10.0" 633 | }, 634 | "optionalDependencies": { 635 | "fsevents": "~2.3.2" 636 | } 637 | }, 638 | "node_modules/cookie": { 639 | "version": "0.5.0", 640 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", 641 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", 642 | "dev": true, 643 | "engines": { 644 | "node": ">= 0.6" 645 | } 646 | }, 647 | "node_modules/data-uri-to-buffer": { 648 | "version": "2.0.2", 649 | "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz", 650 | "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==", 651 | "dev": true 652 | }, 653 | "node_modules/debug": { 654 | "version": "4.3.4", 655 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 656 | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 657 | "dev": true, 658 | "dependencies": { 659 | "ms": "2.1.2" 660 | }, 661 | "engines": { 662 | "node": ">=6.0" 663 | }, 664 | "peerDependenciesMeta": { 665 | "supports-color": { 666 | "optional": true 667 | } 668 | } 669 | }, 670 | "node_modules/esbuild": { 671 | "version": "0.17.19", 672 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz", 673 | "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==", 674 | "dev": true, 675 | "hasInstallScript": true, 676 | "bin": { 677 | "esbuild": "bin/esbuild" 678 | }, 679 | "engines": { 680 | "node": ">=12" 681 | }, 682 | "optionalDependencies": { 683 | "@esbuild/android-arm": "0.17.19", 684 | "@esbuild/android-arm64": "0.17.19", 685 | "@esbuild/android-x64": "0.17.19", 686 | "@esbuild/darwin-arm64": "0.17.19", 687 | "@esbuild/darwin-x64": "0.17.19", 688 | "@esbuild/freebsd-arm64": "0.17.19", 689 | "@esbuild/freebsd-x64": "0.17.19", 690 | "@esbuild/linux-arm": "0.17.19", 691 | "@esbuild/linux-arm64": "0.17.19", 692 | "@esbuild/linux-ia32": "0.17.19", 693 | "@esbuild/linux-loong64": "0.17.19", 694 | "@esbuild/linux-mips64el": "0.17.19", 695 | "@esbuild/linux-ppc64": "0.17.19", 696 | "@esbuild/linux-riscv64": "0.17.19", 697 | "@esbuild/linux-s390x": "0.17.19", 698 | "@esbuild/linux-x64": "0.17.19", 699 | "@esbuild/netbsd-x64": "0.17.19", 700 | "@esbuild/openbsd-x64": "0.17.19", 701 | "@esbuild/sunos-x64": "0.17.19", 702 | "@esbuild/win32-arm64": "0.17.19", 703 | "@esbuild/win32-ia32": "0.17.19", 704 | "@esbuild/win32-x64": "0.17.19" 705 | } 706 | }, 707 | "node_modules/escape-string-regexp": { 708 | "version": "4.0.0", 709 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", 710 | "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", 711 | "dev": true, 712 | "engines": { 713 | "node": ">=10" 714 | }, 715 | "funding": { 716 | "url": "https://github.com/sponsors/sindresorhus" 717 | } 718 | }, 719 | "node_modules/estree-walker": { 720 | "version": "0.6.1", 721 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", 722 | "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", 723 | "dev": true 724 | }, 725 | "node_modules/exit-hook": { 726 | "version": "2.2.1", 727 | "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz", 728 | "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==", 729 | "dev": true, 730 | "engines": { 731 | "node": ">=6" 732 | }, 733 | "funding": { 734 | "url": "https://github.com/sponsors/sindresorhus" 735 | } 736 | }, 737 | "node_modules/fill-range": { 738 | "version": "7.0.1", 739 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", 740 | "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", 741 | "dev": true, 742 | "dependencies": { 743 | "to-regex-range": "^5.0.1" 744 | }, 745 | "engines": { 746 | "node": ">=8" 747 | } 748 | }, 749 | "node_modules/fsevents": { 750 | "version": "2.3.2", 751 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", 752 | "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", 753 | "dev": true, 754 | "hasInstallScript": true, 755 | "optional": true, 756 | "os": [ 757 | "darwin" 758 | ], 759 | "engines": { 760 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 761 | } 762 | }, 763 | "node_modules/function-bind": { 764 | "version": "1.1.2", 765 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", 766 | "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", 767 | "dev": true, 768 | "funding": { 769 | "url": "https://github.com/sponsors/ljharb" 770 | } 771 | }, 772 | "node_modules/get-source": { 773 | "version": "2.0.12", 774 | "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz", 775 | "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==", 776 | "dev": true, 777 | "dependencies": { 778 | "data-uri-to-buffer": "^2.0.0", 779 | "source-map": "^0.6.1" 780 | } 781 | }, 782 | "node_modules/glob-parent": { 783 | "version": "5.1.2", 784 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 785 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 786 | "dev": true, 787 | "dependencies": { 788 | "is-glob": "^4.0.1" 789 | }, 790 | "engines": { 791 | "node": ">= 6" 792 | } 793 | }, 794 | "node_modules/glob-to-regexp": { 795 | "version": "0.4.1", 796 | "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", 797 | "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", 798 | "dev": true 799 | }, 800 | "node_modules/hasown": { 801 | "version": "2.0.1", 802 | "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.1.tgz", 803 | "integrity": "sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA==", 804 | "dev": true, 805 | "dependencies": { 806 | "function-bind": "^1.1.2" 807 | }, 808 | "engines": { 809 | "node": ">= 0.4" 810 | } 811 | }, 812 | "node_modules/is-binary-path": { 813 | "version": "2.1.0", 814 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 815 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 816 | "dev": true, 817 | "dependencies": { 818 | "binary-extensions": "^2.0.0" 819 | }, 820 | "engines": { 821 | "node": ">=8" 822 | } 823 | }, 824 | "node_modules/is-core-module": { 825 | "version": "2.13.1", 826 | "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", 827 | "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", 828 | "dev": true, 829 | "dependencies": { 830 | "hasown": "^2.0.0" 831 | }, 832 | "funding": { 833 | "url": "https://github.com/sponsors/ljharb" 834 | } 835 | }, 836 | "node_modules/is-extglob": { 837 | "version": "2.1.1", 838 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 839 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 840 | "dev": true, 841 | "engines": { 842 | "node": ">=0.10.0" 843 | } 844 | }, 845 | "node_modules/is-glob": { 846 | "version": "4.0.3", 847 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 848 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 849 | "dev": true, 850 | "dependencies": { 851 | "is-extglob": "^2.1.1" 852 | }, 853 | "engines": { 854 | "node": ">=0.10.0" 855 | } 856 | }, 857 | "node_modules/is-number": { 858 | "version": "7.0.0", 859 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 860 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 861 | "dev": true, 862 | "engines": { 863 | "node": ">=0.12.0" 864 | } 865 | }, 866 | "node_modules/magic-string": { 867 | "version": "0.25.9", 868 | "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz", 869 | "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==", 870 | "dev": true, 871 | "dependencies": { 872 | "sourcemap-codec": "^1.4.8" 873 | } 874 | }, 875 | "node_modules/mime": { 876 | "version": "3.0.0", 877 | "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", 878 | "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", 879 | "dev": true, 880 | "bin": { 881 | "mime": "cli.js" 882 | }, 883 | "engines": { 884 | "node": ">=10.0.0" 885 | } 886 | }, 887 | "node_modules/miniflare": { 888 | "version": "3.20240223.0", 889 | "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240223.0.tgz", 890 | "integrity": "sha512-8T/36FEfvsL4aMF7SLZ28v+PQL0jsUlVw/u114GYcdobkyPax9E6Ahn0XePOHEqLxQSndwPee+eS1phHANFePA==", 891 | "dev": true, 892 | "dependencies": { 893 | "@cspotcode/source-map-support": "0.8.1", 894 | "acorn": "^8.8.0", 895 | "acorn-walk": "^8.2.0", 896 | "capnp-ts": "^0.7.0", 897 | "exit-hook": "^2.2.1", 898 | "glob-to-regexp": "^0.4.1", 899 | "stoppable": "^1.1.0", 900 | "undici": "^5.28.2", 901 | "workerd": "1.20240223.1", 902 | "ws": "^8.11.0", 903 | "youch": "^3.2.2", 904 | "zod": "^3.20.6" 905 | }, 906 | "bin": { 907 | "miniflare": "bootstrap.js" 908 | }, 909 | "engines": { 910 | "node": ">=16.13" 911 | } 912 | }, 913 | "node_modules/ms": { 914 | "version": "2.1.2", 915 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 916 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", 917 | "dev": true 918 | }, 919 | "node_modules/mustache": { 920 | "version": "4.2.0", 921 | "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz", 922 | "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==", 923 | "dev": true, 924 | "bin": { 925 | "mustache": "bin/mustache" 926 | } 927 | }, 928 | "node_modules/nanoid": { 929 | "version": "3.3.6", 930 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", 931 | "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", 932 | "dev": true, 933 | "funding": [ 934 | { 935 | "type": "github", 936 | "url": "https://github.com/sponsors/ai" 937 | } 938 | ], 939 | "bin": { 940 | "nanoid": "bin/nanoid.cjs" 941 | }, 942 | "engines": { 943 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 944 | } 945 | }, 946 | "node_modules/node-forge": { 947 | "version": "1.3.1", 948 | "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", 949 | "integrity": "sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==", 950 | "dev": true, 951 | "engines": { 952 | "node": ">= 6.13.0" 953 | } 954 | }, 955 | "node_modules/normalize-path": { 956 | "version": "3.0.0", 957 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 958 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 959 | "dev": true, 960 | "engines": { 961 | "node": ">=0.10.0" 962 | } 963 | }, 964 | "node_modules/path-parse": { 965 | "version": "1.0.7", 966 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", 967 | "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", 968 | "dev": true 969 | }, 970 | "node_modules/path-to-regexp": { 971 | "version": "6.2.1", 972 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", 973 | "integrity": "sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==", 974 | "dev": true 975 | }, 976 | "node_modules/picomatch": { 977 | "version": "2.3.1", 978 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 979 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 980 | "dev": true, 981 | "engines": { 982 | "node": ">=8.6" 983 | }, 984 | "funding": { 985 | "url": "https://github.com/sponsors/jonschlinkert" 986 | } 987 | }, 988 | "node_modules/printable-characters": { 989 | "version": "1.0.42", 990 | "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz", 991 | "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==", 992 | "dev": true 993 | }, 994 | "node_modules/readdirp": { 995 | "version": "3.6.0", 996 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 997 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 998 | "dev": true, 999 | "dependencies": { 1000 | "picomatch": "^2.2.1" 1001 | }, 1002 | "engines": { 1003 | "node": ">=8.10.0" 1004 | } 1005 | }, 1006 | "node_modules/resolve": { 1007 | "version": "1.22.8", 1008 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", 1009 | "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", 1010 | "dev": true, 1011 | "dependencies": { 1012 | "is-core-module": "^2.13.0", 1013 | "path-parse": "^1.0.7", 1014 | "supports-preserve-symlinks-flag": "^1.0.0" 1015 | }, 1016 | "bin": { 1017 | "resolve": "bin/resolve" 1018 | }, 1019 | "funding": { 1020 | "url": "https://github.com/sponsors/ljharb" 1021 | } 1022 | }, 1023 | "node_modules/resolve.exports": { 1024 | "version": "2.0.2", 1025 | "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", 1026 | "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", 1027 | "dev": true, 1028 | "engines": { 1029 | "node": ">=10" 1030 | } 1031 | }, 1032 | "node_modules/rollup-plugin-inject": { 1033 | "version": "3.0.2", 1034 | "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz", 1035 | "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==", 1036 | "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.", 1037 | "dev": true, 1038 | "dependencies": { 1039 | "estree-walker": "^0.6.1", 1040 | "magic-string": "^0.25.3", 1041 | "rollup-pluginutils": "^2.8.1" 1042 | } 1043 | }, 1044 | "node_modules/rollup-plugin-node-polyfills": { 1045 | "version": "0.2.1", 1046 | "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz", 1047 | "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==", 1048 | "dev": true, 1049 | "dependencies": { 1050 | "rollup-plugin-inject": "^3.0.0" 1051 | } 1052 | }, 1053 | "node_modules/rollup-pluginutils": { 1054 | "version": "2.8.2", 1055 | "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", 1056 | "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", 1057 | "dev": true, 1058 | "dependencies": { 1059 | "estree-walker": "^0.6.1" 1060 | } 1061 | }, 1062 | "node_modules/selfsigned": { 1063 | "version": "2.1.1", 1064 | "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.1.1.tgz", 1065 | "integrity": "sha512-GSL3aowiF7wa/WtSFwnUrludWFoNhftq8bUkH9pkzjpN2XSPOAYEgg6e0sS9s0rZwgJzJiQRPU18A6clnoW5wQ==", 1066 | "dev": true, 1067 | "dependencies": { 1068 | "node-forge": "^1" 1069 | }, 1070 | "engines": { 1071 | "node": ">=10" 1072 | } 1073 | }, 1074 | "node_modules/source-map": { 1075 | "version": "0.6.1", 1076 | "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", 1077 | "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", 1078 | "dev": true, 1079 | "engines": { 1080 | "node": ">=0.10.0" 1081 | } 1082 | }, 1083 | "node_modules/sourcemap-codec": { 1084 | "version": "1.4.8", 1085 | "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", 1086 | "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", 1087 | "deprecated": "Please use @jridgewell/sourcemap-codec instead", 1088 | "dev": true 1089 | }, 1090 | "node_modules/stacktracey": { 1091 | "version": "2.1.8", 1092 | "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.1.8.tgz", 1093 | "integrity": "sha512-Kpij9riA+UNg7TnphqjH7/CzctQ/owJGNbFkfEeve4Z4uxT5+JapVLFXcsurIfN34gnTWZNJ/f7NMG0E8JDzTw==", 1094 | "dev": true, 1095 | "dependencies": { 1096 | "as-table": "^1.0.36", 1097 | "get-source": "^2.0.12" 1098 | } 1099 | }, 1100 | "node_modules/stoppable": { 1101 | "version": "1.1.0", 1102 | "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz", 1103 | "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==", 1104 | "dev": true, 1105 | "engines": { 1106 | "node": ">=4", 1107 | "npm": ">=6" 1108 | } 1109 | }, 1110 | "node_modules/supports-preserve-symlinks-flag": { 1111 | "version": "1.0.0", 1112 | "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", 1113 | "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", 1114 | "dev": true, 1115 | "engines": { 1116 | "node": ">= 0.4" 1117 | }, 1118 | "funding": { 1119 | "url": "https://github.com/sponsors/ljharb" 1120 | } 1121 | }, 1122 | "node_modules/to-regex-range": { 1123 | "version": "5.0.1", 1124 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 1125 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 1126 | "dev": true, 1127 | "dependencies": { 1128 | "is-number": "^7.0.0" 1129 | }, 1130 | "engines": { 1131 | "node": ">=8.0" 1132 | } 1133 | }, 1134 | "node_modules/tslib": { 1135 | "version": "2.6.2", 1136 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", 1137 | "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", 1138 | "dev": true 1139 | }, 1140 | "node_modules/typescript": { 1141 | "version": "5.0.4", 1142 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz", 1143 | "integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==", 1144 | "dev": true, 1145 | "bin": { 1146 | "tsc": "bin/tsc", 1147 | "tsserver": "bin/tsserver" 1148 | }, 1149 | "engines": { 1150 | "node": ">=12.20" 1151 | } 1152 | }, 1153 | "node_modules/undici": { 1154 | "version": "5.28.3", 1155 | "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", 1156 | "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", 1157 | "dev": true, 1158 | "dependencies": { 1159 | "@fastify/busboy": "^2.0.0" 1160 | }, 1161 | "engines": { 1162 | "node": ">=14.0" 1163 | } 1164 | }, 1165 | "node_modules/workerd": { 1166 | "version": "1.20240223.1", 1167 | "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240223.1.tgz", 1168 | "integrity": "sha512-Mo1fwdp6DLva4/fWdL09ZdYllkO45I4YpWG5PbF/YUGFlu2aMk24fmU6Pd6fo5/cWek4F+n3LmYEKKHfqjiJIA==", 1169 | "dev": true, 1170 | "hasInstallScript": true, 1171 | "bin": { 1172 | "workerd": "bin/workerd" 1173 | }, 1174 | "engines": { 1175 | "node": ">=16" 1176 | }, 1177 | "optionalDependencies": { 1178 | "@cloudflare/workerd-darwin-64": "1.20240223.1", 1179 | "@cloudflare/workerd-darwin-arm64": "1.20240223.1", 1180 | "@cloudflare/workerd-linux-64": "1.20240223.1", 1181 | "@cloudflare/workerd-linux-arm64": "1.20240223.1", 1182 | "@cloudflare/workerd-windows-64": "1.20240223.1" 1183 | } 1184 | }, 1185 | "node_modules/wrangler": { 1186 | "version": "3.30.1", 1187 | "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.30.1.tgz", 1188 | "integrity": "sha512-cT6Ezx8h2v5QiI0HWhnHVy32ng4omdMVdhaMQLuMnyMIHmyDoRg7pmrbhtZfj0663gExLdVtE4ucK//yncVTwg==", 1189 | "dev": true, 1190 | "dependencies": { 1191 | "@cloudflare/kv-asset-handler": "0.3.1", 1192 | "@esbuild-plugins/node-globals-polyfill": "^0.2.3", 1193 | "@esbuild-plugins/node-modules-polyfill": "^0.2.2", 1194 | "blake3-wasm": "^2.1.5", 1195 | "chokidar": "^3.5.3", 1196 | "esbuild": "0.17.19", 1197 | "miniflare": "3.20240223.0", 1198 | "nanoid": "^3.3.3", 1199 | "path-to-regexp": "^6.2.0", 1200 | "resolve": "^1.22.8", 1201 | "resolve.exports": "^2.0.2", 1202 | "selfsigned": "^2.0.1", 1203 | "source-map": "0.6.1", 1204 | "xxhash-wasm": "^1.0.1" 1205 | }, 1206 | "bin": { 1207 | "wrangler": "bin/wrangler.js", 1208 | "wrangler2": "bin/wrangler.js" 1209 | }, 1210 | "engines": { 1211 | "node": ">=16.17.0" 1212 | }, 1213 | "optionalDependencies": { 1214 | "fsevents": "~2.3.2" 1215 | }, 1216 | "peerDependencies": { 1217 | "@cloudflare/workers-types": "^4.20230914.0" 1218 | }, 1219 | "peerDependenciesMeta": { 1220 | "@cloudflare/workers-types": { 1221 | "optional": true 1222 | } 1223 | } 1224 | }, 1225 | "node_modules/ws": { 1226 | "version": "8.16.0", 1227 | "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", 1228 | "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", 1229 | "dev": true, 1230 | "engines": { 1231 | "node": ">=10.0.0" 1232 | }, 1233 | "peerDependencies": { 1234 | "bufferutil": "^4.0.1", 1235 | "utf-8-validate": ">=5.0.2" 1236 | }, 1237 | "peerDependenciesMeta": { 1238 | "bufferutil": { 1239 | "optional": true 1240 | }, 1241 | "utf-8-validate": { 1242 | "optional": true 1243 | } 1244 | } 1245 | }, 1246 | "node_modules/xxhash-wasm": { 1247 | "version": "1.0.2", 1248 | "resolved": "https://registry.npmjs.org/xxhash-wasm/-/xxhash-wasm-1.0.2.tgz", 1249 | "integrity": "sha512-ibF0Or+FivM9lNrg+HGJfVX8WJqgo+kCLDc4vx6xMeTce7Aj+DLttKbxxRR/gNLSAelRc1omAPlJ77N/Jem07A==", 1250 | "dev": true 1251 | }, 1252 | "node_modules/youch": { 1253 | "version": "3.3.3", 1254 | "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.3.tgz", 1255 | "integrity": "sha512-qSFXUk3UZBLfggAW3dJKg0BMblG5biqSF8M34E06o5CSsZtH92u9Hqmj2RzGiHDi64fhe83+4tENFP2DB6t6ZA==", 1256 | "dev": true, 1257 | "dependencies": { 1258 | "cookie": "^0.5.0", 1259 | "mustache": "^4.2.0", 1260 | "stacktracey": "^2.1.8" 1261 | } 1262 | }, 1263 | "node_modules/zod": { 1264 | "version": "3.22.4", 1265 | "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", 1266 | "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", 1267 | "dev": true, 1268 | "funding": { 1269 | "url": "https://github.com/sponsors/colinhacks" 1270 | } 1271 | } 1272 | } 1273 | } 1274 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flaregram", 3 | "version": "1.0.1", 4 | "private": true, 5 | "scripts": { 6 | "deploy": "wrangler publish", 7 | "start": "wrangler dev" 8 | }, 9 | "devDependencies": { 10 | "@cloudflare/workers-types": "^4.20230419.0", 11 | "typescript": "^5.0.4", 12 | "wrangler": "^3.30.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/flaregram/api/answerCallbackQuery.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | 4 | import { ErrorStr, colors } from '../utils/strings.js'; 5 | 6 | /// --------- SAnswer Callback Query Function ---------- /// 7 | export async function f_answerCallbackQuery(body) { 8 | try { 9 | const API_URL = `https://api.telegram.org/bot${BOT_TOKEN}/answerCallbackQuery`; 10 | 11 | /// Making mandatory params /// 12 | let param_id = ''; 13 | 14 | if (body.id != undefined) { 15 | param_id = body.id; 16 | } else { 17 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `id` + colors.white); 18 | }; 19 | 20 | 21 | /// Making optional params 22 | const param_text = body.text == undefined?'':body.text; 23 | const param_show_alert = body.show_alert == undefined?'False':body.show_alert; 24 | const param_cache_time = body.cache_time == undefined?'':body.cache_time; 25 | const param_url = body.url == undefined?'':body.url; // would only work if the callback comes from a callback_game button. 26 | 27 | const payload = { 28 | // required 29 | callback_query_id: param_id, 30 | //optionals 31 | text: param_text, 32 | show_alert: param_show_alert, 33 | cache_time: param_cache_time, 34 | url: param_url, 35 | }; 36 | 37 | 38 | const response = await fetch(API_URL, { 39 | method: 'POST', 40 | headers: {'Content-Type': 'application/json'}, 41 | body: JSON.stringify(payload) 42 | }).then(response => response.json()) 43 | .then(response => { 44 | if (response.ok == false){ 45 | console.error(ErrorStr.telegramError + colors.yellow + response.description + colors.white) 46 | console.error(colors.red + `ERROR => ` + colors.yellow + `Cannot perform answerCallbackQuery - ${payload.callback_query_id}` + colors.white) 47 | }; 48 | }); 49 | 50 | return response; 51 | } catch (error){ 52 | console.error(error) 53 | }; 54 | } -------------------------------------------------------------------------------- /src/flaregram/api/copyMessage.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | 4 | import { ErrorStr, colors } from '../utils/strings.js'; 5 | 6 | /// --------- Copy Single Message Function ---------- /// 7 | export async function f_copyMessage(body) { 8 | try { 9 | const API_URL = `https://api.telegram.org/bot${BOT_TOKEN}/copyMessage`; 10 | 11 | /// Making mandatory params /// 12 | let param_chat_id = ''; 13 | let param_from_chat_id = ''; 14 | let param_message_id = ''; 15 | 16 | if (body.chat_id != undefined) { 17 | param_chat_id = body.chat_id; 18 | } else { 19 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `chat_id` + colors.white); 20 | }; 21 | 22 | if (body.from_chat_id != undefined) { 23 | param_from_chat_id = body.from_chat_id; 24 | } else { 25 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `from_chat_id` + colors.white); 26 | } 27 | 28 | if (body.message_id != undefined) { 29 | param_message_id = body.message_id; 30 | } else { 31 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `message_id` + colors.white); 32 | } 33 | 34 | /// Making optional params 35 | const param_message_thread_id = body.message_thread_id == undefined?parseInt(body.message_thread_id) : ''; 36 | const param_caption = body.caption == undefined?'':body.caption; 37 | const param_parse_mode = body.parse_mode == undefined?'':body.parse_mode; 38 | const param_caption_entities = body.caption_entities == undefined?'':body.caption_entities; 39 | const param_disable_notification = body.disable_notification == undefined?'False':body.disable_notification; 40 | const param_protect_content = body.protect_content == undefined?'False':body.protect_content; 41 | const param_reply_parameters = body.reply_parameters == undefined?'':body.reply_parameters; 42 | const param_reply_markup = body.reply_markup == undefined?'':body.reply_markup; 43 | 44 | const payload = { 45 | chat_id: param_chat_id, 46 | from_chat_id: param_from_chat_id, 47 | message_id: param_message_id, 48 | 49 | caption: param_caption, 50 | parse_mode: param_parse_mode, 51 | caption_entities: param_caption_entities, 52 | message_thread_id: param_message_thread_id, 53 | disable_notification: param_disable_notification, 54 | protect_content: param_protect_content, 55 | reply_parameters: param_reply_parameters, 56 | reply_markup: param_reply_markup, 57 | }; 58 | 59 | 60 | const response = await fetch(API_URL, { 61 | method: 'POST', 62 | headers: {'Content-Type': 'application/json'}, 63 | body: JSON.stringify(payload) 64 | }).then(response => response.json()) 65 | .then(response => { 66 | if (response.ok == false){ 67 | console.error(ErrorStr.telegramError + colors.yellow + response.description + colors.white) 68 | console.error(colors.red + `ERROR => ` + colors.yellow + `Cannot Copy Message - msg: ${payload.message_id}` + colors.white) 69 | }; 70 | }); 71 | 72 | return response; 73 | } catch (error){ 74 | console.error(error) 75 | }; 76 | } 77 | 78 | -------------------------------------------------------------------------------- /src/flaregram/api/copyMessages.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | 4 | import { ErrorStr, colors } from '../utils/strings.js'; 5 | 6 | /// --------- Copy Messages Function ---------- /// 7 | export async function f_copyMessage(body) { 8 | try { 9 | const API_URL = `https://api.telegram.org/bot${BOT_TOKEN}/copyMessages`; 10 | 11 | /// Making mandatory params /// 12 | let param_chat_id = ''; 13 | let param_from_chat_id = ''; 14 | let param_message_ids = ''; 15 | 16 | if (body.chat_id != undefined) { 17 | param_chat_id = body.chat_id; 18 | } else { 19 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `chat_id` + colors.white); 20 | }; 21 | 22 | if (body.from_chat_id != undefined) { 23 | param_from_chat_id = body.from_chat_id; 24 | } else { 25 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `from_chat_id` + colors.white); 26 | } 27 | 28 | if (body.message_id != undefined) { 29 | param_message_id = body.message_id; 30 | } else { 31 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `message_id` + colors.white); 32 | } 33 | 34 | /// Making optional params 35 | const param_message_thread_id = body.message_thread_id == undefined?parseInt(body.message_thread_id) : ''; 36 | const param_remove_caption = body.remove_caption == undefined?'':body.remove_caption; 37 | const param_disable_notification = body.disable_notification == undefined?'False':body.disable_notification; 38 | const param_protect_content = body.protect_content == undefined?'False':body.protect_content; 39 | 40 | const payload = { 41 | chat_id: param_chat_id, 42 | from_chat_id: param_from_chat_id, 43 | message_ids: param_message_ids, 44 | 45 | remove_caption: param_remove_caption, 46 | message_thread_id: param_message_thread_id, 47 | disable_notification: param_disable_notification, 48 | protect_content: param_protect_content, 49 | }; 50 | 51 | 52 | const response = await fetch(API_URL, { 53 | method: 'POST', 54 | headers: {'Content-Type': 'application/json'}, 55 | body: JSON.stringify(payload) 56 | }).then(response => response.json()) 57 | .then(response => { 58 | if (response.ok == false){ 59 | console.error(ErrorStr.telegramError + colors.yellow + response.description + colors.white) 60 | console.error(colors.red + `ERROR => ` + colors.yellow + `Cannot Copy Messages - msg: ${payload.message_ids}` + colors.white) 61 | }; 62 | }); 63 | 64 | return response; 65 | } catch (error){ 66 | console.error(error) 67 | }; 68 | } 69 | 70 | -------------------------------------------------------------------------------- /src/flaregram/api/forwardMessage.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | 4 | import { ErrorStr, colors } from '../utils/strings.js'; 5 | 6 | /// --------- Forward Single Message Function ---------- /// 7 | export async function f_forwardMessage(body) { 8 | try { 9 | const API_URL = `https://api.telegram.org/bot${BOT_TOKEN}/forwardMessage`; 10 | 11 | /// Making mandatory params /// 12 | let param_chat_id = ''; 13 | let param_from_chat_id = ''; 14 | let param_message_id = ''; 15 | 16 | if (body.chat_id != undefined) { 17 | param_chat_id = body.chat_id; 18 | } else { 19 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `chat_id` + colors.white); 20 | }; 21 | 22 | if (body.from_chat_id != undefined) { 23 | param_from_chat_id = body.from_chat_id; 24 | } else { 25 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `from_chat_id` + colors.white); 26 | } 27 | 28 | if (body.message_id != undefined) { 29 | param_message_id = body.message_id; 30 | } else { 31 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `message_id` + colors.white); 32 | } 33 | 34 | /// Making optional params 35 | const param_message_thread_id = body.message_thread_id == undefined?parseInt(body.message_thread_id) : ''; 36 | const param_disable_notification = body.disable_notification == undefined?'False':body.disable_notification; 37 | const param_protect_content = body.protect_content == undefined?'False':body.protect_content; 38 | 39 | const payload = { 40 | chat_id: param_chat_id, 41 | from_chat_id: param_from_chat_id, 42 | message_id: param_message_id, 43 | 44 | message_thread_id: param_message_thread_id, 45 | disable_notification: param_disable_notification, 46 | protect_content: param_protect_content, 47 | }; 48 | 49 | 50 | const response = await fetch(API_URL, { 51 | method: 'POST', 52 | headers: {'Content-Type': 'application/json'}, 53 | body: JSON.stringify(payload) 54 | }).then(response => response.json()) 55 | .then(response => { 56 | if (response.ok == false){ 57 | console.error(ErrorStr.telegramError + colors.yellow + response.description + colors.white) 58 | console.error(colors.red + `ERROR => ` + colors.yellow + `Cannot Forward Message - ${payload.message_id} to recipent, ${payload.chat_id}` + colors.white) 59 | }; 60 | }); 61 | 62 | return response; 63 | } catch (error){ 64 | console.error(error) 65 | }; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/flaregram/api/forwardMessages.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | 4 | import { ErrorStr, colors } from '../utils/strings.js'; 5 | 6 | /// --------- Forward Messages Function ---------- /// 7 | export async function f_forwardMessages(body) { 8 | try { 9 | const API_URL = `https://api.telegram.org/bot${BOT_TOKEN}/forwardMessages`; 10 | 11 | /// Making mandatory params /// 12 | let param_chat_id = ''; 13 | let param_from_chat_id = ''; 14 | let param_message_ids = ''; 15 | 16 | if (body.chat_id != undefined) { 17 | param_chat_id = body.chat_id; 18 | } else { 19 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `chat_id` + colors.white); 20 | }; 21 | 22 | if (body.from_chat_id != undefined) { 23 | param_from_chat_id = body.from_chat_id; 24 | } else { 25 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `from_chat_id` + colors.white); 26 | } 27 | 28 | if (body.message_ids != undefined) { 29 | param_message_ids = body.message_ids; 30 | } else { 31 | throw new Error(ErrorStr.undefinedParameter + colors.yellow + `message_ids` + colors.white); 32 | } 33 | 34 | /// Making optional params 35 | const param_message_thread_id = body.message_thread_id == undefined?parseInt(body.message_thread_id) : ''; 36 | const param_disable_notification = body.disable_notification == undefined?'False':body.disable_notification; 37 | const param_protect_content = body.protect_content == undefined?'False':body.protect_content; 38 | 39 | const payload = { 40 | chat_id: param_chat_id, 41 | from_chat_id: param_from_chat_id, 42 | message_ids: param_message_ids, 43 | 44 | message_thread_id: param_message_thread_id, 45 | disable_notification: param_disable_notification, 46 | protect_content: param_protect_content, 47 | }; 48 | 49 | 50 | const response = await fetch(API_URL, { 51 | method: 'POST', 52 | headers: {'Content-Type': 'application/json'}, 53 | body: JSON.stringify(payload) 54 | }).then(response => response.json()) 55 | .then(response => { 56 | if (response.ok == false){ 57 | console.error(ErrorStr.telegramError + colors.yellow + response.description + colors.white) 58 | console.error(colors.red + `ERROR => ` + colors.yellow + `Cannot Forward Messages - msgs: ${payload.message_ids} to recipent, ${payload.chat_id}` + colors.white) 59 | }; 60 | }); 61 | 62 | return response; 63 | } catch (error){ 64 | console.error(error) 65 | }; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/flaregram/api/sendMessage.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | 4 | import { ErrorStr, colors } from '../utils/strings.js'; 5 | 6 | /// --------- Sending Message Function ---------- /// 7 | export async function f_sendMessage(body) { 8 | try { 9 | const API_URL = `https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`; 10 | 11 | let param_chat_id = ''; 12 | let param_text = ''; 13 | 14 | if (body.chat_id != undefined) { 15 | param_chat_id = body.chat_id; 16 | } else { 17 | throw new Error(ErrorStr.undefinedParameter + `${colors.yellow}chat_id${colors.white}`); 18 | }; 19 | 20 | if (body.text != undefined) { 21 | param_text = body.text; 22 | } else { 23 | throw new Error(ErrorStr.undefinedParameter + `text`); 24 | } 25 | 26 | const param_message_thread_id = body.message_thread_id == undefined?'':body.message_thread_id; 27 | const param_reply_markup = body.reply_markup == undefined?'':body.reply_markup; 28 | const param_disable_web_page_preview = body.disable_web_page_preview == undefined?false:body.disable_web_page_preview; 29 | const param_reply_to_message_id = body.reply_to_message_id == undefined?'':body.reply_to_message_id; 30 | const param_disable_notification = body.disable_notification == undefined?'':body.disable_notification; 31 | const param_protect_content = body.protect_content == undefined?'False':body.protect_content; 32 | const param_parse_mode = body.parse_mode == undefined?'Markdown':body.parse_mode; 33 | 34 | const payload = { 35 | chat_id: param_chat_id, 36 | message_thread_id: param_message_thread_id, 37 | text: param_text, 38 | reply_markup: param_reply_markup, 39 | disable_web_page_preview: param_disable_web_page_preview, 40 | reply_to_message_id: param_reply_to_message_id, 41 | disable_notification: param_disable_notification, 42 | protect_content: param_protect_content, 43 | parse_mode: param_parse_mode 44 | }; 45 | 46 | console.log(JSON.stringify(payload)); 47 | const response = await fetch(API_URL, { 48 | method: 'POST', 49 | headers: { 'Content-Type': 'application/json' }, 50 | body: JSON.stringify(payload), 51 | }); 52 | 53 | if (!response.ok) { 54 | console.error('Error sending message:', response.status, response.statusText); 55 | throw new Error('Error sending message'); 56 | } 57 | 58 | return response; 59 | } catch (error){ 60 | console.error(error) 61 | }; 62 | 63 | return response.json() 64 | } 65 | 66 | -------------------------------------------------------------------------------- /src/flaregram/bot.js: -------------------------------------------------------------------------------- 1 | 2 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 3 | 4 | import { f_forwardMessage } from "./api/forwardMessage"; 5 | import { f_forwardMessages } from "./api/forwardMessages"; 6 | import { f_sendMessage } from "./api/sendMessage"; 7 | import { f_answerCallbackQuery } from "./api/answerCallbackQuery"; 8 | import { f_copyMessage } from "./api/copyMessage"; 9 | 10 | /// Bot Object for flaregram 11 | 12 | export const bot = { 13 | message: { 14 | sendMessage: f_sendMessage, 15 | forwardMessage: f_forwardMessage, 16 | forwardMessages: f_forwardMessages, 17 | copyMessage: f_copyMessage, 18 | answerCallbackQuery: f_answerCallbackQuery 19 | }, 20 | 21 | 22 | 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /src/flaregram/utils/router.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | import { updateHandler } from '../../index'; 4 | import { setWebhook } from './webhook'; 5 | import { colors, status_good, status_bad } from './strings.js'; 6 | 7 | // Create a new router instance 8 | const router = { 9 | routes: [], 10 | post(path, handler) { 11 | this.routes.push({ method: 'POST', path, handler }); 12 | }, 13 | handle(request) { 14 | const { pathname } = new URL(request.url); 15 | const route = this.routes.find((route) => route.method === request.method && new RegExp(`^${route.path}$`).test(pathname)); 16 | console.log(route); 17 | if (route) { 18 | return route.handler(request); 19 | } else { 20 | return new Response(JSON.stringify(status_good), { status: 200 }); 21 | } 22 | }, 23 | }; 24 | 25 | // Function to process '/bot' route 26 | async function handleBotRequest(update) { 27 | try { 28 | const token = update.headers.get('X-Telegram-Bot-Api-Secret-Token'); 29 | 30 | //const { method, body } = request; 31 | const data = await update.json(); 32 | 33 | if (SECRET_TOKEN == token) { 34 | console.log( 35 | `SERVER: Incoming ${colors.yellow}SECRET_TOKEN${colors.white} has been verified [ ${colors.green}${token}${colors.white} ]` 36 | ); 37 | 38 | await updateHandler(data); 39 | return new Response(JSON.stringify({ ok: true }), { status: 200 }); 40 | } 41 | } catch (error) { 42 | console.error('Error processing update:', error); 43 | return new Response() 44 | } 45 | return new Response(JSON.stringify(status_good), { status: 200 }); 46 | } 47 | 48 | // Route handler 49 | router.post('/bot', handleBotRequest); 50 | 51 | /// ----- Create a route for setting webhook url ---- /// 52 | router.post('/set-webhook', async (request) => { 53 | const webhookResult = await setWebhook(WEBHOOK_URL, SECRET_TOKEN, DROP_PENDING_UPDATES); 54 | return new Response(webhookResult.description, { status: 200 }); 55 | }); 56 | 57 | export { router, handleBotRequest }; 58 | -------------------------------------------------------------------------------- /src/flaregram/utils/strings.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | 4 | //// --- Color codes ---- //// 5 | export const colors = { 6 | reset: "\x1b[0m", 7 | bright: "\x1b[1m", 8 | dim: "\x1b[2m", 9 | underscore: "\x1b[4m", 10 | blink: "\x1b[5m", 11 | reverse: "\x1b[7m", 12 | hidden: "\x1b[8m", 13 | black: "\x1b[30m", 14 | red: "\x1b[31m", 15 | green: "\x1b[32m", 16 | yellow: "\x1b[33m", 17 | blue: "\x1b[34m", 18 | magenta: "\x1b[35m", 19 | cyan: "\x1b[36m", 20 | white: "\x1b[37m", 21 | }; 22 | 23 | 24 | //// ---- Strings ---- //// 25 | 26 | export const status_good = {"Status":"Operational / OK / Good","flaregram":{"Version":REPO_VERSION,"Github":"https://github.com/adityash4rma/flaregram","Developer":"https://github.com/adityash4rma"}}; 27 | 28 | export const status_bad = {"Status":"Broken / NOT OK / Bad","flaregram":{"Version":REPO_VERSION,"Github":"https://github.com/adityash4rma/flaregram","Developer":"https://github.com/adityash4rma"}}; 29 | 30 | //// ---- Errors ----- //// 31 | 32 | export const ErrorStr = { 33 | undefinedParameter: `${colors.red}ERROR${colors.white}: Undefined mandatory parameter => `, 34 | telegramError: `${colors.red}TELEGRAM ERROR =>${colors.white} ` 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /src/flaregram/utils/webhook.js: -------------------------------------------------------------------------------- 1 | //// flaregram © 2024 by Aditya Sharma is licensed under Attribution-NonCommercial 4.0 International. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ 2 | 3 | 4 | /// --------- Setting Webhook URL ---------- /// 5 | async function setWebhook(URL, SECRET_TOKEN, DROP_PENDING_UPDATES) { 6 | let token; 7 | let HOOK_URL = `https://api.telegram.org/bot${BOT_TOKEN}/setWebhook?url=${URL}`; 8 | 9 | if (SECRET_TOKEN === '') { 10 | const token = SECRET_TOKEN; 11 | HOOK_URL = `${HOOK_URL}&secret_token=${token}` 12 | } else if (typeof SECRET_TOKEN === "string") { 13 | const token = SECRET_TOKEN 14 | HOOK_URL = `${HOOK_URL}&secret_token=${token}` 15 | }; 16 | 17 | 18 | if (DROP_PENDING_UPDATES === "True") { 19 | HOOK_URL = `${HOOK_URL}&drop_pending_updates=${DROP_PENDING_UPDATES}` 20 | }; 21 | 22 | try { 23 | const response = await fetch(HOOK_URL, { method: 'POST' }); 24 | const data = await response.json(); 25 | console.log(HOOK_URL); 26 | return data; 27 | } catch (err) { 28 | console.error("new error: " + err); 29 | } 30 | 31 | } 32 | 33 | 34 | 35 | export { 36 | setWebhook 37 | }; 38 | -------------------------------------------------------------------------------- /wrangler_sample.toml: -------------------------------------------------------------------------------- 1 | name = "flaregram" 2 | main = "src/index.js" 3 | compatibility_date = "2023-05-18" 4 | env = { } 5 | 6 | [dev] 7 | host = "localhost" 8 | 9 | [vars] 10 | ########## flaregram ########### 11 | # ---- See Wiki for all env variable descriptions. 12 | 13 | # Mandatory Variables 14 | REPO_VERSION = "1.0.1" 15 | BOT_TOKEN = "" 16 | WEBHOOK_URL = "" 17 | 18 | # Optional Variables 19 | SECRET_TOKEN = "" 20 | DROP_PENDING_UPDATES = "True" 21 | 22 | ################################## 23 | --------------------------------------------------------------------------------