Skip to content

tryevertthhub/bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bot Package

** 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.

Features

  • 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.

Getting Started

Prerequisites

  • 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

Installation

  1. Clone the Repository

    git clone https://github.com/tryevertthhub/bot.git
    cd bots
    
  2. 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
    
  3. 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.

Usage

Once installed, you can start each bot from the command line.

  1. Run the Discord Bot

    run_discord_bot
  2. Run the Telegram Bot

    run_telegram_bot
  3. Run the Twitter Bot

    run_twitter_bot

Commands and Functionalities

Each bot has specific commands and interactions:

Discord Bot Commands

  • /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.

Telegram Bot Commands

  • /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.

Twitter Bot Actions

  • 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.

Code Structure

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

Entry Points and Package Structure

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

Bot Install Guide

Discord bot

  • At first, visit https://discord.com/developers/applications/ create bot click New Application button.
  • Next, go to tab General Information, and complete bot profile complete bot profile
  • create bot token, and enable bot settings.  create bot token
  • finally, Add bot permission, and generate bot invite link generate  bot url

Telegram bot

  • Open Telegram, and search @BotFather bot father
  • click start button and input /newbot to create bot. bot father
  • comple bot profile (name and id) bot info

Twitter bot

  • go to developer.twitter.com and log in with an existing account

  • Create a Twitter project and app create twitter bot

  • Create bot token api key create twitter bot token

  • Edit bot setting create twitter bot token

License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages