@@ -59,6 +59,27 @@ export default async function (msg: Message, type: string) {
5959 if ( ! commandPrefixLess && prefix ) return ;
6060 if ( msg . fromMe && prefix ) return ;
6161
62+ /*
63+ *
64+ * Process msg reaction
65+ */
66+ if ( ! msg . fromMe ) {
67+ const emojis = [ ...new Set ( [ ...msg . body . matchAll ( regex ) ] . map ( ( m ) => m [ 0 ] ) ) ] ;
68+ if ( emojis . length > 0 ) {
69+ const react = emojis [ Math . floor ( Math . random ( ) * emojis . length ) ] ;
70+
71+ await msg . react ( react ) ;
72+ } else if ( containsAny ( msg . body , funD ) ) {
73+ await msg . react ( "🤣" ) ;
74+ } else if ( containsAny ( msg . body , happyEE ) ) {
75+ await msg . reply ( funD [ Math . floor ( Math . random ( ) * funD . length ) ] ) ;
76+ } else if ( containsAny ( msg . body , sadEE ) ) {
77+ await msg . react ( "😭" ) ;
78+ } else if ( containsAny ( msg . body , loveEE ) ) {
79+ await msg . react ( "❤️" ) ;
80+ }
81+ }
82+
6283 /*
6384 * Check if the message starts with the command prefix.
6485 */
@@ -86,25 +107,6 @@ export default async function (msg: Message, type: string) {
86107 await msg . reply ( "Please wait a minute or so." ) ;
87108 return ;
88109 }
89-
90- /*
91- *
92- * Process msg reaction
93- */
94- const emojis = [ ...msg . body . matchAll ( regex ) ] . map ( ( match ) => match [ 0 ] ) ;
95- if ( emojis . length > 0 ) {
96- const react = emojis [ Math . floor ( Math . random ( ) * emojis . length ) ] ;
97-
98- await msg . react ( react ) ;
99- } else if ( containsAny ( msg . body , funD ) ) {
100- await msg . react ( "🤣" ) ;
101- } else if ( containsAny ( msg . body , happyEE ) ) {
102- await msg . reply ( funD [ Math . floor ( Math . random ( ) * funD . length ) ] ) ;
103- } else if ( containsAny ( msg . body , sadEE ) ) {
104- await msg . react ( "😭" ) ;
105- } else if ( containsAny ( msg . body , loveEE ) ) {
106- await msg . react ( "❤️" ) ;
107- }
108110 }
109111
110112 /*
0 commit comments