Skip to main content

None

Project description

Introduction to Dismake

Dismake Logo Pypi v

Dismake is a robust framework designed to assist you in developing stateless and independent Discord bots that employ Slash Commands. The framework is built on top of the FastAPI, a high-performance Python web framework, making it easy to use, efficient, and speedy.

☢️ Prerequisites

  • Dismake requires Python 3.9 or later versions to work correctly.
  • Discord Bot token

🏁 Getting Started with Dismake

Before you start using Dismake, you'll need to create a new Discord application and add a bot to it.

💻 Installing

To install Dismake, use the following command to install it directly from PyPI:

pip install dismake

🤖 Creating a Minimal Discord Bot with Dismake

Let's create a basic bot that echoes user text back to them.

Create a new Python file named main.py, and copy and paste the following code:

import dismake
from dismake import commands
import typing

app = dismake.Bot(...)

@app.event('ready')
async def ready_event():
    print(f"Logged in as {app.user}.")

@app.command(
    name="echo",
    description="A simple echo command."
)
async def echo_command(
    ctx: dismake.Context, 
    text: typing.Annotated[
        str,
        commands.Option(name="text", description="Type something"), type=str
    ]
):
    await ctx.respond(f"{text}")

if __name__ == "__main__":
    app.run(app="main:app", reload=True)

The code above demonstrates how to use Dismake to create a basic Discord bot that responds to slash commands.

Here's a brief explanation of what each part of the code does:

  • The first line imports the Dismake library. Make sure you've installed Dismake before you run the code.
  • Next, we create a new instance of the Dismake.Bot class, which serves as our connection to Discord.
  • We register an event using the Dismake.Bot.event() decorator. This library provides numerous events, and we use this callback to perform asynchronous operations once the bot is logged in.
  • We register a slash command using the Dismake.Bot.command() decorator. This decorator requires the command's name and description as arguments.
  • In the function that handles the command, we use the Dismake.Context object to interact with Discord. We take the user's input text and echo it back to them.
  • Finally, we use the app.run() method to start the bot. We've named our bot app in this example. The second argument, reload=True, instructs Uvicorn to reload the app automatically when changes are made to the code.

To run the bot, open the terminal, navigate to the directory containing main.py, and enter the following command:

python main.py

You can now experiment with your basic bot.

✨ Features

  • Easy-to-use and intuitive framework for building Discord bots with Slash Commands
  • Built on top of the FastAPI web framework, providing a high-performance and efficient backend
  • Fully customizable with support for middleware, extensions, and custom context classes
  • Supports easy integration with databases, message queues, and other external services
  • Provides a convenient and powerful way to define and manage Slash Commands and their options
  • Includes built-in command validation and error handling for cleaner and more maintainable code

📖 Documentation

For detailed usage and installation instructions, please check out the official Dismake documentation

🏥 Support

If you have any questions or issues with Dismake, please feel free to reach out to us on the Discord server.

🗺️ Roadmap

For details about our roadmap, please check out our Roadmap page.

🤝 Contributing

We welcome contributions from anyone! If you want to contribute to Dismake, please follow these guidelines:

• Contributing to the Documentation

The documentation is generated with Nextra. If you want to contribute to the documentation, please do the following:

  1. Clone the repository.
  2. Navigate to the /docs directory.
  3. Run npm install to install the required dependencies.
  4. Run npm run dev to start the development server.
  5. Make your changes, push and create a pull request.

• Contributing to the Dismake Package

If you want to contribute to the Dismake package or report an issue, please do the following:

  1. Fork the repository.
  2. Make your changes.
  3. Format your code
  4. Test your code & push.
  5. Create a pull request.

Thank you for contributing!

🪪 License

Dismake is released under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dismake-0.0.23.tar.gz (35.6 kB view details)

Uploaded Source

File details

Details for the file dismake-0.0.23.tar.gz.

File metadata

  • Download URL: dismake-0.0.23.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.0

File hashes

Hashes for dismake-0.0.23.tar.gz
Algorithm Hash digest
SHA256 6f1e936b82d12f2a0ec384dd1f677c2d1ce3292a03503c9fcb204a2557bea4be
MD5 5b9c7b3a336278d1f34ace81f4ab0388
BLAKE2b-256 5f34334f89f466210189544d8e9d89b3f486f88f7db5c6e0a59b34541a7ae53f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page