-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Other changes: – update linter rules – update recipes data – add new dependencies
- Loading branch information
1 parent
6bcfbe8
commit 5a3df70
Showing
10 changed files
with
596 additions
and
130 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
--- | ||
|
||
plugins: | ||
- jest | ||
|
||
# https://eslint.org/docs/user-guide/configuring#specifying-environments | ||
env: | ||
node: true | ||
|
||
extends: | ||
- 'airbnb-base' | ||
- 'plugin:jest/recommended' | ||
|
||
parserOptions: | ||
ecmaVersion: latest | ||
|
||
rules: | ||
no-console: 0 | ||
import/extensions: | ||
- error | ||
- ignorePackages | ||
- js: always | ||
no-underscore-dangle: [2, { "allow": ["__filename", "__dirname"] }] |
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 |
---|---|---|
@@ -1 +1 @@ | ||
node-options=--experimental-vm-modules | ||
node-options=--no-warnings --experimental-vm-modules |
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 |
---|---|---|
@@ -1,22 +1,20 @@ | ||
#!/usr/bin/env node --env-file=.env | ||
import { Bot } from 'grammy'; | ||
|
||
const getIntroMessage = (type) => { | ||
const welcomeMessage = "Hi! Let me introduce you 'Bity Smarty' – a special bot that can provide a healthy diet and a grocery list for your next shopping.\n\n"; | ||
const featureMessage = 'Here is 5 main features of this bot:\n' | ||
+ '1. Save your time: Only 1 hour for cooking per 3 day!\n' | ||
+ '2. No complex equipment. Just a multi cooker to start!\n' | ||
+ '3. Healthy diet with fancy recipes that looks great\n' | ||
+ '4. Most recipes can be easily stored in the fridge or in the freezer\n' | ||
+ '5. And to make it even tastier – It is completely free :)'; | ||
return (type === 'welcome' ? welcomeMessage : featureMessage); | ||
}; | ||
import { getIntroMessage, provideMenuWithGroceryList } from '../src/index.js'; | ||
import { basicCookBook } from '../src/basicCookBook.js'; | ||
|
||
const bot = new Bot(process.env.BOT_TOKEN); | ||
|
||
bot.onText(/\/start/, (msg) => { | ||
const chatId = msg.chat.id; | ||
const userId = msg.from.id; | ||
bot.command('start', async (ctx) => { | ||
await ctx.reply(getIntroMessage('welcome')); | ||
await ctx.reply(getIntroMessage('features')); | ||
}); | ||
|
||
bot.command('menu', async (ctx) => { | ||
const menuWithGroceryList = provideMenuWithGroceryList(basicCookBook); | ||
|
||
bot.sendMessage(chatId, `ID: ${userId}. Chat ID: ${chatId}\n\n${getIntroMessage('welcome')}`).then(() => true); | ||
await ctx.reply(menuWithGroceryList.menuText); | ||
await ctx.reply(menuWithGroceryList.groceryListText); | ||
}); | ||
|
||
bot.start().then((r) => r).catch((e) => e); |
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 |
---|---|---|
|
@@ -4,6 +4,5 @@ | |
"src/", | ||
".env" | ||
], | ||
"ext": ".js", | ||
"exec": "node --env-file=.env bin/index.js" | ||
"ext": ".js" | ||
} |
Oops, something went wrong.