Skip to content

Commit

Permalink
Fix #311 and make sure we are on a guild
Browse files Browse the repository at this point in the history
  • Loading branch information
rtm516 committed Apr 20, 2024
1 parent c2da94a commit e93082d
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,16 @@ public class PreviewHandler extends ListenerAdapter {

@Override
public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
if (event.getAuthor().isBot())
return;
if (event.getAuthor().isBot()) return;
if (!event.isFromGuild()) return;

NewsChannel previewFeedsChannel = ServerSettings.getPreviewFeedsChannel(event.getGuild());
if (previewFeedsChannel == null)
return;
if (event.getChannel().getIdLong() != previewFeedsChannel.getIdLong())
return;
if (previewFeedsChannel == null) return;
if (event.getChannel().getIdLong() != previewFeedsChannel.getIdLong()) return;

// Create a post in the preview forum channel with this content
ForumChannel previewChannel = ServerSettings.getPreviewChannel(event.getGuild());
if (previewChannel == null)
return;
if (previewChannel == null) return;

// Check if the message contains a GitHub PR link and extract the repo and PR
// number via matcher
Expand Down

0 comments on commit e93082d

Please sign in to comment.