Skip to main content

onebot_api/event/
notice.rs

1#[cfg(feature = "selector")]
2use crate::selector::Selector;
3use serde::Deserialize;
4use strum::{Display, EnumIs};
5
6#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
7pub struct GroupFile {
8	pub id: String,
9	pub name: String,
10	pub size: i64,
11	pub busid: i64,
12}
13
14#[derive(Deserialize, Debug, Copy, Clone, Display, EnumIs, Ord, PartialOrd, Eq, PartialEq)]
15pub enum GroupAdminType {
16	#[serde(rename = "set")]
17	Set,
18	#[serde(rename = "unset")]
19	Unset,
20}
21
22#[derive(Deserialize, Debug, Copy, Clone, Display, EnumIs, Ord, PartialOrd, Eq, PartialEq)]
23pub enum GroupDecreaseType {
24	#[serde(rename = "leave")]
25	Leave,
26	#[serde(rename = "kick")]
27	Kick,
28	#[serde(rename = "kick_me")]
29	KickMe,
30}
31
32#[derive(Deserialize, Debug, Copy, Clone, Display, EnumIs, Ord, PartialOrd, Eq, PartialEq)]
33pub enum GroupIncreaseType {
34	#[serde(rename = "approve")]
35	Approve,
36	#[serde(rename = "invite")]
37	Invite,
38}
39
40#[derive(Deserialize, Debug, Copy, Clone, Display, EnumIs, Ord, PartialOrd, Eq, PartialEq)]
41pub enum GroupBanType {
42	#[serde(rename = "ban")]
43	Ban,
44	#[serde(rename = "lift_ban")]
45	LiftBan,
46}
47
48#[derive(Deserialize, Debug, Copy, Clone, Display, EnumIs, Ord, PartialOrd, Eq, PartialEq)]
49#[serde(tag = "sub_type")]
50pub enum NotifyType {
51	#[serde(rename = "poke")]
52	Poke { target_id: i64 },
53	#[serde(rename = "lucky_king")]
54	LuckyKing { target_id: i64 },
55	#[serde(rename = "honor")]
56	Honor { honor_type: HonorType },
57}
58
59#[derive(Deserialize, Debug, Copy, Clone, Display, EnumIs, Ord, PartialOrd, Eq, PartialEq)]
60pub enum HonorType {
61	#[serde(rename = "talkative")]
62	Talkative,
63	#[serde(rename = "performer")]
64	Performer,
65	#[serde(rename = "emotion")]
66	Emotion,
67}
68
69#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
70pub struct NoticeEventGroupUpload {
71	pub group_id: i64,
72	pub user_id: i64,
73	pub file: GroupFile,
74}
75
76impl NoticeEventGroupUpload {
77	#[cfg(feature = "selector")]
78	pub fn selector(&'_ self) -> Selector<'_, Self> {
79		Selector { data: Some(self) }
80	}
81}
82
83#[cfg(feature = "selector")]
84impl<'a> Selector<'a, NoticeEventGroupUpload> {
85	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventGroupUpload) -> bool) {
86		if let Some(data) = self.data
87			&& !f(data)
88		{
89			self.data = None
90		}
91	}
92
93	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventGroupUpload) -> bool) -> Self {
94		self.filter(f);
95		self
96	}
97
98	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventGroupUpload) -> bool) {
99		if let Some(data) = self.data
100			&& !f(data).await
101		{
102			self.data = None
103		}
104	}
105
106	pub async fn and_filter_async(
107		mut self,
108		f: impl AsyncFnOnce(&NoticeEventGroupUpload) -> bool,
109	) -> Self {
110		self.filter_async(f).await;
111		self
112	}
113
114	pub fn filter_group_id(&mut self, f: impl FnOnce(i64) -> bool) {
115		if let Some(data) = self.data
116			&& !f(data.group_id)
117		{
118			self.data = None
119		}
120	}
121
122	pub fn and_filter_group_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
123		self.filter_group_id(f);
124		self
125	}
126
127	pub async fn filter_group_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
128		if let Some(data) = self.data
129			&& !f(data.group_id).await
130		{
131			self.data = None
132		}
133	}
134
135	pub async fn and_filter_group_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
136		self.filter_group_id_async(f).await;
137		self
138	}
139
140	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
141		if let Some(data) = self.data
142			&& !f(data.user_id)
143		{
144			self.data = None
145		}
146	}
147
148	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
149		self.filter_user_id(f);
150		self
151	}
152
153	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
154		if let Some(data) = self.data
155			&& !f(data.user_id).await
156		{
157			self.data = None
158		}
159	}
160
161	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
162		self.filter_user_id_async(f).await;
163		self
164	}
165
166	pub fn filter_file(&mut self, f: impl FnOnce(&GroupFile) -> bool) {
167		if let Some(data) = self.data
168			&& !f(&data.file)
169		{
170			self.data = None
171		}
172	}
173
174	pub fn and_filter_file(mut self, f: impl FnOnce(&GroupFile) -> bool) -> Self {
175		self.filter_file(f);
176		self
177	}
178
179	pub async fn filter_file_async(&mut self, f: impl AsyncFnOnce(&GroupFile) -> bool) {
180		if let Some(data) = self.data
181			&& !f(&data.file).await
182		{
183			self.data = None
184		}
185	}
186
187	pub async fn and_filter_file_async(mut self, f: impl AsyncFnOnce(&GroupFile) -> bool) -> Self {
188		self.filter_file_async(f).await;
189		self
190	}
191}
192
193#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
194pub struct NoticeEventGroupAdmin {
195	sub_type: GroupAdminType,
196	group_id: i64,
197	user_id: i64,
198}
199
200impl NoticeEventGroupAdmin {
201	#[cfg(feature = "selector")]
202	pub fn selector(&'_ self) -> Selector<'_, Self> {
203		Selector { data: Some(self) }
204	}
205}
206
207#[cfg(feature = "selector")]
208impl<'a> Selector<'a, NoticeEventGroupAdmin> {
209	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventGroupAdmin) -> bool) {
210		if let Some(data) = self.data
211			&& !f(data)
212		{
213			self.data = None
214		}
215	}
216
217	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventGroupAdmin) -> bool) -> Self {
218		self.filter(f);
219		self
220	}
221
222	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventGroupAdmin) -> bool) {
223		if let Some(data) = self.data
224			&& !f(data).await
225		{
226			self.data = None
227		}
228	}
229
230	pub async fn and_filter_async(
231		mut self,
232		f: impl AsyncFnOnce(&NoticeEventGroupAdmin) -> bool,
233	) -> Self {
234		self.filter_async(f).await;
235		self
236	}
237
238	pub fn filter_sub_type(&mut self, f: impl FnOnce(GroupAdminType) -> bool) {
239		if let Some(data) = self.data
240			&& !f(data.sub_type)
241		{
242			self.data = None
243		}
244	}
245
246	pub fn and_filter_sub_type(mut self, f: impl FnOnce(GroupAdminType) -> bool) -> Self {
247		self.filter_sub_type(f);
248		self
249	}
250
251	pub async fn filter_sub_type_async(&mut self, f: impl AsyncFnOnce(GroupAdminType) -> bool) {
252		if let Some(data) = self.data
253			&& !f(data.sub_type).await
254		{
255			self.data = None
256		}
257	}
258
259	pub async fn and_filter_sub_type_async(
260		mut self,
261		f: impl AsyncFnOnce(GroupAdminType) -> bool,
262	) -> Self {
263		self.filter_sub_type_async(f).await;
264		self
265	}
266
267	pub fn filter_group_id(&mut self, f: impl FnOnce(i64) -> bool) {
268		if let Some(data) = self.data
269			&& !f(data.group_id)
270		{
271			self.data = None
272		}
273	}
274
275	pub fn and_filter_group_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
276		self.filter_group_id(f);
277		self
278	}
279
280	pub async fn filter_group_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
281		if let Some(data) = self.data
282			&& !f(data.group_id).await
283		{
284			self.data = None
285		}
286	}
287
288	pub async fn and_filter_group_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
289		self.filter_group_id_async(f).await;
290		self
291	}
292
293	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
294		if let Some(data) = self.data
295			&& !f(data.user_id)
296		{
297			self.data = None
298		}
299	}
300
301	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
302		self.filter_user_id(f);
303		self
304	}
305
306	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
307		if let Some(data) = self.data
308			&& !f(data.user_id).await
309		{
310			self.data = None
311		}
312	}
313
314	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
315		self.filter_user_id_async(f).await;
316		self
317	}
318
319	pub fn set(&mut self) {
320		if let Some(data) = self.data
321			&& !data.sub_type.is_set()
322		{
323			self.data = None
324		}
325	}
326
327	pub fn and_set(mut self) -> Self {
328		self.set();
329		self
330	}
331
332	pub fn not_set(&mut self) {
333		if let Some(data) = self.data
334			&& data.sub_type.is_set()
335		{
336			self.data = None
337		}
338	}
339
340	pub fn and_not_set(mut self) -> Self {
341		self.not_set();
342		self
343	}
344
345	pub fn unset(&mut self) {
346		if let Some(data) = self.data
347			&& !data.sub_type.is_unset()
348		{
349			self.data = None
350		}
351	}
352
353	pub fn and_unset(mut self) -> Self {
354		self.unset();
355		self
356	}
357
358	pub fn not_unset(&mut self) {
359		if let Some(data) = self.data
360			&& data.sub_type.is_unset()
361		{
362			self.data = None
363		}
364	}
365
366	pub fn and_not_unset(mut self) -> Self {
367		self.not_unset();
368		self
369	}
370}
371
372#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
373pub struct NoticeEventGroupDecrease {
374	pub sub_type: GroupDecreaseType,
375	pub group_id: i64,
376	pub operator_id: i64,
377	pub user_id: i64,
378}
379
380impl NoticeEventGroupDecrease {
381	#[cfg(feature = "selector")]
382	pub fn selector(&'_ self) -> Selector<'_, Self> {
383		Selector { data: Some(self) }
384	}
385}
386
387#[cfg(feature = "selector")]
388impl<'a> Selector<'a, NoticeEventGroupDecrease> {
389	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventGroupDecrease) -> bool) {
390		if let Some(data) = self.data
391			&& !f(data)
392		{
393			self.data = None
394		}
395	}
396
397	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventGroupDecrease) -> bool) -> Self {
398		self.filter(f);
399		self
400	}
401
402	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventGroupDecrease) -> bool) {
403		if let Some(data) = self.data
404			&& !f(data).await
405		{
406			self.data = None
407		}
408	}
409
410	pub async fn and_filter_async(
411		mut self,
412		f: impl AsyncFnOnce(&NoticeEventGroupDecrease) -> bool,
413	) -> Self {
414		self.filter_async(f).await;
415		self
416	}
417
418	pub fn filter_sub_type(&mut self, f: impl FnOnce(GroupDecreaseType) -> bool) {
419		if let Some(data) = self.data
420			&& !f(data.sub_type)
421		{
422			self.data = None
423		}
424	}
425
426	pub fn and_filter_sub_type(mut self, f: impl FnOnce(GroupDecreaseType) -> bool) -> Self {
427		self.filter_sub_type(f);
428		self
429	}
430
431	pub async fn filter_sub_type_async(&mut self, f: impl AsyncFnOnce(GroupDecreaseType) -> bool) {
432		if let Some(data) = self.data
433			&& !f(data.sub_type).await
434		{
435			self.data = None
436		}
437	}
438
439	pub async fn and_filter_sub_type_async(
440		mut self,
441		f: impl AsyncFnOnce(GroupDecreaseType) -> bool,
442	) -> Self {
443		self.filter_sub_type_async(f).await;
444		self
445	}
446
447	pub fn filter_operator_id(&mut self, f: impl FnOnce(i64) -> bool) {
448		if let Some(data) = self.data
449			&& !f(data.operator_id)
450		{
451			self.data = None
452		}
453	}
454
455	pub fn and_filter_operator_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
456		self.filter_operator_id(f);
457		self
458	}
459
460	pub async fn filter_operator_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
461		if let Some(data) = self.data
462			&& !f(data.operator_id).await
463		{
464			self.data = None
465		}
466	}
467
468	pub async fn and_filter_operator_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
469		self.filter_operator_id_async(f).await;
470		self
471	}
472
473	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
474		if let Some(data) = self.data
475			&& !f(data.user_id)
476		{
477			self.data = None
478		}
479	}
480
481	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
482		self.filter_user_id(f);
483		self
484	}
485
486	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
487		if let Some(data) = self.data
488			&& !f(data.user_id).await
489		{
490			self.data = None
491		}
492	}
493
494	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
495		self.filter_user_id_async(f).await;
496		self
497	}
498
499	pub fn leave(&mut self) {
500		if let Some(data) = self.data
501			&& !data.sub_type.is_leave()
502		{
503			self.data = None
504		}
505	}
506
507	pub fn and_leave(mut self) -> Self {
508		self.leave();
509		self
510	}
511
512	pub fn not_leave(&mut self) {
513		if let Some(data) = self.data
514			&& data.sub_type.is_leave()
515		{
516			self.data = None
517		}
518	}
519
520	pub fn and_not_leave(mut self) -> Self {
521		self.not_leave();
522		self
523	}
524
525	pub fn kick(&mut self) {
526		if let Some(data) = self.data
527			&& !data.sub_type.is_kick()
528		{
529			self.data = None
530		}
531	}
532
533	pub fn and_kick(mut self) -> Self {
534		self.kick();
535		self
536	}
537
538	pub fn not_kick(&mut self) {
539		if let Some(data) = self.data
540			&& data.sub_type.is_kick()
541		{
542			self.data = None
543		}
544	}
545
546	pub fn and_not_kick(mut self) -> Self {
547		self.not_kick();
548		self
549	}
550
551	pub fn kick_me(&mut self) {
552		if let Some(data) = self.data
553			&& !data.sub_type.is_kick_me()
554		{
555			self.data = None
556		}
557	}
558
559	pub fn and_kick_me(mut self) -> Self {
560		self.kick_me();
561		self
562	}
563
564	pub fn not_kick_me(&mut self) {
565		if let Some(data) = self.data
566			&& data.sub_type.is_kick_me()
567		{
568			self.data = None
569		}
570	}
571
572	pub fn and_not_kick_me(mut self) -> Self {
573		self.not_kick_me();
574		self
575	}
576}
577
578#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
579pub struct NoticeEventGroupIncrease {
580	pub sub_type: GroupIncreaseType,
581	pub group_id: i64,
582	pub operator_id: i64,
583	pub user_id: i64,
584}
585
586impl NoticeEventGroupIncrease {
587	#[cfg(feature = "selector")]
588	pub fn selector(&'_ self) -> Selector<'_, Self> {
589		Selector { data: Some(self) }
590	}
591}
592
593#[cfg(feature = "selector")]
594impl<'a> Selector<'a, NoticeEventGroupIncrease> {
595	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventGroupIncrease) -> bool) {
596		if let Some(data) = self.data
597			&& !f(data)
598		{
599			self.data = None
600		}
601	}
602
603	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventGroupIncrease) -> bool) -> Self {
604		self.filter(f);
605		self
606	}
607
608	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventGroupIncrease) -> bool) {
609		if let Some(data) = self.data
610			&& !f(data).await
611		{
612			self.data = None
613		}
614	}
615
616	pub async fn and_filter_async(
617		mut self,
618		f: impl AsyncFnOnce(&NoticeEventGroupIncrease) -> bool,
619	) -> Self {
620		self.filter_async(f).await;
621		self
622	}
623
624	pub fn filter_sub_type(&mut self, f: impl FnOnce(GroupIncreaseType) -> bool) {
625		if let Some(data) = self.data
626			&& !f(data.sub_type)
627		{
628			self.data = None
629		}
630	}
631
632	pub fn and_filter_sub_type(mut self, f: impl FnOnce(GroupIncreaseType) -> bool) -> Self {
633		self.filter_sub_type(f);
634		self
635	}
636
637	pub async fn filter_sub_type_async(&mut self, f: impl AsyncFnOnce(GroupIncreaseType) -> bool) {
638		if let Some(data) = self.data
639			&& !f(data.sub_type).await
640		{
641			self.data = None
642		}
643	}
644
645	pub async fn and_filter_sub_type_async(
646		mut self,
647		f: impl AsyncFnOnce(GroupIncreaseType) -> bool,
648	) -> Self {
649		self.filter_sub_type_async(f).await;
650		self
651	}
652
653	pub fn filter_group_id(&mut self, f: impl FnOnce(i64) -> bool) {
654		if let Some(data) = self.data
655			&& !f(data.group_id)
656		{
657			self.data = None
658		}
659	}
660
661	pub fn and_filter_group_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
662		self.filter_group_id(f);
663		self
664	}
665
666	pub async fn filter_group_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
667		if let Some(data) = self.data
668			&& !f(data.group_id).await
669		{
670			self.data = None
671		}
672	}
673
674	pub async fn and_filter_group_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
675		self.filter_group_id_async(f).await;
676		self
677	}
678
679	pub fn filter_operator_id(&mut self, f: impl FnOnce(i64) -> bool) {
680		if let Some(data) = self.data
681			&& !f(data.operator_id)
682		{
683			self.data = None
684		}
685	}
686
687	pub fn and_filter_operator_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
688		self.filter_operator_id(f);
689		self
690	}
691
692	pub async fn filter_operator_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
693		if let Some(data) = self.data
694			&& !f(data.operator_id).await
695		{
696			self.data = None
697		}
698	}
699
700	pub async fn and_filter_operator_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
701		self.filter_operator_id_async(f).await;
702		self
703	}
704
705	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
706		if let Some(data) = self.data
707			&& !f(data.user_id)
708		{
709			self.data = None
710		}
711	}
712
713	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
714		self.filter_user_id(f);
715		self
716	}
717
718	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
719		if let Some(data) = self.data
720			&& !f(data.user_id).await
721		{
722			self.data = None
723		}
724	}
725
726	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
727		self.filter_user_id_async(f).await;
728		self
729	}
730
731	pub fn approve(&mut self) {
732		if let Some(data) = self.data
733			&& !data.sub_type.is_approve()
734		{
735			self.data = None
736		}
737	}
738
739	pub fn and_approve(mut self) -> Self {
740		self.approve();
741		self
742	}
743
744	pub fn not_approve(&mut self) {
745		if let Some(data) = self.data
746			&& data.sub_type.is_approve()
747		{
748			self.data = None
749		}
750	}
751
752	pub fn and_not_approve(mut self) -> Self {
753		self.not_approve();
754		self
755	}
756
757	pub fn invite(&mut self) {
758		if let Some(data) = self.data
759			&& !data.sub_type.is_invite()
760		{
761			self.data = None
762		}
763	}
764
765	pub fn and_invite(mut self) -> Self {
766		self.invite();
767		self
768	}
769
770	pub fn not_invite(&mut self) {
771		if let Some(data) = self.data
772			&& data.sub_type.is_invite()
773		{
774			self.data = None
775		}
776	}
777
778	pub fn and_not_invite(mut self) -> Self {
779		self.not_invite();
780		self
781	}
782}
783
784#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
785pub struct NoticeEventGroupBan {
786	sub_type: GroupBanType,
787	group_id: i64,
788	operator_id: i64,
789	user_id: i64,
790	duration: i64,
791}
792
793impl NoticeEventGroupBan {
794	#[cfg(feature = "selector")]
795	pub fn selector(&'_ self) -> Selector<'_, Self> {
796		Selector { data: Some(self) }
797	}
798}
799
800#[cfg(feature = "selector")]
801impl<'a> Selector<'a, NoticeEventGroupBan> {
802	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventGroupBan) -> bool) {
803		if let Some(data) = self.data
804			&& !f(data)
805		{
806			self.data = None
807		}
808	}
809
810	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventGroupBan) -> bool) -> Self {
811		self.filter(f);
812		self
813	}
814
815	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventGroupBan) -> bool) {
816		if let Some(data) = self.data
817			&& !f(data).await
818		{
819			self.data = None
820		}
821	}
822
823	pub async fn and_filter_async(
824		mut self,
825		f: impl AsyncFnOnce(&NoticeEventGroupBan) -> bool,
826	) -> Self {
827		self.filter_async(f).await;
828		self
829	}
830
831	pub fn filter_sub_type(&mut self, f: impl FnOnce(GroupBanType) -> bool) {
832		if let Some(data) = self.data
833			&& !f(data.sub_type)
834		{
835			self.data = None
836		}
837	}
838
839	pub fn and_filter_sub_type(mut self, f: impl FnOnce(GroupBanType) -> bool) -> Self {
840		self.filter_sub_type(f);
841		self
842	}
843
844	pub async fn filter_sub_type_async(&mut self, f: impl AsyncFnOnce(GroupBanType) -> bool) {
845		if let Some(data) = self.data
846			&& !f(data.sub_type).await
847		{
848			self.data = None
849		}
850	}
851
852	pub async fn and_filter_sub_type_async(
853		mut self,
854		f: impl AsyncFnOnce(GroupBanType) -> bool,
855	) -> Self {
856		self.filter_sub_type_async(f).await;
857		self
858	}
859
860	pub fn filter_group_id(&mut self, f: impl FnOnce(i64) -> bool) {
861		if let Some(data) = self.data
862			&& !f(data.group_id)
863		{
864			self.data = None
865		}
866	}
867
868	pub fn and_filter_group_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
869		self.filter_group_id(f);
870		self
871	}
872
873	pub async fn filter_group_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
874		if let Some(data) = self.data
875			&& !f(data.group_id).await
876		{
877			self.data = None
878		}
879	}
880
881	pub async fn and_filter_group_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
882		self.filter_group_id_async(f).await;
883		self
884	}
885
886	pub fn filter_operator_id(&mut self, f: impl FnOnce(i64) -> bool) {
887		if let Some(data) = self.data
888			&& !f(data.operator_id)
889		{
890			self.data = None
891		}
892	}
893
894	pub fn and_filter_operator_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
895		self.filter_operator_id(f);
896		self
897	}
898
899	pub async fn filter_operator_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
900		if let Some(data) = self.data
901			&& !f(data.operator_id).await
902		{
903			self.data = None
904		}
905	}
906
907	pub async fn and_filter_operator_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
908		self.filter_operator_id_async(f).await;
909		self
910	}
911
912	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
913		if let Some(data) = self.data
914			&& !f(data.user_id)
915		{
916			self.data = None
917		}
918	}
919
920	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
921		self.filter_user_id(f);
922		self
923	}
924
925	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
926		if let Some(data) = self.data
927			&& !f(data.user_id).await
928		{
929			self.data = None
930		}
931	}
932
933	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
934		self.filter_user_id_async(f).await;
935		self
936	}
937
938	pub fn filter_duration(&mut self, f: impl FnOnce(i64) -> bool) {
939		if let Some(data) = self.data
940			&& !f(data.duration)
941		{
942			self.data = None
943		}
944	}
945
946	pub fn and_filter_duration(mut self, f: impl FnOnce(i64) -> bool) -> Self {
947		self.filter_duration(f);
948		self
949	}
950
951	pub async fn filter_duration_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
952		if let Some(data) = self.data
953			&& !f(data.duration).await
954		{
955			self.data = None
956		}
957	}
958
959	pub async fn and_filter_duration_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
960		self.filter_duration_async(f).await;
961		self
962	}
963
964	pub fn ban(&mut self) {
965		if let Some(data) = self.data
966			&& !data.sub_type.is_ban()
967		{
968			self.data = None
969		}
970	}
971
972	pub fn and_ban(mut self) -> Self {
973		self.ban();
974		self
975	}
976
977	pub fn not_ban(&mut self) {
978		if let Some(data) = self.data
979			&& data.sub_type.is_ban()
980		{
981			self.data = None
982		}
983	}
984
985	pub fn and_not_ban(mut self) -> Self {
986		self.not_ban();
987		self
988	}
989
990	pub fn lift_ban(&mut self) {
991		if let Some(data) = self.data
992			&& !data.sub_type.is_lift_ban()
993		{
994			self.data = None
995		}
996	}
997
998	pub fn and_lift_ban(mut self) -> Self {
999		self.lift_ban();
1000		self
1001	}
1002
1003	pub fn not_lift_ban(&mut self) {
1004		if let Some(data) = self.data
1005			&& data.sub_type.is_lift_ban()
1006		{
1007			self.data = None
1008		}
1009	}
1010
1011	pub fn and_not_lift_ban(mut self) -> Self {
1012		self.not_lift_ban();
1013		self
1014	}
1015}
1016
1017#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
1018pub struct NoticeEventFriendAdd {
1019	user_id: i64,
1020}
1021
1022impl NoticeEventFriendAdd {
1023	#[cfg(feature = "selector")]
1024	pub fn selector(&'_ self) -> Selector<'_, Self> {
1025		Selector { data: Some(self) }
1026	}
1027}
1028
1029#[cfg(feature = "selector")]
1030impl<'a> Selector<'a, NoticeEventFriendAdd> {
1031	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventFriendAdd) -> bool) {
1032		if let Some(data) = self.data
1033			&& !f(data)
1034		{
1035			self.data = None
1036		}
1037	}
1038
1039	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventFriendAdd) -> bool) -> Self {
1040		self.filter(f);
1041		self
1042	}
1043
1044	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventFriendAdd) -> bool) {
1045		if let Some(data) = self.data
1046			&& !f(data).await
1047		{
1048			self.data = None
1049		}
1050	}
1051
1052	pub async fn and_filter_async(
1053		mut self,
1054		f: impl AsyncFnOnce(&NoticeEventFriendAdd) -> bool,
1055	) -> Self {
1056		self.filter_async(f).await;
1057		self
1058	}
1059
1060	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
1061		if let Some(data) = self.data
1062			&& !f(data.user_id)
1063		{
1064			self.data = None
1065		}
1066	}
1067
1068	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1069		self.filter_user_id(f);
1070		self
1071	}
1072
1073	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1074		if let Some(data) = self.data
1075			&& !f(data.user_id).await
1076		{
1077			self.data = None
1078		}
1079	}
1080
1081	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1082		self.filter_user_id_async(f).await;
1083		self
1084	}
1085}
1086
1087#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
1088pub struct NoticeEventGroupRecall {
1089	group_id: i64,
1090	user_id: i64,
1091	operator_id: i64,
1092	message_id: i64,
1093}
1094
1095impl NoticeEventGroupRecall {
1096	#[cfg(feature = "selector")]
1097	pub fn selector(&'_ self) -> Selector<'_, Self> {
1098		Selector { data: Some(self) }
1099	}
1100}
1101
1102#[cfg(feature = "selector")]
1103impl<'a> Selector<'a, NoticeEventGroupRecall> {
1104	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventGroupRecall) -> bool) {
1105		if let Some(data) = self.data
1106			&& !f(data)
1107		{
1108			self.data = None
1109		}
1110	}
1111
1112	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventGroupRecall) -> bool) -> Self {
1113		self.filter(f);
1114		self
1115	}
1116
1117	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventGroupRecall) -> bool) {
1118		if let Some(data) = self.data
1119			&& !f(data).await
1120		{
1121			self.data = None
1122		}
1123	}
1124
1125	pub async fn and_filter_async(
1126		mut self,
1127		f: impl AsyncFnOnce(&NoticeEventGroupRecall) -> bool,
1128	) -> Self {
1129		self.filter_async(f).await;
1130		self
1131	}
1132
1133	pub fn filter_group_id(&mut self, f: impl FnOnce(i64) -> bool) {
1134		if let Some(data) = self.data
1135			&& !f(data.group_id)
1136		{
1137			self.data = None
1138		}
1139	}
1140
1141	pub fn and_filter_group_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1142		self.filter_group_id(f);
1143		self
1144	}
1145
1146	pub async fn filter_group_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1147		if let Some(data) = self.data
1148			&& !f(data.group_id).await
1149		{
1150			self.data = None
1151		}
1152	}
1153
1154	pub async fn and_filter_group_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1155		self.filter_group_id_async(f).await;
1156		self
1157	}
1158
1159	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
1160		if let Some(data) = self.data
1161			&& !f(data.user_id)
1162		{
1163			self.data = None
1164		}
1165	}
1166
1167	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1168		self.filter_user_id(f);
1169		self
1170	}
1171
1172	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1173		if let Some(data) = self.data
1174			&& !f(data.user_id).await
1175		{
1176			self.data = None
1177		}
1178	}
1179
1180	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1181		self.filter_user_id_async(f).await;
1182		self
1183	}
1184
1185	pub fn filter_operator_id(&mut self, f: impl FnOnce(i64) -> bool) {
1186		if let Some(data) = self.data
1187			&& !f(data.operator_id)
1188		{
1189			self.data = None
1190		}
1191	}
1192
1193	pub fn and_filter_operator_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1194		self.filter_operator_id(f);
1195		self
1196	}
1197
1198	pub async fn filter_operator_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1199		if let Some(data) = self.data
1200			&& !f(data.operator_id).await
1201		{
1202			self.data = None
1203		}
1204	}
1205
1206	pub async fn and_filter_operator_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1207		self.filter_operator_id_async(f).await;
1208		self
1209	}
1210
1211	pub fn filter_message_id(&mut self, f: impl FnOnce(i64) -> bool) {
1212		if let Some(data) = self.data
1213			&& !f(data.message_id)
1214		{
1215			self.data = None
1216		}
1217	}
1218
1219	pub fn and_filter_message_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1220		self.filter_message_id(f);
1221		self
1222	}
1223
1224	pub async fn filter_message_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1225		if let Some(data) = self.data
1226			&& !f(data.message_id).await
1227		{
1228			self.data = None
1229		}
1230	}
1231
1232	pub async fn and_filter_message_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1233		self.filter_message_id_async(f).await;
1234		self
1235	}
1236}
1237
1238#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
1239pub struct NoticeEventFriendRecall {
1240	user_id: i64,
1241	message_id: i64,
1242}
1243
1244impl NoticeEventFriendRecall {
1245	#[cfg(feature = "selector")]
1246	pub fn selector(&'_ self) -> Selector<'_, Self> {
1247		Selector { data: Some(self) }
1248	}
1249}
1250
1251#[cfg(feature = "selector")]
1252impl<'a> Selector<'a, NoticeEventFriendRecall> {
1253	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventFriendRecall) -> bool) {
1254		if let Some(data) = self.data
1255			&& !f(data)
1256		{
1257			self.data = None
1258		}
1259	}
1260
1261	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventFriendRecall) -> bool) -> Self {
1262		self.filter(f);
1263		self
1264	}
1265
1266	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventFriendRecall) -> bool) {
1267		if let Some(data) = self.data
1268			&& !f(data).await
1269		{
1270			self.data = None
1271		}
1272	}
1273
1274	pub async fn and_filter_async(
1275		mut self,
1276		f: impl AsyncFnOnce(&NoticeEventFriendRecall) -> bool,
1277	) -> Self {
1278		self.filter_async(f).await;
1279		self
1280	}
1281
1282	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
1283		if let Some(data) = self.data
1284			&& !f(data.user_id)
1285		{
1286			self.data = None
1287		}
1288	}
1289
1290	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1291		self.filter_user_id(f);
1292		self
1293	}
1294
1295	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1296		if let Some(data) = self.data
1297			&& !f(data.user_id).await
1298		{
1299			self.data = None
1300		}
1301	}
1302
1303	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1304		self.filter_user_id_async(f).await;
1305		self
1306	}
1307
1308	pub fn filter_message_id(&mut self, f: impl FnOnce(i64) -> bool) {
1309		if let Some(data) = self.data
1310			&& !f(data.message_id)
1311		{
1312			self.data = None
1313		}
1314	}
1315
1316	pub fn and_filter_message_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1317		self.filter_message_id(f);
1318		self
1319	}
1320
1321	pub async fn filter_message_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1322		if let Some(data) = self.data
1323			&& !f(data.message_id).await
1324		{
1325			self.data = None
1326		}
1327	}
1328
1329	pub async fn and_filter_message_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1330		self.filter_message_id_async(f).await;
1331		self
1332	}
1333}
1334
1335#[derive(Deserialize, Debug, Clone, Ord, PartialOrd, Eq, PartialEq)]
1336pub struct NoticeEventNotify {
1337	group_id: i64,
1338	user_id: i64,
1339	#[serde(flatten)]
1340	data: NotifyType,
1341}
1342
1343impl NoticeEventNotify {
1344	#[cfg(feature = "selector")]
1345	pub fn selector(&'_ self) -> Selector<'_, Self> {
1346		Selector { data: Some(self) }
1347	}
1348}
1349
1350#[cfg(feature = "selector")]
1351impl<'a> Selector<'a, NoticeEventNotify> {
1352	pub fn filter(&mut self, f: impl FnOnce(&NoticeEventNotify) -> bool) {
1353		if let Some(data) = self.data
1354			&& !f(data)
1355		{
1356			self.data = None
1357		}
1358	}
1359
1360	pub fn and_filter(mut self, f: impl FnOnce(&NoticeEventNotify) -> bool) -> Self {
1361		self.filter(f);
1362		self
1363	}
1364
1365	pub async fn filter_async(&mut self, f: impl AsyncFnOnce(&NoticeEventNotify) -> bool) {
1366		if let Some(data) = self.data
1367			&& !f(data).await
1368		{
1369			self.data = None
1370		}
1371	}
1372
1373	pub async fn and_filter_async(mut self, f: impl AsyncFnOnce(&NoticeEventNotify) -> bool) -> Self {
1374		self.filter_async(f).await;
1375		self
1376	}
1377
1378	pub fn filter_group_id(&mut self, f: impl FnOnce(i64) -> bool) {
1379		if let Some(data) = self.data
1380			&& !f(data.group_id)
1381		{
1382			self.data = None
1383		}
1384	}
1385
1386	pub fn and_filter_group_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1387		self.filter_group_id(f);
1388		self
1389	}
1390
1391	pub async fn filter_group_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1392		if let Some(data) = self.data
1393			&& !f(data.group_id).await
1394		{
1395			self.data = None
1396		}
1397	}
1398
1399	pub async fn and_filter_group_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1400		self.filter_group_id_async(f).await;
1401		self
1402	}
1403
1404	pub fn filter_user_id(&mut self, f: impl FnOnce(i64) -> bool) {
1405		if let Some(data) = self.data
1406			&& !f(data.user_id)
1407		{
1408			self.data = None
1409		}
1410	}
1411
1412	pub fn and_filter_user_id(mut self, f: impl FnOnce(i64) -> bool) -> Self {
1413		self.filter_user_id(f);
1414		self
1415	}
1416
1417	pub async fn filter_user_id_async(&mut self, f: impl AsyncFnOnce(i64) -> bool) {
1418		if let Some(data) = self.data
1419			&& !f(data.user_id).await
1420		{
1421			self.data = None
1422		}
1423	}
1424
1425	pub async fn and_filter_user_id_async(mut self, f: impl AsyncFnOnce(i64) -> bool) -> Self {
1426		self.filter_user_id_async(f).await;
1427		self
1428	}
1429
1430	pub fn filter_data(&mut self, f: impl FnOnce(&NotifyType) -> bool) {
1431		if let Some(data) = self.data
1432			&& !f(&data.data)
1433		{
1434			self.data = None
1435		}
1436	}
1437
1438	pub fn and_filter_data(mut self, f: impl FnOnce(&NotifyType) -> bool) -> Self {
1439		self.filter_data(f);
1440		self
1441	}
1442
1443	pub async fn filter_data_async(&mut self, f: impl AsyncFnOnce(&NotifyType) -> bool) {
1444		if let Some(data) = self.data
1445			&& !f(&data.data).await
1446		{
1447			self.data = None
1448		}
1449	}
1450
1451	pub async fn and_filter_data_async(mut self, f: impl AsyncFnOnce(&NotifyType) -> bool) -> Self {
1452		self.filter_data_async(f).await;
1453		self
1454	}
1455}
1456
1457#[derive(Deserialize, Debug, Clone, Display, EnumIs, Ord, PartialOrd, Eq, PartialEq)]
1458#[serde(tag = "notice_type")]
1459pub enum NoticeEvent {
1460	#[serde(rename = "group_upload")]
1461	GroupUpload(NoticeEventGroupUpload),
1462
1463	#[serde(rename = "group_admin")]
1464	GroupAdmin(NoticeEventGroupAdmin),
1465
1466	#[serde(rename = "group_decrease")]
1467	GroupDecrease(NoticeEventGroupDecrease),
1468
1469	#[serde(rename = "group_increase")]
1470	GroupIncrease(NoticeEventGroupIncrease),
1471
1472	#[serde(rename = "group_ban")]
1473	GroupBan(NoticeEventGroupBan),
1474
1475	#[serde(rename = "friend_add")]
1476	FriendAdd(NoticeEventFriendAdd),
1477
1478	#[serde(rename = "group_recall")]
1479	GroupRecall(NoticeEventGroupRecall),
1480
1481	#[serde(rename = "friend_recall")]
1482	FriendRecall(NoticeEventFriendRecall),
1483
1484	#[serde(rename = "notify")]
1485	Notify(NoticeEventNotify),
1486}
1487
1488impl NoticeEvent {
1489	#[cfg(feature = "selector")]
1490	pub fn selector(&'_ self) -> Selector<'_, Self> {
1491		Selector { data: Some(self) }
1492	}
1493
1494	pub fn match_group_upload(&self) -> Option<&NoticeEventGroupUpload> {
1495		if let Self::GroupUpload(data) = self {
1496			Some(data)
1497		} else {
1498			None
1499		}
1500	}
1501
1502	pub fn on_group_upload<T>(
1503		&self,
1504		handler: impl FnOnce(&NoticeEventGroupUpload) -> T,
1505	) -> Option<T> {
1506		if let Self::GroupUpload(data) = self {
1507			Some(handler(data))
1508		} else {
1509			None
1510		}
1511	}
1512
1513	pub async fn on_group_upload_async<T>(
1514		&self,
1515		handler: impl AsyncFnOnce(&NoticeEventGroupUpload) -> T,
1516	) -> Option<T> {
1517		if let Self::GroupUpload(data) = self {
1518			Some(handler(data).await)
1519		} else {
1520			None
1521		}
1522	}
1523
1524	pub fn match_group_admin(&self) -> Option<&NoticeEventGroupAdmin> {
1525		if let Self::GroupAdmin(data) = self {
1526			Some(data)
1527		} else {
1528			None
1529		}
1530	}
1531
1532	pub fn on_group_admin<T>(&self, handler: impl FnOnce(&NoticeEventGroupAdmin) -> T) -> Option<T> {
1533		if let Self::GroupAdmin(data) = self {
1534			Some(handler(data))
1535		} else {
1536			None
1537		}
1538	}
1539
1540	pub async fn on_group_admin_async<T>(
1541		&self,
1542		handler: impl AsyncFnOnce(&NoticeEventGroupAdmin) -> T,
1543	) -> Option<T> {
1544		if let Self::GroupAdmin(data) = self {
1545			Some(handler(data).await)
1546		} else {
1547			None
1548		}
1549	}
1550
1551	pub fn match_group_decrease(&self) -> Option<&NoticeEventGroupDecrease> {
1552		if let Self::GroupDecrease(data) = self {
1553			Some(data)
1554		} else {
1555			None
1556		}
1557	}
1558
1559	pub fn on_group_decrease<T>(
1560		&self,
1561		handler: impl FnOnce(&NoticeEventGroupDecrease) -> T,
1562	) -> Option<T> {
1563		if let Self::GroupDecrease(data) = self {
1564			Some(handler(data))
1565		} else {
1566			None
1567		}
1568	}
1569
1570	pub async fn on_group_decrease_async<T>(
1571		&self,
1572		handler: impl AsyncFnOnce(&NoticeEventGroupDecrease) -> T,
1573	) -> Option<T> {
1574		if let Self::GroupDecrease(data) = self {
1575			Some(handler(data).await)
1576		} else {
1577			None
1578		}
1579	}
1580
1581	pub fn match_group_increase(&self) -> Option<&NoticeEventGroupIncrease> {
1582		if let Self::GroupIncrease(data) = self {
1583			Some(data)
1584		} else {
1585			None
1586		}
1587	}
1588
1589	pub fn on_group_increase<T>(
1590		&self,
1591		handler: impl FnOnce(&NoticeEventGroupIncrease) -> T,
1592	) -> Option<T> {
1593		if let Self::GroupIncrease(data) = self {
1594			Some(handler(data))
1595		} else {
1596			None
1597		}
1598	}
1599
1600	pub async fn on_group_increase_async<T>(
1601		&self,
1602		handler: impl AsyncFnOnce(&NoticeEventGroupIncrease) -> T,
1603	) -> Option<T> {
1604		if let Self::GroupIncrease(data) = self {
1605			Some(handler(data).await)
1606		} else {
1607			None
1608		}
1609	}
1610
1611	pub fn match_group_ban(&self) -> Option<&NoticeEventGroupBan> {
1612		if let Self::GroupBan(data) = self {
1613			Some(data)
1614		} else {
1615			None
1616		}
1617	}
1618
1619	pub fn on_group_ban<T>(&self, handler: impl FnOnce(&NoticeEventGroupBan) -> T) -> Option<T> {
1620		if let Self::GroupBan(data) = self {
1621			Some(handler(data))
1622		} else {
1623			None
1624		}
1625	}
1626
1627	pub async fn on_group_ban_async<T>(
1628		&self,
1629		handler: impl AsyncFnOnce(&NoticeEventGroupBan) -> T,
1630	) -> Option<T> {
1631		if let Self::GroupBan(data) = self {
1632			Some(handler(data).await)
1633		} else {
1634			None
1635		}
1636	}
1637
1638	pub fn match_friend_add(&self) -> Option<&NoticeEventFriendAdd> {
1639		if let Self::FriendAdd(data) = self {
1640			Some(data)
1641		} else {
1642			None
1643		}
1644	}
1645
1646	pub fn on_friend_add<T>(&self, handler: impl FnOnce(&NoticeEventFriendAdd) -> T) -> Option<T> {
1647		if let Self::FriendAdd(data) = self {
1648			Some(handler(data))
1649		} else {
1650			None
1651		}
1652	}
1653
1654	pub async fn on_friend_add_async<T>(
1655		&self,
1656		handler: impl AsyncFnOnce(&NoticeEventFriendAdd) -> T,
1657	) -> Option<T> {
1658		if let Self::FriendAdd(data) = self {
1659			Some(handler(data).await)
1660		} else {
1661			None
1662		}
1663	}
1664
1665	pub fn match_group_recall(&self) -> Option<&NoticeEventGroupRecall> {
1666		if let Self::GroupRecall(data) = self {
1667			Some(data)
1668		} else {
1669			None
1670		}
1671	}
1672
1673	pub fn on_group_recall<T>(
1674		&self,
1675		handler: impl FnOnce(&NoticeEventGroupRecall) -> T,
1676	) -> Option<T> {
1677		if let Self::GroupRecall(data) = self {
1678			Some(handler(data))
1679		} else {
1680			None
1681		}
1682	}
1683
1684	pub async fn on_group_recall_async<T>(
1685		&self,
1686		handler: impl AsyncFnOnce(&NoticeEventGroupRecall) -> T,
1687	) -> Option<T> {
1688		if let Self::GroupRecall(data) = self {
1689			Some(handler(data).await)
1690		} else {
1691			None
1692		}
1693	}
1694
1695	pub fn match_friend_recall(&self) -> Option<&NoticeEventFriendRecall> {
1696		if let Self::FriendRecall(data) = self {
1697			Some(data)
1698		} else {
1699			None
1700		}
1701	}
1702
1703	pub fn on_friend_recall<T>(
1704		&self,
1705		handler: impl FnOnce(&NoticeEventFriendRecall) -> T,
1706	) -> Option<T> {
1707		if let Self::FriendRecall(data) = self {
1708			Some(handler(data))
1709		} else {
1710			None
1711		}
1712	}
1713
1714	pub async fn on_friend_recall_async<T>(
1715		&self,
1716		handler: impl AsyncFnOnce(&NoticeEventFriendRecall) -> T,
1717	) -> Option<T> {
1718		if let Self::FriendRecall(data) = self {
1719			Some(handler(data).await)
1720		} else {
1721			None
1722		}
1723	}
1724
1725	pub fn match_notify(&self) -> Option<&NoticeEventNotify> {
1726		if let Self::Notify(data) = self {
1727			Some(data)
1728		} else {
1729			None
1730		}
1731	}
1732
1733	pub fn on_notify<T>(&self, handler: impl FnOnce(&NoticeEventNotify) -> T) -> Option<T> {
1734		if let Self::Notify(data) = self {
1735			Some(handler(data))
1736		} else {
1737			None
1738		}
1739	}
1740
1741	pub async fn on_notify_async<T>(
1742		&self,
1743		handler: impl AsyncFnOnce(&NoticeEventNotify) -> T,
1744	) -> Option<T> {
1745		if let Self::Notify(data) = self {
1746			Some(handler(data).await)
1747		} else {
1748			None
1749		}
1750	}
1751}
1752
1753#[cfg(feature = "selector")]
1754impl<'a> Selector<'a, NoticeEvent> {
1755	pub fn group_upload(&self) -> Selector<'a, NoticeEventGroupUpload> {
1756		Selector {
1757			data: self.data.and_then(|d| d.match_group_upload()),
1758		}
1759	}
1760
1761	pub fn group_admin(&self) -> Selector<'a, NoticeEventGroupAdmin> {
1762		Selector {
1763			data: self.data.and_then(|d| d.match_group_admin()),
1764		}
1765	}
1766
1767	pub fn group_decrease(&self) -> Selector<'a, NoticeEventGroupDecrease> {
1768		Selector {
1769			data: self.data.and_then(|d| d.match_group_decrease()),
1770		}
1771	}
1772
1773	pub fn group_increase(&self) -> Selector<'a, NoticeEventGroupIncrease> {
1774		Selector {
1775			data: self.data.and_then(|d| d.match_group_increase()),
1776		}
1777	}
1778
1779	pub fn group_ban(&self) -> Selector<'a, NoticeEventGroupBan> {
1780		Selector {
1781			data: self.data.and_then(|d| d.match_group_ban()),
1782		}
1783	}
1784
1785	pub fn friend_add(&self) -> Selector<'a, NoticeEventFriendAdd> {
1786		Selector {
1787			data: self.data.and_then(|d| d.match_friend_add()),
1788		}
1789	}
1790
1791	pub fn group_recall(&self) -> Selector<'a, NoticeEventGroupRecall> {
1792		Selector {
1793			data: self.data.and_then(|d| d.match_group_recall()),
1794		}
1795	}
1796
1797	pub fn friend_recall(&self) -> Selector<'a, NoticeEventFriendRecall> {
1798		Selector {
1799			data: self.data.and_then(|d| d.match_friend_recall()),
1800		}
1801	}
1802
1803	pub fn notify(&self) -> Selector<'a, NoticeEventNotify> {
1804		Selector {
1805			data: self.data.and_then(|d| d.match_notify()),
1806		}
1807	}
1808}