Skip to content

Latest commit

 

History

History
117 lines (78 loc) · 4.69 KB

README.rst

File metadata and controls

117 lines (78 loc) · 4.69 KB

Voltage

Revolt Support Server PyPi Page. Docs Status GitHub Workflow Status

A simple pythonic asynchronous API wrapper for Revolt.

Screenshot Of Starting A Bot.

Usage

import voltage  # Import voltage.

client = voltage.Client()  # Initialize the client.


@client.listen("ready")  # Listen to an event.
async def on_ready():
    print(f"Logged in as {client.user}")


@client.listen("message")
async def on_message(message):  # Doesn't matter what you call the function.
    if message.content == "-ping":
        await message.channel.send("pong!")  # Send a message.
    elif message.content == "-embed":
        embed = voltage.SendableEmbed(title="Hello World", description="This is an embed")  # Create an embed.
        # Reply to a message.
        await message.reply(embed=embed)

# Run the client which is an abstraction of calling the start coroutine.
client.run("TOKEN")  # Replace with your token.

Commands framework example:

import voltage
from voltage.ext import commands # Import the commands module from ``voltage.ext``

client = commands.CommandsClient("-") # Create a CommandsClient (client that has commands (original ik)) with the prefix set to "-".

@client.listen("ready") # You can still listen to events.
async def ready():
    print("Gaaah, It's rewind time.")

@client.command() # Register a command using the ``command`` decorator.
async def ping(ctx):
    """Sends Pong!""" # Name and description can be passed in the decorator or automatically inferred.
    await ctx.reply("Pong") # Reply to the context's message.

client.run("TOKEN") # Again, replace with your bot token.

For more examples check the examples folder which has a lot of useful, ready to go, and explained examples.

Installation

Voltage is available on PyPI!

To install voltage just run:

pip install voltage

If you want to install the main branch which may have more features but will be more unstable you run:

pip install git+https://github.com/EnokiUN/voltage

Note

Python 3.8 or higher is required to install voltage.

Installing from GitHub requires the Git CLI to be available on your machine.

Credits

  • Contributors, thank you :)
  • Revolt.py, when shit broke, that's where I went.
  • Revolt.js, when the docs fail you.
  • Discord.py, also a really great help while making this.
  • Revolt development team, absolute chads.
  • FatalErrorCoded, Vortex guys, carrying with voice implementation, eats chadness.
  • RGBCube, Came up with the amazing name "Voltage".