This repository has been archived by the owner on Nov 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
134 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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 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 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,18 @@ | ||
Manual Patch Check Abstract Helper | ||
====================================== | ||
|
||
Class Reference | ||
--------------- | ||
.. class:: ManualCheck | ||
|
||
.. comethod:: check(ctx: commands.Context, toinvoke: typing.Callable, commandstr: str) | ||
:staticmethod: | ||
|
||
Helper method for manual patch check invocation commands | ||
|
||
``toinvoke`` is the parser-specific patch check function to invoke | ||
|
||
``commandstr`` is a descriptive string to use for logging & bot feedback messages | ||
|
||
.. note:: | ||
``bot.Helpers.isDM`` and ``bot.Helpers.isOwner`` checks are run prior to invoking the patch check function |
This file contains 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,73 @@ | ||
Abstract News Parser | ||
======================== | ||
|
||
Class Reference | ||
--------------- | ||
|
||
|
||
Function Reference | ||
------------------ | ||
|
||
.. class:: NewsParser | ||
|
||
Abstract news parser base class | ||
|
||
.. note:: | ||
All attributes are defined at the child parser level | ||
|
||
.. attribute:: bot | ||
|
||
``discord.commands.Bot`` instance | ||
|
||
.. attribute:: postednews | ||
|
||
List containing posted information. | ||
|
||
Format of list entries is defined at the child parser level | ||
|
||
.. attribute:: _parsername | ||
|
||
Descriptive parser shortname | ||
|
||
.. attribute:: _loadconverter | ||
|
||
Function that accepts externally saved posts and formats them for ``postednews`` | ||
|
||
.. attribute:: _saveconverter | ||
|
||
Function that accepts entries from ``postednews`` and formats them for external saving | ||
|
||
.. attribute:: _comparator | ||
|
||
Model attribute (as ``str``) used to compare posts to the list of posted news as a new post check | ||
|
||
.. method:: loadposted | ||
|
||
Load saved information from the child class-specified JSON file into ``self.loadposted`` | ||
|
||
JSON data is assumed to be stored as a list. ``self._loadconverter`` is run for each JSON list entry | ||
|
||
.. method:: saveposted | ||
|
||
Dump information from ``self.postednews`` into a child class-specified JSON file | ||
|
||
``self.postednews`` is assumed to be a list. ``self._saveconverter`` is run for each list entry prior to the JSON dump | ||
|
||
.. comethod:: patchcheck(posts: typing.List) | ||
|
||
Abstract patch checking method. | ||
|
||
On invocation: | ||
#. Load saved posts using ``NewsParser.loadposted`` | ||
#. Check ``posts`` against loaded posts using ``self._comparator`` to get the appropriate comparison attribute | ||
#. If new posts are present, call the child class' ``postembed`` method to generate & send Discord embed | ||
#. Save posted news using ``NewsParser.saveposted`` | ||
|
||
Function Reference | ||
------------------ | ||
|
||
.. cofunction:: patchchecktimer(client, parsers: typing.Tuple = (), sleepseconds: int = 3600) | ||
|
||
Abstract patch checking event loadposted | ||
|
||
Invoke the input ``parsers`` every ``sleepseconds`` |
This file contains 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 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 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 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 |
---|---|---|
|
@@ -8,4 +8,6 @@ Abstract base models by Wumbot's cogs | |
|
||
Overwatch | ||
Steam | ||
Steam | ||
NewsParser | ||
ManualCheck |
This file contains 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 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ build: | |
image: latest | ||
|
||
python: | ||
version: 3.6 | ||
version: 3.7 | ||
pip_install: true | ||
extra_requirements: | ||
- docs |
This file contains 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