You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we will need sooner that I thought the module-creator.
Many benefits, one of them is you don't have to import the type BotModule anymore, and it will be far easier to pass something to a feature (especially if the thing passed to the feature depends on the module definition).
For now, I imagine something like :
exportconstmyModule=createModule((ctx)=>({env: {MY_ENV_VAR: z.string().optionnal()},storage: {channelList: z.string().array()},slashCommands: {/*...*/},eventHandlers: {messageCreate: async()=>{// Here I would be able to use ctx.env and ctx.storageconsole.log(ctx.storage.channelList)// typesafe + can be validated}},}));
Problem
I've notices that even after the new module abstraction we still have to wire some of the stuff outside of the module.
to name a few :
src/config.ts
src/core/cache.ts
Solution
To fix the leaky abstraction, we should allow users to provide this configuration within the scope of their module.
I'm keen into taking a shot at this next time I work on the bot.
The text was updated successfully, but these errors were encountered: