Skip to content

Callback loading bug #20

Description

@julien777z

Since commands and callbacks are on each client, calling the decorators snowfin.slash_command, snowfin.select_callback, etc., does not work as it doesn't load the callbacks into the client. Tested with https://github.com/KAJdev/snowfin/blob/main/examples/deferred_example.py and https://github.com/KAJdev/snowfin/blob/main/examples/component_example.py.

It seems like it requires it to be a Module, and load_module() must be called in order to properly load the callbacks into the client.

Simple non-working example:

import snowfin
from snowfin.models import Interaction
import asyncio

bot = snowfin.Client(...)


@snowfin.slash_command(name="hello")
async def on_slash(context: Interaction):
    return snowfin.DeferredResponse(on_slash_defer)

async def on_slash_defer(context: Interaction):
    await asyncio.sleep(1)
    return snowfin.MessageResponse('Ok, *Now* I want to respond ;)')


bot.run("0.0.0.0", 8000, debug=True, auto_reload=True)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions