mirror of
https://github.com/abocn/TelegramBot.git
synced 2025-04-28 17:15:57 +00:00
Base files added
This commit is contained in:
commit
2eb6934b23
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.env
|
||||||
|
node_modules
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2024 Lucas Gabriel
|
||||||
|
|
||||||
|
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.
|
20
README.md
Normal file
20
README.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Lynx (Node.js Telegram Bot)
|
||||||
|
Welcome to the Lynx source code!
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
- Node.js
|
||||||
|
- node-telegram-bot-api
|
||||||
|
|
||||||
|
## Develop or contribute with Lynx
|
||||||
|
First, create a ``config.env`` file and put the content below:
|
||||||
|
```
|
||||||
|
# insert your bot token here
|
||||||
|
# get it with @BotFather on Telegram
|
||||||
|
TGBOT_TOKEN=0000000000:AAAaaAAaaaaAaAaaAAAaaa_aaaaAAAAAaaa
|
||||||
|
```
|
||||||
|
Put your bot token that you created at [@BotFather](https://t.me/botfather) at the variable ``TGBOT_TOKEN`` (as the example above) and save the file.
|
||||||
|
|
||||||
|
At last, run the bot with ``npm start``.
|
||||||
|
|
||||||
|
## License
|
||||||
|
MIT - 2024 Lucas Gabriel (lucmsilva).
|
1603
package-lock.json
generated
Normal file
1603
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
28
package.json
Normal file
28
package.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"name": "lynx",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "A simple Telegram bot made in Node.js",
|
||||||
|
"main": "src/lynx_main.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node --env-file=config.env src/lynx_main.js"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/lucmsilva651/lynx.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"node",
|
||||||
|
"telegram",
|
||||||
|
"telegram-bot"
|
||||||
|
],
|
||||||
|
"author": "Lucas Gabriel (lucmsilva)",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/lucmsilva651/lynx/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/lucmsilva651/lynx#readme",
|
||||||
|
"dependencies": {
|
||||||
|
"node-telegram-bot-api": "^0.63.0"
|
||||||
|
}
|
||||||
|
}
|
12
src/lynx_main.js
Normal file
12
src/lynx_main.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
const TelegramBot = require('node-telegram-bot-api');
|
||||||
|
const token = process.env.TGBOT_TOKEN; // config.env
|
||||||
|
const bot = new TelegramBot(token, { polling: true });
|
||||||
|
|
||||||
|
bot.on('message', (msg) => {
|
||||||
|
const chatId = msg.chat.id;
|
||||||
|
const messageText = msg.text;
|
||||||
|
|
||||||
|
if (messageText === '/start') {
|
||||||
|
bot.sendMessage(chatId, "Welcome to Lynx!\n\nI was made with love by Lucas Gabriel (lucmsilva)!\n\nCheck out my source code:\nhttps://github.com/lucmsilva651/lynx");
|
||||||
|
}
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user