Abstract News Parser¶
Class Reference¶
Function Reference¶
-
class
NewsParser¶ Abstract news parser base class
Note
All attributes are defined at the child parser level
-
bot¶ discord.commands.Botinstance
-
postednews¶ List containing posted information.
Format of list entries is defined at the child parser level
-
_parsername¶ Descriptive parser shortname
-
_loadconverter¶ Function that accepts externally saved posts and formats them for
postednews
-
_saveconverter¶ Function that accepts entries from
postednewsand formats them for external saving
-
_comparator¶ Model attribute (as
str) used to compare posts to the list of posted news as a new post check
-
loadposted()¶ Load saved information from the child class-specified JSON file into
self.loadpostedJSON data is assumed to be stored as a list.
self._loadconverteris run for each JSON list entry
-
saveposted()¶ Dump information from
self.postednewsinto a child class-specified JSON fileself.postednewsis assumed to be a list.self._saveconverteris run for each list entry prior to the JSON dump
-
coroutine
patchcheck(posts: typing.List)¶ Abstract patch checking method.
- On invocation:
- Load saved posts using
NewsParser.loadposted - Check
postsagainst loaded posts usingself._comparatorto get the appropriate comparison attribute - If new posts are present, call the child class’
postembedmethod to generate & send Discord embed - Save posted news using
NewsParser.saveposted
- Load saved posts using
-