@@ -38,17 +38,12 @@ public final class PasteRequestModule {
3838 "716249661798612992" // BenBenLaw Server
3939 );
4040
41- private static final List <String > SUPPORTED_SITES = List .of (
42- "gnomebot.dev"
43- );
44-
4541 private static final List <String > VALID_CONTENT_TYPES = List .of (
4642 "application/json" ,
4743 "text"
4844 );
4945
5046 private static final Emoji CREATE_GISTS = Emoji .fromUnicode ("\uD83D \uDCCB " );
51- private static final Emoji ANALYZE = Emoji .fromUnicode ("\uD83E \uDDD0 " );
5247
5348 public static void register () {
5449 DiscordMessageReceivedEvent .BUS .addListener (PasteRequestModule ::onMessage );
@@ -162,49 +157,23 @@ public static void createGists(Message msg, User requester) {
162157 });
163158 }
164159
165- public static List <String > extractUrls (String text ) {
166- List <String > urls = new ArrayList <>();
167- Matcher matcher = urlPattern .matcher (text );
168- while (matcher .find ()) {
169- urls .add (matcher .group (1 ));
170- }
171- return urls ;
172- }
173-
174160 public static void onMessage (DiscordMessageReceivedEvent event ) {
175161 var discordEvent = event .getDiscordEvent ();
176162 var message = discordEvent .getMessage ();
177- var analyze = false ;
178163
179164 if (message .getAuthor ().isBot ()) return ;
180165 if (message .getAuthor ().isSystem ()) return ;
181166
182-
183- if (message .getContentRaw ().contains ("https://" )) {
184- chk : for (String extractUrl : extractUrls (message .getContentRaw ())) {
185- for (String supportedSite : SUPPORTED_SITES ) {
186- if (extractUrl .contains (supportedSite )) {
187- analyze = true ;
188- break chk ;
189- }
190- }
191- }
192- }
193-
194167 if (!message .getAttachments ().isEmpty ()) {
195168 chk : for (Message .Attachment attachment : message .getAttachments ()) {
196169 for (String validContentType : VALID_CONTENT_TYPES ) {
197170 if (attachment .getContentType ().contains (validContentType )) {
198171 message .addReaction (CREATE_GISTS ).queue ();
199- analyze = true ;
200172 break chk ;
201173 }
202174 }
203175 }
204176 }
205-
206- if (analyze )
207- message .addReaction (ANALYZE ).queue ();
208177 }
209178
210179 public static void onReact (DiscordMessageReactionAddEvent event ) {
0 commit comments