Skip to content

KunalSiyag/TelBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🐾 Mad Dog Telegram Bot

A Python-based Telegram bot that uses the Groq API to provide intelligent, context-aware responses. The bot acts as a "Mad Dog" persona (or any persona you define), using a local text file to guide its behavior and knowledge.

✨ Features

  • LLM Integration: Powered by Groq for lightning-fast inference using models like Llama 3 or Mixtral.

  • Contextual Memory: Loads a SUMMARY.txt file to act as the "System Prompt," giving the bot a consistent personality or knowledge base.

  • Custom Commands: * /bhaw: Sends a dog photo and a playful LLM-generated caption.

  • /biscuits: A quick way to ask the bot about its favorite treats.

  • /bones: Interactive response about bones.

  • Group Chat Ready: Responds to direct messages or mentions in group chats.

  • Asynchronous: Built with python-telegram-bot and httpx for efficient, non-blocking performance.


🚀 Getting Started

1. Prerequisites

2. Installation

Clone the repository and install the required dependencies:

pip install python-telegram-bot httpx python-dotenv

3. Configuration

Create a .env file in the root directory and add your credentials:

TELEGRAM_TOKEN=your_telegram_bot_token_here
GROQ_API_KEY=your_groq_api_key_here
GROQ_MODEL=llama3-8b-8192

4. Setup the Persona

Create a file named SUMMARY.txt in the same directory. Write a description of how the bot should behave. For example:

"You are a helpful but slightly chaotic dog named Mad Dog. You love treats, hate mailmen, and speak in a friendly, energetic tone. Use dog puns often."

5. Run the Bot

python bot.py

🛠️ Project Structure

File Description
bot.py The main application logic and Telegram handlers.
SUMMARY.txt The context/personality file used by the LLM.
.env (Hidden) Stores sensitive API keys and configuration.

🤖 Command Reference

  • Texting the Bot: Simply send any message to get an LLM-generated response based on your SUMMARY.txt.
  • /bhaw - Triggers a photo response + text.
  • /biscuits - Ask about snacks.
  • /bones - Talk about bones.

⚠️ Important Notes

  • API Costs/Limits: Be mindful of your Groq API usage limits.
  • Security: Never commit your .env file to version control (GitHub/GitLab).
  • Model Names: Ensure the GROQ_MODEL in your .env matches a valid model ID from the Groq documentation (e.g., llama3-70b-8192).

🤝 Contributing

Looking for a way to contribute? Check out our Issues labeled good first issue.

  1. Fork the Project
  2. Create your Feature Branch
  3. Commit your Changes
  4. Open a Pull Request

It was just a fun project and hence didnt add a "memory" feature so the bot remembers the last few messages of the conversation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages