Skip to content

Commit 85c22f2

Browse files
committed
refactor: improve ChannelMessage struct for better readability
- Reformatted the `new` method parameters for clarity. - Adjusted the `send` method parameter formatting.
1 parent e6cbba5 commit 85c22f2

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

src/message.rs

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,34 @@ pub struct ChannelMessage {
282282
}
283283

284284
/// Represent a message sent in a channel
285-
///
285+
///
286286
/// More: https://discord.com/developers/docs/resources/channel#message-object-message-activity-structure
287-
///
287+
///
288288
/// - Note: Field specific to the `MESSAGE_CREATE` and `MESSAGE_UPDATE` events are listed in the Gateway Documentation
289289
/// - Note: An app will receive empty values in the `content`, `embeds`, `attachement` and `component` fields while `poll`
290290
impl ChannelMessage {
291-
pub fn new(id: String, channel_id: String, author: User, content: String, timestamp: String, tts: bool, mention_everyone: bool, mentions: Vec<User>, mention_roles: Vec<Role>, attachments: Vec<Attachments>, embeds: Vec<Embed>, reactions: Option<Vec<Reaction>>, nonce: Option<String>, pinned: bool, webhook_id: Option<String>, r#type: i32, activity: Option<MessageActivity>, application: Option<Application>, application_id: String, flags: usize) -> Self {
291+
pub fn new(
292+
id: String,
293+
channel_id: String,
294+
author: User,
295+
content: String,
296+
timestamp: String,
297+
tts: bool,
298+
mention_everyone: bool,
299+
mentions: Vec<User>,
300+
mention_roles: Vec<Role>,
301+
attachments: Vec<Attachments>,
302+
embeds: Vec<Embed>,
303+
reactions: Option<Vec<Reaction>>,
304+
nonce: Option<String>,
305+
pinned: bool,
306+
webhook_id: Option<String>,
307+
r#type: i32,
308+
activity: Option<MessageActivity>,
309+
application: Option<Application>,
310+
application_id: String,
311+
flags: usize,
312+
) -> Self {
292313
Self {
293314
id,
294315
channel_id,
@@ -314,9 +335,7 @@ impl ChannelMessage {
314335
}
315336
}
316337

317-
pub async fn send(&self,message:String) -> () {
338+
pub async fn send(&self, message: String) -> () {
318339
println!("Message sent: {}", message);
319-
320340
}
321-
322-
}
341+
}

0 commit comments

Comments
 (0)