diff options
Diffstat (limited to 'examples/04_message_builder/src')
| -rw-r--r-- | examples/04_message_builder/src/main.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/examples/04_message_builder/src/main.rs b/examples/04_message_builder/src/main.rs index 41f390b..2712fe6 100644 --- a/examples/04_message_builder/src/main.rs +++ b/examples/04_message_builder/src/main.rs @@ -21,15 +21,20 @@ fn main() { }, }; + // The message builder allows for creating a message by mentioning + // users dynamically, pushing "safe" versions of content (such as + // bolding normalized content), displaying emojis, and more. let response = MessageBuilder::new() .push("User ") - .mention(message.author) + .push_bold_safe(&message.author.name) .push(" used the 'ping' command in the ") .mention(channel) .push(" channel") .build(); - let _ = context.say(&response); + if let Err(why) = context.say(&response) { + println!("Error sending message: {:?}", why); + } } }); @@ -37,5 +42,7 @@ fn main() { println!("{} is connected!", ready.user.name); }); - let _ = client.start(); + if let Err(why) = client.start() { + println!("Client error: {:?}", why); + } } |