Skip to main content

⌨️ Guilded.py console

[!NOTE] Guilded.py console is a fork of Discord.py Console but has been completely rewritten. The only file that uses discord.py-Console's source code is __init__.py

Guilded.py console is a CLI for your Guilded.py bot, with Guilded.py console you can run commands right from your console!

📥 Installation

🪟 Windows

py -3 -m pip install gpy-console

🍎 Linux/macOS

python3 -m pip install gpy-console

⚙️ Example

The implementation is similar to the regular commands in guilded.py. Just implement the gpy-console like this:

import guilded
from gpyConsole import ConsoleClient
from gpyConsole import console_commands

client = ConsoleClient(
    features=guilded.ClientFeatures(official_markdown=True),
)
# can also do "bot = ConsoleBot", see tests/test.py

@client.event
@bot.event
async def on_ready():
    print(f"Logged in as {bot.user}")
    if not bot._console_running:
        bot.start_console()


@client.console_command()
async def hey(
    ctx: console_commands.Context,  # Modified Console Context with less features (.reply and .send are the same)
    channel: guilded.ChatChannel,
    user: guilded.User,
):  # Library automatically converts type annotations, just like in guilded.py
    # Missing converters: guilded.Role, guilded.Member, guilded.ChatMessage, guilded.Attachments
    await ctx.reply(f"Sending message to {user.name} (id: {user.id})")
    await channel.send(
        f"Hello from Console! I'm {client.user.name}, and you are {user.mention}"
    )

client.run(
    "gapi_token"
)

To execute the mentioned command run hey <valid_channel_id> <valid_user_id>.

🔗 Links

No links currently

gpyConsole: things to know

The console has to be started manually. Try something like this:

@bot.event
async def on_ready():
    print(f"Logged in as {bot.user}")
    if not bot._console_running:
        bot.start_console()

Missing Converters

Any converter that relies on the local server will not be available. This includes:

  • guilded.Role
  • guilded.Member
  • guilded.ChatMessage
  • guilded.Attachment

New Events

New events were added that are accessible like any other guilded.py event.

  • on_console_command_completion
  • on_console_command
  • on_console_command_error
  • on_console_message

Console Cogs

All cogs should be replaced with a ConsoleCog; it implements guilded.py's Cog feature so it will work the same.

from gpyConsole import console_commands
from guilded.ext import commands


class ExampleCog(console_commands.ConsoleCog):
    def __init__(self, bot: console_commands.ConsoleBot):
        self.bot = bot

    @console_commands.console_command()
    async def hello(self, ctx: console_commands.Context):
        return await ctx.reply("Hello from cog!")

    @commands.command()
    async def wow(self, ctx: commands.Context):
        await ctx.send("Wow! Cog worked!")


def setup(bot: console_commands.ConsoleBot):
    bot.add_cog(ExampleCog(bot))

You can stop the console

if bot._console_running:
    bot.stop_console()

Release files for gpy-console 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpy-console 0.2.3
File Size Uploaded
gpy_console-0.2.3.tar.gz 32.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gpy-console 0.2.3
File Interpreter ABI Platform
gpy_console-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 66.3 kB

Release files / gpy_console-0.2.3.tar.gz

Download URL gpy_console-0.2.3.tar.gz
Size 32.3 kB
Tags Source
SHA-256 checksum
How to use checksums
54d0adedf7e437c693eb74881896170bf35dcaabfd7428a04b0d1a3efb42d798
BLAKE2b-256 checksum
How to use checksums
f9937713fc0530ba6e2dc4764d6dc5a37fdb9c17895c3a55833cf991bddac0f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / gpy_console-0.2.3-py3-none-any.whl

Download URL gpy_console-0.2.3-py3-none-any.whl
Size 34.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba183709e12e08a74563194153441dd4fccd5a03a886b15afc833515a4046bd1
BLAKE2b-256 checksum
How to use checksums
a2a88933223d6d228b73d8c52354141339a51d597096cf486ba6f07c0c22109c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page