twilight-rs / twilight

Powerful, flexible, and scalable ecosystem of Rust libraries for the Discord API.
https://discord.gg/twilight-rs
ISC License
686 stars 133 forks source link

Improve new user documentation #1629

Open vilgotf opened 2 years ago

vilgotf commented 2 years ago

Development best practices for twilight are currently hard to discover. For example, most bots developed with twilight will have a Context struct like this:

pub struct Context {
    pub cache: InMemoryCache,
    pub cluster: Cluster,
    pub http: Client,
    // etc.
}

Structuring one's code like this brings two major advantages:

  1. Methods on Context need only take &self instead of InMemoryCache, Cluster etc.
  2. You only need one Arc for multi-threading

But only /examples/lavalink-basic-bot implement this scheme, so it's not easily discoverable for new users.

lavalink-basic-bot is also the only example of a fully functional bot, I believe new users would find additional, longer examples useful.

laralove143 commented 1 year ago

twilight's support for the tracing crate goes unnoticed unless people look at examples, most libs mention it, optionally linking to the readme or docs of the crate. i think this used to be the case with twilight, it'd be nice to have it back