pythonpython-3.xdiscorddiscord.pynextcord

Only send messages to Discord without polling(not webhook)


I need to split the message logic and put incoming messages into a message queue before taking them out and running them. But the message queue requires the object to be json serialisable. So I can only pass parameters and rebuild the bot object on another machine.

But it seems many discord python sdk can't work without polling.

In my vision. It should have an API like this:

client(bot_token)
await client.create_message(
            1153xxxxxxxxxxx49, f "message here"!
        ) 

but it not.

How can I build a message and send it with just parameters and a bot Token?


Solution

  • I make some research,finally found some Solution:

    RestAPP https://github.com/hikari-py/hikari#rest-only-applications

    HttpClient https://github.com/nextcord/nextcord/pull/1057