diff options
Diffstat (limited to 'examples/03_struct_utilities/src')
| -rw-r--r-- | examples/03_struct_utilities/src/main.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/03_struct_utilities/src/main.rs b/examples/03_struct_utilities/src/main.rs index 6bf436d..8334b71 100644 --- a/examples/03_struct_utilities/src/main.rs +++ b/examples/03_struct_utilities/src/main.rs @@ -21,7 +21,17 @@ fn main() { client.on_message(|_context, message| { if message.content == "!messageme" { - let _ = message.author.dm("Hello!"); + // If the `methods` feature is enabled, then model structs will + // have a lot of useful methods implemented, to avoid using an + // often otherwise bulky Context, or even much lower-level `rest` + // method. + // + // In this case, you can direct message a User directly by simply + // calling a method on its instance, with the content of the + // message. + if let Err(why) = message.author.dm("Hello!") { + println!("Error when direct messaging user: {:?}", why); + } } }); @@ -29,5 +39,7 @@ fn main() { println!("{} is connected!", ready.user.name); }); - let _ = client.start(); + if let Err(why) = client.start() { + println!("Client error: {:?}", why); + } } |