Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON data file management #3

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Some restrictions for this project:

## Getting Started

Now only available from a Node.js...
Bot is available in telegram: [Bity Smarty Bot](https://t.me/bity_smarty_bot)

### Key dependencies

Expand Down Expand Up @@ -64,10 +64,6 @@ Now only available from a Node.js...
* Create a database with different recipes: **JsonDB**
* Update telegram bot with ability to pin messages

### Executing program

Telegram bot will be available soon...

## Authors

Feel free to contact me and help with the project
Expand Down
8 changes: 6 additions & 2 deletions bin/bot.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Bot } from 'grammy';
import * as fs from 'fs';
import { getIntroMessage, provideMenuWithGroceryList } from '../src/index.js';
import { basicCookBook } from '../src/basicCookBook.js';

const basicRecipes = JSON
.parse(fs.readFileSync('./src/basicCookbook.json', 'utf-8'))
.recipes;

const bot = new Bot(process.env.BOT_TOKEN);

Expand All @@ -10,7 +14,7 @@ bot.command('start', async (ctx) => {
});

bot.command('menu', async (ctx) => {
const menuWithGroceryList = provideMenuWithGroceryList(basicCookBook);
const menuWithGroceryList = provideMenuWithGroceryList(basicRecipes);

await ctx.reply(menuWithGroceryList.menuText);
await ctx.reply(menuWithGroceryList.groceryListText);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bity-smarty",
"version": "1.0.0",
"version": "0.1.1",
"description": "Bity Smarty – a small bot for providing a week diet and grocery list",
"main": "src/index.js",
"bin": {
Expand Down
Loading