forked from irazasyed/telegram-bot-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Dmitry Sorokin (@sorydima) edited this page Nov 26, 2024
·
1 revision
Below is a basic structure for a GitHub Wiki for the repository https://github.com/MarinaModaMusicProd/telegram-bot-sdk.git
. You can customize this to fit the specific details and features of your SDK.
# Telegram Bot SDK for MarinaModaMusicProd
Welcome to the **Telegram Bot SDK** Wiki! 🎵
This SDK simplifies the creation and management of Telegram bots, tailored to integrate with music production and creative projects. Use it to streamline workflows, manage chats, and enhance user engagement.
### Key Features
- **Easy Setup**: Quickly integrate with your Telegram account.
- **Custom Commands**: Define bot behaviors with minimal coding.
- **Music Integration**: Leverage features designed for music-based projects.
- **Extensible**: Add custom modules and features effortlessly.
Get started by exploring the guides below!
# Getting Started
### Prerequisites
Before using the SDK, ensure you have the following:
- **Node.js** (v16+ recommended)
- **Telegram Bot Token**: Obtain it from [BotFather](https://core.telegram.org/bots#botfather).
- **Git** for cloning the repository.
### Installation
Clone the repository:
```bash
git clone https://github.com/MarinaModaMusicProd/telegram-bot-sdk.git
cd telegram-bot-sdk
Install dependencies:
npm install
-
Create a
.env
file in the project root:TELEGRAM_BOT_TOKEN=your-telegram-bot-token
-
Start the bot:
npm start
-
Your bot is live and ready to receive messages!
---
#### **3. Configuration**
```markdown
# Configuration
### Environment Variables
The SDK relies on the following environment variables:
| Variable | Description |
|--------------------|--------------------------------------|
| `TELEGRAM_BOT_TOKEN` | The token for your Telegram bot. |
| `PORT` | (Optional) Port for the local server.|
### Config File
You can also define settings in `config.json`:
```json
{
"botToken": "your-telegram-bot-token",
"allowedUpdates": ["message", "callback_query"]
}
---
#### **4. Command Usage**
```markdown
# Command Usage
### Defining Commands
Commands are defined in the `commands/` directory. Each file corresponds to a specific command.
Example: `commands/start.js`
```javascript
module.exports = {
command: "/start",
description: "Welcome message",
execute(ctx) {
ctx.reply("Welcome to the MarinaModaMusicProd Telegram bot!");
},
};
- Create a new file in
commands/
(e.g.,commands/help.js
). - Export the command and its functionality.
- Restart the bot to apply changes.
-
/start
: Initiates the bot and sends a welcome message. -
/help
: Provides a list of available commands.
---
#### **5. Advanced Features**
```markdown
# Advanced Features
### Middleware
Use middleware for custom processing of messages:
```javascript
bot.use((ctx, next) => {
console.log("New message:", ctx.message.text);
next();
});
Easily create interactive buttons:
bot.on("message", (ctx) => {
ctx.reply("Choose an option:", {
reply_markup: {
inline_keyboard: [
[{ text: "Option 1", callback_data: "option1" }],
[{ text: "Option 2", callback_data: "option2" }],
],
},
});
});
Switch to webhook mode by running:
npm run webhook
---
#### **6. FAQ**
```markdown
# FAQ
### How do I deploy the bot?
You can deploy the bot on platforms like Heroku, AWS, or Google Cloud. Refer to the **Deployment Guide** for more details.
### Can I add custom modules?
Yes! Use the `modules/` directory to add your custom integrations.
### How do I report issues?
Create an issue in the [GitHub Issues](https://github.com/MarinaModaMusicProd/telegram-bot-sdk/issues) section, providing detailed information about the problem.
# Contribution Guidelines
We welcome contributions to the Telegram Bot SDK! 🎉
### How to Contribute
1. Fork the repository.
2. Create a new branch for your feature/bugfix:
```bash
git checkout -b feature-name
- Commit your changes with clear messages.
- Push the branch and create a Pull Request.
- Follow JavaScript best practices.
- Ensure all changes pass the linter:
npm run lint
Reporting Issues
- Use the Issues tab for bug reports or feature requests.