Add constructors for Nick and Send
This commit is contained in:
parent
e87b9cb6d8
commit
9dbadb0a3f
1 changed files with 24 additions and 0 deletions
|
|
@ -46,6 +46,14 @@ pub struct Nick {
|
|||
pub name: String,
|
||||
}
|
||||
|
||||
impl Nick {
|
||||
pub fn new<S: ToString>(name: S) -> Self {
|
||||
Self {
|
||||
name: name.to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Confirms the [`Nick`] command.
|
||||
///
|
||||
/// Returns the session's former and new names (the server may modify the
|
||||
|
|
@ -98,6 +106,22 @@ pub struct Send {
|
|||
pub parent: Option<Snowflake>,
|
||||
}
|
||||
|
||||
impl Send {
|
||||
pub fn new<S: ToString>(content: S) -> Self {
|
||||
Self {
|
||||
content: content.to_string(),
|
||||
parent: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn reply<S: ToString>(parent: Snowflake, content: S) -> Self {
|
||||
Self {
|
||||
content: content.to_string(),
|
||||
parent: Some(parent),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The message that was sent.
|
||||
///
|
||||
/// this includes the message id, which was populated by the server.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue