diff options
| author | Maiddog <[email protected]> | 2017-06-03 16:33:46 -0500 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-06-03 14:33:46 -0700 |
| commit | c00f3490f2fb0c045c2da72d850f70da8e2cdb95 (patch) | |
| tree | dc249377dae54eaac823d82c0764c314ba653cdd /src/model/gateway.rs | |
| parent | Fix compilations across feature combinations (diff) | |
| download | serenity-c00f3490f2fb0c045c2da72d850f70da8e2cdb95.tar.xz serenity-c00f3490f2fb0c045c2da72d850f70da8e2cdb95.zip | |
Add some model docs, deprecate Role::edit_role
Deprecate `Role::edit_role` and rename it to `Role::edit`.
Diffstat (limited to 'src/model/gateway.rs')
| -rw-r--r-- | src/model/gateway.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/model/gateway.rs b/src/model/gateway.rs index 52ec9b0..8458bbb 100644 --- a/src/model/gateway.rs +++ b/src/model/gateway.rs @@ -39,6 +39,23 @@ impl Game { /// Creates a `Game` struct that appears as a `Playing <name>` status. /// /// **Note**: Maximum `name` length is 128. + /// + /// # Examples + /// + /// Create a command that sets the current game being played: + /// + /// ```rust,no_run + /// # #[macro_use] extern crate serenity; + /// # + /// use serenity::model::Game; + /// + /// command!(game(ctx, _msg, args) { + /// let name = args.join(" "); + /// ctx.set_game(Game::playing(&name)); + /// }); + /// # + /// # fn main() {} + /// ``` pub fn playing(name: &str) -> Game { Game { kind: GameType::Playing, @@ -50,6 +67,24 @@ impl Game { /// Creates a `Game` struct that appears as a `Streaming <name>` status. /// /// **Note**: Maximum `name` length is 128. + /// + /// # Examples + /// + /// Create a command that sets the current game and stream: + /// + /// ```rust,no_run + /// # #[macro_use] extern crate serenity; + /// # + /// use serenity::model::Game; + /// + /// // Assumes command has min_args set to 2. + /// command!(stream(ctx, _msg, args, stream: String) { + /// let name = args[1..].join(" "); + /// ctx.set_game(Game::streaming(&name, &stream)); + /// }); + /// # + /// # fn main() {} + /// ``` pub fn streaming(name: &str, url: &str) -> Game { Game { kind: GameType::Streaming, |