-
-
Notifications
You must be signed in to change notification settings - Fork 89
Java RSS Feed #1037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
christolis
merged 54 commits into
Together-Java:develop
from
nateweisz:feat/java-mail-feed
Apr 13, 2024
Merged
Java RSS Feed #1037
Changes from all commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
630c02f
wip: initial commit
nateweisz 03036e4
style(spotlessApply): run uncalled task
christolis 28b6160
fix: register routine in features list
christolis b494cd3
feat: update config.json.template
christolis c746bfa
wip(rss-config): change config design
christolis cbaa40b
feat: make targetChannelPattern into a Map
christolis dbcd59b
refactor: don't hardcode number
christolis 6e5f34a
feat: improve constructEmbedMessage
christolis 2d93e9f
feat: improve the description constructing
christolis 2da57d6
feat: increase MAX_CONTENTS to 300
christolis 066b2e9
wip: changes
christolis 728d08b
feat(rss-feed): convert polling interval to be configurable
nateweisz cae7e38
feat: improve date parsing
christolis 9eb905b
feat: update config.json.template
christolis a75be80
feat: improve date handling and add embed timestamp
christolis faf8e85
fix: malformed `config.json.template`
nateweisz b77955f
fix: now correctly finds the latest date
nateweisz d068973
feat: improve date handling and add embed timestamp
christolis 964c080
fix: now correctly finds the latest date
nateweisz 5a19fe9
feat: you can now optionally declare a specific channel for a feed to…
nateweisz 0a3c293
finished javadoc todos
nateweisz b52e95e
improved embed
nateweisz 66a4350
feat(rss-routine): working version
christolis 56eb1b8
feat(rss-routine): increase MAX_CONTENTS to 1000
christolis 0c0770a
refactor(rss-routine): rename to RSSHandlerRoutine
christolis 9629b35
docs(rss-routine): add JavaDocs for constructor and class
christolis 19befa6
feat: add @NotNull annotation
christolis fc682ca
Update RSSHandlerRoutine.java
nateweisz 184aee7
fix: reverse feed so it posts in correct order
nateweisz 44df6b4
refactor: use variable types instead of var
christolis 39a6986
feat: use fetchAny() instead of fetch()
christolis 061ab50
fix(rss-handler): remove redundant empty check
christolis 15510bf
refactor(rss-handler): remove AtomicReference usage
christolis 31bf197
resolve a couple issues
nateweisz 851fb06
refactor(rss): switch to using a record for the config
christolis 2b6bc7c
feat: rename to fallbackChannelPattern
christolis e3028fa
refactor: remove unnecessary throws exception in method signature
christolis 34974e5
docs: add a few missing parameters and fix typos
christolis e284315
refactor: reduce try-catch scope and added clarifying comment
christolis 9deaa02
perf: use Stream instead of StringBuilder
christolis 237d6ba
refactor: put fallback case into an else statement
christolis b48c327
refactor: switch to Map#containsKey() for targetChannelPatterns
christolis e257595
feat: modularize sendRss() method and improve variable names
christolis 18135e6
refactor: remove star import
christolis 48f0e76
fix: add Objects#requireNonNull() on rssConfig
christolis 6f9e2dd
changes
christolis 7f14bc2
feat: improvements from code reviews
christolis 82fd9b7
feat: add DateTimeParseException in signature
christolis 32f5f9b
refactor: use .orElseThrow() instead of .get()
christolis cf67e4d
fixed missing coma after rss configuration
nateweisz 2fb249f
fix(rss): feeds support multiple channels
nateweisz 0c7231a
Optional<List<TextChannel>> -> List<TextChannel>
nateweisz 49bdf53
extract item post predicate to seperate function
nateweisz dfcd27e
various changes from null to optional
nateweisz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
application/src/main/java/org/togetherjava/tjbot/config/RSSFeed.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.togetherjava.tjbot.config; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* Represents an RSS feed configuration. | ||
*/ | ||
public record RSSFeed(@JsonProperty(value = "url", required = true) String url, | ||
Alathreon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonProperty(value = "targetChannelPattern") @Nullable String targetChannelPattern, | ||
@JsonProperty(value = "dateFormatterPattern", | ||
required = true) String dateFormatterPattern) { | ||
|
||
/** | ||
* Constructs an RSSFeed object. | ||
* | ||
* @param url the URL of the RSS feed | ||
* @param targetChannelPattern the target channel pattern | ||
* @param dateFormatterPattern the date formatter pattern | ||
* @throws NullPointerException if any of the parameters are null | ||
*/ | ||
public RSSFeed { | ||
Alathreon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Objects.requireNonNull(url); | ||
Objects.requireNonNull(targetChannelPattern); | ||
Objects.requireNonNull(dateFormatterPattern); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
application/src/main/java/org/togetherjava/tjbot/config/RSSFeedsConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.togetherjava.tjbot.config; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Represents the configuration for an RSS feed, which includes the list of feeds to subscribe to, a | ||
* pattern for identifying Java news channels, and the interval (in minutes) for polling the feeds. | ||
* | ||
* @param feeds The list of RSS feeds to subscribe to. | ||
* @param fallbackChannelPattern The pattern used to identify the fallback text channel to use. | ||
* @param pollIntervalInMinutes The interval (in minutes) for polling the RSS feeds for updates. | ||
*/ | ||
public record RSSFeedsConfig(@JsonProperty(value = "feeds", required = true) List<RSSFeed> feeds, | ||
Alathreon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
@JsonProperty(value = "fallbackChannelPattern", | ||
required = true) String fallbackChannelPattern, | ||
@JsonProperty(value = "pollIntervalInMinutes", required = true) int pollIntervalInMinutes) { | ||
|
||
/** | ||
* Constructs a new {@link RSSFeedsConfig}. | ||
* | ||
* @param feeds The list of RSS feeds to subscribe to. | ||
* @param fallbackChannelPattern The pattern used to identify the fallback text channel to use. | ||
* @param pollIntervalInMinutes The interval (in minutes) for polling the RSS feeds for updates. | ||
* @throws NullPointerException if any of the parameters (feeds or fallbackChannelPattern) are | ||
* null | ||
*/ | ||
public RSSFeedsConfig { | ||
Alathreon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Objects.requireNonNull(feeds); | ||
Objects.requireNonNull(fallbackChannelPattern); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.