Skip to content

This Discord bot allows you to interact with an API using Discord commands

License

Notifications You must be signed in to change notification settings

Arteiii/OpenAPIToDiscord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAPI to Discord Bot

This Discord bot allows you to interact with an API using Discord commands. It uses Discord.py for the Discord interactions and HTTPx for making API requests. The bot provides functionality to list available API operations, call specific API routes, and check the bot's latency.

Note: This bot was primarily tested with the default FastAPI configuration. Additional changes in the code might be needed to work properly with different APIs.

Features

  • List available API operations with detailed information.
  • Call specific API routes and display the API response.
  • Check bot latency with color-coded status (green for normal, orange for high, red for big latency).

Installation

  1. Clone the repository:

    git clone https://github.com/Arteiii/OpenAPIToDiscord.git
  2. Navigate to the project directory:

     cd OpenAPIToDiscord
  3. Install dependencies using Poetry:

    poetry install

    If you don't have Poetry installed, follow the Poetry installation guide to install it.

  4. Create a .env file in the project root and add your Discord bot token and API base URL:

    DISCORD_BOT_TOKEN=your_discord_bot_token
    API_BASE_URL=your_api_base_url
  5. Run the bot:

    poetry run python -m openapitodiscord

Usage

Discord Commands

  • /list_operations: List available API operations.
  • /call_api <api_route>: Call a specific API route.
  • /ping: Check the bot latency.

Configuration

You can configure the bot by modifying the .env file. Make sure to provide the necessary environment variables for your Discord bot token and API base URL.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This Discord bot allows you to interact with an API using Discord commands

Resources

License

Stars

Watchers

Forks

Languages