Skip to content

Commit

Permalink
feat: add JSON data file
Browse files Browse the repository at this point in the history
  • Loading branch information
Vyachowski committed Dec 15, 2023
1 parent 993b439 commit 28269e4
Show file tree
Hide file tree
Showing 4 changed files with 693 additions and 362 deletions.
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
359 changes: 0 additions & 359 deletions src/basicCookBook.js

This file was deleted.

Loading

0 comments on commit 28269e4

Please sign in to comment.