File tree Expand file tree Collapse file tree 3 files changed +17
-13
lines changed
e02_transparent_guild_sharding/src Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Original file line number Diff line number Diff line change 1+ #![ expect( clippy:: collapsible_if) ]
12use serenity:: async_trait;
23use serenity:: gateway:: client:: FullEvent ;
34use serenity:: prelude:: * ;
@@ -26,10 +27,10 @@ impl EventHandler for Handler {
2627 FullEvent :: Message {
2728 new_message, ..
2829 } => {
29- if new_message. content == "!ping"
30- && let Err ( why) = new_message. channel_id . say ( & ctx. http , "Pong!" ) . await
31- {
32- println ! ( "Error sending message: {why:?}" ) ;
30+ if new_message. content == "!ping" {
31+ if let Err ( why) = new_message. channel_id . say ( & ctx. http , "Pong!" ) . await {
32+ println ! ( "Error sending message: {why:?}" ) ;
33+ }
3334 }
3435 } ,
3536 FullEvent :: Ready {
Original file line number Diff line number Diff line change 1818//!
1919//! Note that it may take a minute or more for a latency to be recorded or to update, depending on
2020//! how often Discord tells the client to send a heartbeat.
21+ #![ expect( clippy:: collapsible_if) ]
2122use std:: time:: Duration ;
2223
2324use serenity:: async_trait;
@@ -33,12 +34,13 @@ impl EventHandler for Handler {
3334 if let FullEvent :: Ready {
3435 data_about_bot, ..
3536 } = event
36- && let Some ( shard) = data_about_bot. shard
3737 {
38- println ! (
39- "{} is connected on shard {}/{}!" ,
40- data_about_bot. user. name, shard. id, shard. total
41- ) ;
38+ if let Some ( shard) = data_about_bot. shard {
39+ println ! (
40+ "{} is connected on shard {}/{}!" ,
41+ data_about_bot. user. name, shard. id, shard. total
42+ ) ;
43+ }
4244 }
4345 }
4446}
Original file line number Diff line number Diff line change 1+ #![ expect( clippy:: collapsible_if) ]
12use std:: sync:: atomic:: { AtomicBool , Ordering } ;
23use std:: time:: Duration ;
34
@@ -21,10 +22,10 @@ impl EventHandler for Handler {
2122 FullEvent :: Message {
2223 new_message, ..
2324 } => {
24- if new_message. content == "!ping"
25- && let Err ( why) = new_message. channel_id . say ( & ctx. http , "Pong!" ) . await
26- {
27- println ! ( "Error sending message: {why:?}" ) ;
25+ if new_message. content == "!ping" {
26+ if let Err ( why) = new_message. channel_id . say ( & ctx. http , "Pong!" ) . await {
27+ println ! ( "Error sending message: {why:?}" ) ;
28+ }
2829 }
2930 } ,
3031 FullEvent :: Ready {
You can’t perform that action at this time.
0 commit comments