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)
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 thatNostrum.API
has currently. ThenNostrum.API.Internal
can distinguish between bots based on constants generated by the use macro.To the end user, the change then becomes this:
A simple swap of which module is used.