Skip to content

Commit 7319c89

Browse files
committed
Fix the autodetection detecting channel links
1 parent e6c3f29 commit 7319c89

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/xyz/htmlcsjs/coffeeFloppa/handlers/MessageHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private static Mono<Object> executeMessage(Message message, String msgContent) {
109109
// we do a little bit of executing
110110
sendMessage(message, command);
111111
} catch (IndexOutOfBoundsException ignored) {}
112-
} else if ((CommandUtil.ghIssuePattern.matcher(msgContent).matches() || CommandUtil.ghIssueSmallPattern.matcher(msgContent).matches())&& !message.getAuthor().get().isBot()) {
112+
} else if ((CommandUtil.ghIssuePattern.matcher(msgContent).find() || CommandUtil.ghIssueSmallPattern.matcher(msgContent).find())&& !message.getAuthor().get().isBot()) {
113113
sendMessage(message, commands.get("gh"));
114114
} else {
115115
for (String key : searchCommands.keySet()) {

src/main/java/xyz/htmlcsjs/coffeeFloppa/helpers/CommandUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class CommandUtil {
2323
public static final Pattern urlPattern = Pattern.compile("(?:^|[\\W])((ht|f)tp(s?):\\/\\/|www\\.)(([\\w\\-]+\\.){1,}?([\\w\\-.~]+\\/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]\\*$~@!:/{};']*)",
2424
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
2525
public static final Pattern ghIssuePattern = Pattern.compile(".*?([a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*\\/[a-zA-Z0-9_\\-\\.]+)#(\\d+).*?", Pattern.MULTILINE);
26-
public static final Pattern ghIssueSmallPattern = Pattern.compile(".*?([\\w.]+)?#(\\d+).*?", Pattern.MULTILINE);
26+
public static final Pattern ghIssueSmallPattern = Pattern.compile("(?<![^\\s(])([\\w.]+)?#(\\d+)", Pattern.MULTILINE);
2727

2828
public static boolean getAllowedToRun(Message message) {
2929
Set<Snowflake> userRoleIDs;

0 commit comments

Comments
 (0)