** Bot Package** is a Python package that provides a unified interface for three types of bots: Discord, Telegram, and Twitter, all powered by OpenAI’s GPT-4 API. These bots are designed to interact with users, answer questions, and respond to commands in their respective platforms.
- Discord Bot: Responds to commands like
/call
and/ask
and interacts through a modal. - Telegram Bot: Uses commands
/call
and/ask
to provide responses in Telegram chat. - Twitter Bot: Listens for mentions and DMs to respond with AI-generated replies.
- Modular and Scalable: Built with flexibility to add more platforms or commands.
- Python 3.7+
- Environment Variables (stored in
.env
):DISCORD_BOT_TOKEN
TELEGRAM_BOT_TOKEN
TWITTER_API_KEY
TWITTER_API_SECRET
TWITTER_ACCESS_TOKEN
TWITTER_ACCESS_SECRET
OPEN_ROUTER_API_KEY
-
Clone the Repository
git clone https://github.com/tryevertthhub/bot.git cd bots
-
Set Up Environment Variables Create a
.env
file in the root directory with your credentials:DISCORD_BOT_TOKEN=your_discord_token TELEGRAM_BOT_TOKEN=your_telegram_token TWITTER_API_KEY=your_twitter_api_key TWITTER_API_SECRET=your_twitter_api_secret TWITTER_ACCESS_TOKEN=your_twitter_access_token TWITTER_ACCESS_SECRET=your_twitter_access_secret OPEN_ROUTER_API_KEY=your_open_router_api_key
-
Install the Package and Dependencies
cd discord pip install -e .
for telegram bot
cd telegram pip install -e .
for twitter bot
cd twitter pip install -e .
This command installs the package in editable mode along with required dependencies specified in setup.py
.
Once installed, you can start each bot from the command line.
-
Run the Discord Bot
run_discord_bot
-
Run the Telegram Bot
run_telegram_bot
-
Run the Twitter Bot
run_twitter_bot
Each bot has specific commands and interactions:
/call
: The bot replies with a greeting and responds with an AI-generated message./ask
: The bot displays a button for querying. When clicked, it prompts for user input and returns the AI’s response.
/start
: Initiates the bot and displays a welcome message./call
: The bot greets the user and responds with an AI-generated message./ask
: Directly sends the question to the bot and receives an AI response.
- Mentions: The bot listens for tweets mentioning it with commands
/call
or/ask
and replies with an AI-generated message. - Direct Messages: Listens for DMs with /call or
/ask
commands and sends back responses.
The code is modularly organized into different bot files under bot/:
my_bot_package/
├── discord/
│ ├── bot.py # Discord bot functionalities
│ ├── setup.py # Discord bot package configuration
│ ├── readme.md # description for discord bot
├── telegram/
│ ├── bot.py # Telegram bot functionalities
│ ├── setup.py # Telegram bot package configuration
│ ├── readme.md # description for telegram bot
├── twitter/
│ ├── bot.py # Twitter bot functionalities
│ ├── setup.py # Twitter bot package configuration
│ ├── readme.md # description for twitter bot
├── .env # Environment variables
├── README.md # Documentation
└── images/ # Folder for images used in the README
Each bot has an entry point in setup.py, so you can run each directly with:
run_discord_bot
run_telegram_bot
run_twitter_bot
- At first, visit https://discord.com/developers/applications/ click New Application button.
- Next, go to tab
General Information
, and complete bot profile - create bot token, and enable bot settings.
- finally, Add bot permission, and generate bot invite link