feat: Add Server Context Support
This is a straightforward solution to #620, implementing a CommandContext.serverContext property that can be defined by the Server.
CommandContext.serverContext is naturally a generic of the default type unknown, leaving the user responsible for determining its type and handling casts accordingly. This fits with the use case of CloudFlare Workers, as its structure changes depending on how bindings are defined.
Consequently, this PR enables using Durable Objects and D1 databases in bots. Through the use of Durable Objects, many things that could only previously be achieved in stateful workflows can now be achieved in serverless.
By the way, I can also work on documenting this if you'd like. This is a super minimal implementation that I came up with in about an hour to allow me to use D1 in a bot of mine.
I like the implementation, I'd also like to extend this implementation towards the other contexts, you'd probably be better to extend from BaseInteractionContext and move the context down the line.
Another thing I'd like to do as a whole cloudflare worker focused update is to automatically get the variables for the discord app ID, token, and public key while responding to a request, since the env can only be fetched on request. Using this will probably be easier to do that later.
This does look better! I'll keep playing to see if I can find a way to make type inference work better in a subsequent PR
Cool, the only thing to do now is to put server contexts in BaseInteractionContext so things like autocomplete can make use of it.