Essentially, the point of this (hypothetical) module is to make sure that the bot only pulls posts that contain actual strat submissions. There are limited ways to do this, but the real problem is after the check happens. Formatting is also an issue, and not just for consistency.
The bot needs to know which posts are submissions and which are not.
This will help the bot sort through the posts more efficiently. Here are some thoughts I had on this.
Code
The code will be simpler, maybe just an includes statement. The module could double check the validation using an consecutive array method. Maybe?
Some suggestions
This would check to see if the title had the keyword submission in it:
This would remove the
[submission]
text from the title. This could be invoked right before adding it todata
.Here is a link for the MDN docs for the
replace
method.Another method for loping off the
submisson
text:In this example, we use the length of the
[submission]
keyword to take it off the beginning of the title.This method has some advantages:
But also has some disadvantages:
It will definitely be easier to code. Here is the docs reference for
substring
.Format is pretty free, but I would recommend formatting it like I (@Spaceface16518) formatted the
export
module.I have formatted it like the following:
Summary
Essentially, the point of this (hypothetical) module is to make sure that the bot only pulls posts that contain actual strat submissions. There are limited ways to do this, but the real problem is after the check happens. Formatting is also an issue, and not just for consistency.