1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use crate::{
    contexts::{
        fields,
        methods::{Copyable, Forwardable, Pinnable},
    },
    types::{message, Chat},
};

callback! {
    struct MessageGameCallback {
        /// The requested game.
        game: String,
        message: crate::types::Message,
    } -> EventLoop::message_game_callback
}

impl fields::Message for MessageGameCallback {
    fn message_id(&self) -> message::Id {
        self.message.id
    }

    fn from(&self) -> Option<&message::From> {
        self.message.from.as_ref()
    }

    fn date(&self) -> i64 {
        self.message.date
    }

    fn chat(&self) -> &Chat {
        &self.message.chat
    }
}

impl Copyable for MessageGameCallback {}
impl Forwardable for MessageGameCallback {}
impl Pinnable for MessageGameCallback {}

callback! {
    struct InlineGameCallback {
        /// The requested game.
        game: String,
        inline_message_id: String,
    } -> EventLoop::inline_game_callback
}