-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9089b13
Showing
32 changed files
with
6,741 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"recommendations": [ | ||
"denoland.vscode-deno", | ||
"editorconfig.editorconfig", | ||
"davidanson.vscode-markdownlint", | ||
"esbenp.prettier-vscode" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch via npm", | ||
"type": "node", | ||
"request": "launch", | ||
"cwd": "${workspaceFolder}", | ||
"runtimeExecutable": "deno", | ||
"runtimeArgs": ["--inspect", "--allow-net", "index.ts"], | ||
"port": 8001 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { "source.fixAll": true }, | ||
"deno.enable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 KnorpelSenf | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# **grammY** _—Telegram Bot Framework for Deno and Node_ | ||
|
||
## Features | ||
|
||
- Super easy to learn | ||
- Lightning fast | ||
- Outstanding `TypeScript` support | ||
- Full Telegram Bot API 5.1 support (with 100 % type coverage) | ||
- Scales up when your bot does | ||
|
||
## Quickstart | ||
|
||
grammY was written for both Deno and Node. | ||
You can write your bot with both `TypeScript` and `JavaScript`. | ||
|
||
Choose your platform: | ||
|
||
**[Deno](./deno)** (recommended) | ||
|
||
**[Node](./node-backport)** | ||
|
||
## Resources | ||
|
||
grammY Documentation | ||
|
||
grammY API Reference | ||
|
||
Telegram Bot API Reference (Official) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 4 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
max_line_length = 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"tabWidth": 4, | ||
"semi": false, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# grammY for Deno | ||
|
||
If you haven't already, install Deno. | ||
|
||
```shellscript | ||
curl -fsSL https://deno.land/x/install/install.sh | sh | ||
``` | ||
|
||
## Quickstart | ||
|
||
### Simple example | ||
|
||
Talk to [@BotFather](https://t.me/BotFather) to create a new Telegram bot and obtain a _bot token_. | ||
|
||
Paste the following code into a new file `example-bot.ts`. | ||
|
||
```ts | ||
import { Bot } from 'https://deno.land/x/grammy' | ||
|
||
// Create bot | ||
const bot = new Bot('<your-bot-token>') | ||
|
||
// Listen for messages | ||
bot.command('start', ctx => ctx.reply('Welcome! Send me your pics!')) | ||
bot.on('message:photo' ctx => ctx.reply('Nice photo!')) | ||
|
||
// Launch! | ||
bot.launch() | ||
``` | ||
|
||
**Congratulations!** | ||
You have successfully created your first Telegram bot for Deno. | ||
|
||
You can run it like so: | ||
|
||
```shellscript | ||
deno --allow-net example-bot.ts | ||
``` | ||
|
||
### Advanced example | ||
|
||
TODO: create more complicated example | ||
|
||
```ts | ||
const token = Deno.env.get('BOT_TOKEN') | ||
``` | ||
|
||
```shellscript | ||
deno --allow-net --allow-env example-bot.ts | ||
``` |
Oops, something went wrong.