summary refs log tree commit diff
path: root/src/system/types.rs
blob: bef6d6dc952c96d8ad36f723881239a92f4bcb83 (plain)
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
pub use twilight_model::channel::Message as TwiMessage;
use twilight_model::gateway::payload::incoming::MessageUpdate as PartialMessage;
use twilight_model::id::marker::{ChannelMarker, MessageMarker, UserMarker};
use twilight_model::id::Id;
use twilight_model::util::Timestamp;

pub type MemberId = usize;
pub type MessageId = Id<MessageMarker>;
pub type ChannelId = Id<ChannelMarker>;
pub type UserId = Id<UserMarker>;
pub type FullMessage = TwiMessage;

pub type Status = twilight_model::gateway::presence::Status;

#[derive(Clone)]
pub enum Message {
    Complete(FullMessage, MemberId),
    Partial(PartialMessage, MemberId),
}

pub type MessageEvent = (Timestamp, Message);
pub type ReactionEvent = (Timestamp, ());
pub type CommandEvent = (Timestamp, ());

pub enum SystemEvent {
    // Process of operation
    GatewayConnected(MemberId, UserId),
    GatewayError(MemberId, String),
    GatewayClosed(MemberId),
    RefetchMessage(MemberId, MessageId, ChannelId),
    UpdateClientStatus(MemberId),

    // User event handling
    NewMessage(Timestamp, FullMessage, MemberId),
    EditedMessage(MessageEvent),
    NewReaction(ReactionEvent),

    // Command handling
    NewCommand(CommandEvent),

    // Autoproxy
    AutoproxyTimeout(Timestamp),
}