Skip to content

Commit

Permalink
add commands menu
Browse files Browse the repository at this point in the history
  • Loading branch information
opiruyan committed Dec 9, 2023
1 parent b16ada1 commit e9072d5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
The bot is build with framework for telegram bots [grammY](https://grammy.dev) and deployed to [Fly.io](https://fly.io/)

### Environment
To run the bot you need env BOT_TOKEN defined.
To run the bot you need env **BOT_TOKEN** defined.

It can be set either in your local `.env` file or fetched from the [dotenv-vault](https://www.dotenv.org/docs/quickstart).

Workflow of working with dotenv-valut is:
1. you run an app with set env var DOTENV_KEY
1. you run an app with set env var **DOTENV_KEY**
I.e. for bot that would we runing in cli:
```
DOTENV_KEY='<environment_key>' ts-node ./src/Bot.ts
```
2. DOTENV_KEY defined which environment will be loaded
2. **DOTENV_KEY** defined which environment will be loaded
3. you can see the actual env vars either in your .env files or by opening the vault with `npx dotenv-vault keys {environment_name}`. So for production it would be
```
npx dotenv-vault keys production
Expand All @@ -25,11 +25,11 @@ The bot deployed with GitHub actions.

Basics of using it for Fly.io are here - https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

To access `BOT_TOKEN` stored in dotenv-vault pipeline need a `DOTENV_KEY`.
To access **BOT_TOKEN** stored in dotenv-vault pipeline need a **DOTENV_KEY**.

`DOTENV_KEY` is stored as a github [environment secret](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment). Therefore to make it work
1. `DOTENV_KEY` is included to the workflow job as `jobs.<job_id>.environment` (see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#using-an-environment)
2. `DOTENV_KEY` value is saved as Fly `secret` which will be used in a machinve running the app.
**DOTENV_KEY** is stored as a github [environment secret](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment). Therefore to make it work
1. **DOTENV_KEY** is included to the workflow job as `jobs.<job_id>.environment` (see https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#using-an-environment)
2. **DOTENV_KEY** value is saved as Fly `secret` which will be used in a machinve running the app.

### References
https://www.dotenv.org/docs/languages/nodejs/github-actions - CI/CD in Node.js with GitHub Actions
Expand Down
5 changes: 5 additions & 0 deletions src/Bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ bot.on("message:text", (ctx) => {
})

bot.start()

// https://grammy.dev/guide/commands
bot.api.setMyCommands([
{ command: "start", description: "Start the bot" },
])
6 changes: 6 additions & 0 deletions src/Messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export const messages = {
+ ' Выберите наиболее резонирующий в данный момент ответ:',
exerciseOptions_4: ['Созерцание [Развитие]', 'Поддержание [Сохранение]', 'Разрушение [Износ]', 'Наблюдение [Невмешательство]'],


menu: {
start: 'start',
startDesciption: 'Start the practice'
},

help: "Справка",
exit: "Выход",
bye: "Пока!",
Expand Down

0 comments on commit e9072d5

Please sign in to comment.