Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nikhiljohn10/telegram-bot-worker
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: codebam/cf-workers-telegram-bot
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
Loading
Showing with 12,264 additions and 748 deletions.
  1. +1 −0 .envrc
  2. +6 −0 .githooks/pre-commit
  3. +1 −0 .github/FUNDING.yml
  4. +17 −0 .github/dependabot.yml
  5. +44 −0 .github/workflows/build_pr.yml
  6. +76 −0 .github/workflows/codeql.yml
  7. +51 −0 .github/workflows/eslint.yml
  8. +32 −0 .github/workflows/github-publish.yml
  9. +29 −0 .github/workflows/npm-publish.yml
  10. +16 −0 .gitignore
  11. +6 −0 .prettierrc
  12. +176 −21 LICENSE
  13. +32 −0 Makefile
  14. +58 −56 README.md
  15. BIN assets/logo.png
  16. BIN assets/screenshot.png
  17. +1 −0 docs/.nojekyll
  18. +57 −0 docs/assets/highlight.css
  19. +15 −0 docs/assets/icons.js
  20. +1 −0 docs/assets/icons.svg
  21. +59 −0 docs/assets/main.js
  22. +1 −0 docs/assets/navigation.js
  23. +1 −0 docs/assets/search.js
  24. +1,412 −0 docs/assets/style.css
  25. +29 −0 docs/classes/TelegramApi.html
  26. +24 −0 docs/classes/TelegramBot.html
  27. +31 −0 docs/classes/TelegramExecutionContext.html
  28. +4 −0 docs/classes/TelegramInlineQueryResult.html
  29. +7 −0 docs/classes/TelegramInlineQueryResultArticle.html
  30. +14 −0 docs/classes/TelegramInlineQueryResultPhoto.html
  31. +8 −0 docs/classes/TelegramUpdate.html
  32. +2 −0 docs/classes/Update.html
  33. +5 −0 docs/classes/Webhook.html
  34. +2 −0 docs/classes/WebhookCommands.html
  35. +1 −0 docs/hierarchy.html
  36. +49 −0 docs/index.html
  37. +15 −0 docs/interfaces/ChatPermissions.html
  38. +7 −0 docs/interfaces/PartialTelegramUpdate.html
  39. +18 −0 docs/interfaces/TelegramChat.html
  40. +6 −0 docs/interfaces/TelegramFrom.html
  41. +6 −0 docs/interfaces/TelegramInlineQuery.html
  42. +3 −0 docs/interfaces/TelegramInputMessageContent.html
  43. +37 −0 docs/interfaces/TelegramMessage.html
  44. +7 −0 docs/interfaces/TelegramMessageEntity.html
  45. +6 −0 docs/interfaces/TelegramPhotoSize.html
  46. +10 −0 docs/interfaces/TelegramUser.html
  47. +24 −0 docs/modules.html
  48. +1 −0 docs/types/TelegramCommand.html
  49. +1 −0 docs/types/TelegramInlineQueryType.html
  50. +38 −0 eslint.config.mjs
  51. +57 −0 flake.lock
  52. +23 −0 flake.nix
  53. +7,643 −0 package-lock.json
  54. +26 −0 package.json
  55. +176 −0 packages/main/LICENSE
  56. +58 −0 packages/main/README.md
  57. +18 −0 packages/main/eslint.config.js
  58. +46 −0 packages/main/package.json
  59. +44 −0 packages/main/src/main.ts
  60. +236 −0 packages/main/src/telegram_api.ts
  61. +150 −0 packages/main/src/telegram_bot.ts
  62. +221 −0 packages/main/src/telegram_execution_context.ts
  63. +44 −0 packages/main/src/types.ts
  64. +17 −0 packages/main/src/types/ChatPermissions.ts
  65. +14 −0 packages/main/src/types/PartialTelegramUpdate.ts
  66. +63 −0 packages/main/src/types/TelegramBusinessMessage.ts
  67. +16 −0 packages/main/src/types/TelegramCallbackQuery.ts
  68. +24 −0 packages/main/src/types/TelegramChat.ts
  69. +5 −0 packages/main/src/types/TelegramCommand.ts
  70. +11 −0 packages/main/src/types/TelegramDocument.ts
  71. +8 −0 packages/main/src/types/TelegramFrom.ts
  72. +10 −0 packages/main/src/types/TelegramInlineQuery.ts
  73. +10 −0 packages/main/src/types/TelegramInlineQueryResult.ts
  74. +17 −0 packages/main/src/types/TelegramInlineQueryResultArticle.ts
  75. +21 −0 packages/main/src/types/TelegramInlineQueryResultPhoto.ts
  76. +21 −0 packages/main/src/types/TelegramInlineQueryResultVideo.ts
  77. +15 −0 packages/main/src/types/TelegramInlineQueryType.ts
  78. +5 −0 packages/main/src/types/TelegramInputMessageContent.ts
  79. +61 −0 packages/main/src/types/TelegramMessage.ts
  80. +11 −0 packages/main/src/types/TelegramMessageEntity.ts
  81. +8 −0 packages/main/src/types/TelegramPhotoSize.ts
  82. +42 −0 packages/main/src/types/TelegramUpdate.ts
  83. +12 −0 packages/main/src/types/TelegramUser.ts
  84. +66 −0 packages/main/src/webhook.ts
  85. +30 −0 packages/main/test/telegram_bot.spec.ts
  86. +8 −0 packages/main/test/tsconfig.json
  87. +19 −0 packages/main/tsconfig.json
  88. +7 −0 packages/main/vitest.config.js
  89. +10 −0 packages/worker/babel.config.json
  90. +11 −0 packages/worker/esbuild.config.js
  91. +18 −0 packages/worker/eslint.config.js
  92. +34 −0 packages/worker/package.json
  93. +393 −0 packages/worker/src/worker.ts
  94. +8 −0 packages/worker/test/tsconfig.json
  95. +19 −0 packages/worker/test/worker.spec.ts
  96. +18 −0 packages/worker/tsconfig.json
  97. +11 −0 packages/worker/vitest.config.js
  98. +1 −0 schema.sql
  99. +2 −0 setup_hooks.sh
  100. +9 −0 vitest.toml
  101. +0 −671 worker.js
  102. +20 −0 wrangler.toml
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
6 changes: 6 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

