Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple bots support #327

Open
khionu opened this issue Sep 16, 2021 · 1 comment
Open

Multiple bots support #327

khionu opened this issue Sep 16, 2021 · 1 comment

Comments

@khionu
Copy link
Contributor

khionu commented Sep 16, 2021

Problem

Nostrum's current design makes it very hard to have multiple bots running in the same BEAM runtime.

Solution

I'm going to take this problem into account with my refactor of #317, so no further architectural changes will be necessary. API changes however are unavoidable for this.

The simplest solution I can think of is a use macro that reimplements Nostrum.API on a user module, with the same API that Nostrum.API has currently. Then Nostrum.API.Internal can distinguish between bots based on constants generated by the use macro.

To the end user, the change then becomes this:

- result = Nostrum.API.api_function(args)
+ result = MyBots.BotAlpha.api_function(args)

A simple swap of which module is used.

@sascha-wolf
Copy link

Is this still on the roadmap? :)

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

No branches or pull requests

3 participants