Skip to main content

hank_types/
hank.message.rs

1// @generated
2// This file is @generated by prost-build.
3/// A chat message
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct Message {
6    /// The id of a received message
7    #[prost(string, optional, tag="1")]
8    pub id: ::core::option::Option<::prost::alloc::string::String>,
9    /// The UTC epoch time the message was sent
10    #[prost(message, optional, tag="2")]
11    pub timestamp: ::core::option::Option<::prost_types::Timestamp>,
12    /// The user who authored the message
13    #[prost(message, optional, tag="3")]
14    pub author: ::core::option::Option<super::user::User>,
15    /// The channel the message is to/from
16    #[prost(message, optional, tag="4")]
17    pub channel: ::core::option::Option<super::channel::Channel>,
18    /// The message content
19    #[prost(string, tag="5")]
20    pub content: ::prost::alloc::string::String,
21}
22/// A reaction to a message.
23#[cfg_attr(feature = "builder", derive(derive_builder::Builder))]
24#[cfg_attr(feature = "builder", builder(default, setter(into, strip_option), custom_constructor, build_fn(name = "fallible_build")))]
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct Reaction {
27    /// A message to react to.
28    #[prost(message, optional, tag="1")]
29    pub message: ::core::option::Option<Message>,
30    /// A utf-8 emoji to react with.
31    #[prost(string, tag="2")]
32    pub emoji: ::prost::alloc::string::String,
33}
34// @@protoc_insertion_point(module)
35// Customizations from hank.database.customizations.rs
36#[cfg(feature = "builder")]
37impl Reaction {
38    pub fn new(emoji: impl Into<String>, message: Message) -> ReactionBuilder {
39        ReactionBuilder {
40            emoji: Some(emoji.into()),
41            message: Some(Some(message)),
42        }
43    }
44}
45#[cfg(feature = "builder")]
46impl ReactionBuilder {
47    pub fn build(&self) -> Reaction {
48        self.fallible_build()
49            .expect("All required fields were initialized")
50    }
51}