if ! ( npm run build --workspace=packages && npm run lint --workspace=packages && CI=true npm run test --workspace=packages/main ) ; then
echo "pre-push hook failed with exit status $?"
exit 1
fi
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [codebam]
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/packages/main"
schedule:
interval: "weekly"
allow:
- dependency-type: "all"
versioning-strategy: increase

- package-ecosystem: "npm"
directory: "/packages/worker"
schedule:
interval: "weekly"
allow:
- dependency-type: "all"
versioning-strategy: increase
44 changes: 44 additions & 0 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build pull request
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: latest
registry-url: https://registry.npmjs.org/
- id: node-modules-cache
uses: actions/cache@v3
with:
path: |
node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: node-modules-
- run: npm i
- run: npm ci
- run: npm run lint --workspace=packages
- run: npm run test --workspace=packages
- run: npm run build --workspace=packages
merge-dependabot:
needs: build
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Merge PR
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{ github.token }}
76 changes: 76 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '23 4 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
51 changes: 51 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# ESLint is a tool for identifying and reporting on patterns
# found in ECMAScript/JavaScript code.
# More details at https://github.com/eslint/eslint
# and https://eslint.org

name: ESLint

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '18 17 * * 4'

jobs:
eslint:
name: Run eslint scanning
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install ESLint
run: |
npm install eslint
npm install @microsoft/eslint-formatter-sarif@3.1.0
- name: Run ESLint
env:
SARIF_ESLINT_IGNORE_SUPPRESSED: "true"
run: npx eslint .
--format @microsoft/eslint-formatter-sarif
--output-file eslint-results.sarif
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: eslint-results.sarif
wait-for-processing: true

32 changes: 32 additions & 0 deletions .github/workflows/github-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: publish github package

on:
release:
types: [created]

jobs:
publish-github:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: latest
registry-url: https://npm.pkg.github.com/
- id: node-modules-cache
uses: actions/cache@v3
with:
path: |
node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: node-modules-
- run: npm i
- run: npm ci
- run: npm run lint --workspace=packages
- run: npm run build --workspace=packages
- run: npm publish --workspace=packages/main
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
29 changes: 29 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: publish npm package

on:
release:
types: [created]

jobs:
npm-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: latest
registry-url: https://registry.npmjs.org/
- id: node-modules-cache
uses: actions/cache@v3
with:
path: |
node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
restore-keys: node-modules-
- run: npm i
- run: npm ci
- run: npm run lint --workspace=packages
- run: npm run build --workspace=packages
- run: npm publish --workspace=packages/main
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
target/
dist/
out/
**/*.rs.bk
Cargo.lock
bin/
pkg/
wasm-pack.log
node_modules/
.cargo-ok
*.swp
Session.vim
lerna-debug.log
.tmp/
.wrangler/
.direnv/
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 140,
"singleQuote": true,
"semi": true,
"useTabs": true
}
Loading