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
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
use std::collections::HashMap;
use serenity::model::id::{ChannelId, MessageId, UserId, RoleId};
use serenity::model::channel::ReactionType;

/// Enum describing the event type that should be used for interpretation
#[derive(Debug)]
pub enum EventType {
	Default,
	MemberJoin(MemberJoinEventInfo),
	MemberLeave(MemberLeaveEventInfo),
	Message(MessageEventInfo),
	MemberUpdate(MemberUpdateEventInfo),
	RoleCreate(RoleCreateEventInfo),
	RoleDelete(RoleDeleteEventInfo),
	RoleUpdate(RoleUpdateEventInfo),
	ChannelCreate(ChannelCreateEventInfo),
	ChannelDelete(ChannelDeleteEventInfo),
	ChannelUpdate(ChannelUpdateEventInfo),
	GuildUpdate(GuildUpdateEventInfo),
	VoiceUpdate(VoiceUpdateEventInfo),
	ReactionAdd(ReactionAddEventInfo),
	ReactionRemove(ReactionRemoveEventInfo),
}

#[derive(Debug)]
pub struct MessageEventInfo {
	pub channel_id: ChannelId,
	pub message_id: MessageId,
	pub user_id: UserId,
	pub trigger: String,
	pub parameter: String,
	pub split_parameters: HashMap<String, Vec<String>>,
}

impl MessageEventInfo {
	pub fn new(channel_id: ChannelId, message_id: MessageId, user_id: UserId, parameter: String, trigger: String) -> Self {
		return Self {
			channel_id: channel_id,
			message_id: message_id,
			user_id: user_id,
			trigger: trigger,
			parameter: parameter,
			split_parameters: HashMap::new(),
		};
	}
}

#[derive(Debug)]
pub struct MemberJoinEventInfo {
	pub user_id: UserId,
}

impl MemberJoinEventInfo {
	pub fn new(user_id: UserId) -> Self { 
		return Self { user_id };
	}
}

#[derive(Debug)]
pub struct MemberLeaveEventInfo {
	pub user_id: UserId,
}

impl MemberLeaveEventInfo {
	pub fn new(user_id: UserId) -> Self { 
		return Self { user_id };
	}
}

#[derive(Debug)]
pub struct MemberUpdateEventInfo {
	pub user_id: UserId,
}

impl MemberUpdateEventInfo {
	pub fn new(user_id: UserId) -> Self { 
		return Self { user_id };
	}
}

#[derive(Debug)]
pub struct RoleCreateEventInfo {
	pub role_id: RoleId,
}

impl RoleCreateEventInfo {
	pub fn new(role_id: RoleId) -> Self { 
		return Self { role_id };
	}
}

#[derive(Debug)]
pub struct RoleDeleteEventInfo {
	pub role_id: RoleId,
}

impl RoleDeleteEventInfo {
	pub fn new(role_id: RoleId) -> Self { 
		return Self { role_id };
	}
}

#[derive(Debug)]
pub struct RoleUpdateEventInfo {
	pub role_id: RoleId,
}

impl RoleUpdateEventInfo {
	pub fn new(role_id: RoleId) -> Self { 
		return Self { role_id };
	}
}

#[derive(Debug)]
pub struct ChannelCreateEventInfo {
	pub channel_id: ChannelId,
}

impl ChannelCreateEventInfo {
	pub fn new(channel_id: ChannelId) -> Self { 
		return Self { channel_id };
	}
}

#[derive(Debug)]
pub struct ChannelDeleteEventInfo {
	pub channel_id: ChannelId,
}

impl ChannelDeleteEventInfo {
	pub fn new(channel_id: ChannelId) -> Self { 
		return Self { channel_id };
	}
}

#[derive(Debug)]
pub struct ChannelUpdateEventInfo {
	pub channel_id: ChannelId,
}

impl ChannelUpdateEventInfo {
	pub fn new(channel_id: ChannelId) -> Self { 
		return Self { channel_id };
	}
}

#[derive(Debug)]
pub struct VoiceUpdateEventInfo {
	pub channel_id: ChannelId,
	pub user_id: UserId,
}

impl VoiceUpdateEventInfo {
	pub fn new(channel_id: ChannelId, user_id: UserId) -> Self { 
		return Self { channel_id, user_id };
	}
}

#[derive(Debug)]
pub struct GuildUpdateEventInfo {}

impl GuildUpdateEventInfo {
	pub fn new() -> Self { 
		return Self {};
	}
}

impl Default for GuildUpdateEventInfo {
	fn default() -> Self {
		return Self::new();
	}
}

#[derive(Debug)]
pub struct ReactionAddEventInfo {
	pub channel_id: ChannelId,
	pub message_id: MessageId,
	pub user_id: UserId,
	pub reaction_id: ReactionType,
}

impl ReactionAddEventInfo {
	pub fn new(channel_id: ChannelId, message_id: MessageId, user_id: UserId, reaction_id: ReactionType) -> Self { 
		return Self { channel_id, message_id, user_id, reaction_id };
	}
}

#[derive(Debug)]
pub struct ReactionRemoveEventInfo {
	pub channel_id: ChannelId,
	pub message_id: MessageId,
	pub user_id: UserId,
	pub reaction_id: ReactionType,
}

impl ReactionRemoveEventInfo {
	pub fn new(channel_id: ChannelId, message_id: MessageId, user_id: UserId, reaction_id: ReactionType) -> Self { 
		return Self { channel_id, message_id, user_id, reaction_id };
	}
}