Struct trovo::chat::ChatMessage
source · [−]pub struct ChatMessage {Show 13 fields
pub type_: ChatMessageType,
pub content: String,
pub nick_name: String,
pub avatar: Option<String>,
pub sub_lv: Option<String>,
pub medals: Vec<String>,
pub decos: Vec<String>,
pub roles: Vec<String>,
pub message_id: String,
pub sender_id: Option<i64>,
pub send_time: DateTime<Utc>,
pub content_data: HashMap<String, Value>,
pub custom_role: Option<String>,
}
Expand description
A single chat message
Fields
type_: ChatMessageType
Type of chat message.
content: String
Content of the message. Now gift message add new fields, including gift_id, gift_value(unit price of a gift) and value_type(currency type, like Elixir, Mana and so on).
nick_name: String
Display name of the sender.
avatar: Option<String>
URL of the sender’s profile picture.
sub_lv: Option<String>
The subscription level of the user in the channel. “sub_L1” for tier 1 subscriber.
medals: Vec<String>
The list of badge names of the sender.
decos: Vec<String>
The list of decoration names of sender.
roles: Vec<String>
The list of roles of the message sender. One user can have multiple roles, for example: “roles”:[“mod”, “follower”]
message_id: String
ID of the message.
sender_id: Option<i64>
User ID of the sender. Maybe be None
for Event
message types, possibly others
send_time: DateTime<Utc>
Time that the message was sent
content_data: HashMap<String, Value>
Extra info of chat
custom_role: Option<String>
The list of role of the message sender which is a json string. Different from “roles”, “custom_role” contains more information. However, if you just need the role names, use “roles” instead.
Trait Implementations
sourceimpl Debug for ChatMessage
impl Debug for ChatMessage
sourceimpl<'de> Deserialize<'de> for ChatMessage
impl<'de> Deserialize<'de> for ChatMessage
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for ChatMessage
impl Serialize for ChatMessage
Auto Trait Implementations
impl RefUnwindSafe for ChatMessage
impl Send for ChatMessage
impl Sync for ChatMessage
impl Unpin for ChatMessage
impl UnwindSafe for ChatMessage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more