39 Commits

Author SHA1 Message Date
Xevion
b311700356 Expanded database testing
- Tested Submission.count descriptor
- Tested Submission.clear_other_votes
- Expanded Submission.advance testing to include exceptions, Submission
.active, Submission.completed and Submission.voting
- Changed db model __repr__ implementations to use f-strings
- Fixed Submission.update force kwarg not implemented.
- Small formatting changes, new TODO, noinspection on protected access
- Votes setter now removes duplicate keys (maintains order)
- Removed 'aiosqlite' from Pipfile general package requirements
2021-02-19 03:29:53 -06:00
Xevion
63f4c594b7 Improved 'leaderboard' command embed formatting
- Added proper vote count to leaderboard
- Supported shared rankings in leaderboard
- New generator in helpers 'ending_iterator'
2021-02-18 09:31:16 -06:00
Xevion
eb93b9f3bf Fix critical mistake in Submission.clear_other_votes
- As well as other possible flaws in various functions of the bot's
operation.
- Fixed inactive prematurely closed Period's showing their final state
instead of Finished.
2021-02-18 09:04:55 -06:00
Xevion
813bb7ea1d Improve permission_explanation for prematurely closed Periods
- Periods closed improperly through the 'close' command were not being
shown properly through the 'status' command.
- Fixed error in Submission state checking in on_message handling.
- Added embed support to 'close' command message responses.
2021-02-18 08:04:27 -06:00
Xevion
fdc64012b0 Added better checks for updating votes outside of the voting period
To be honest, the checks are sort of randomly placed how I wanted them.
There is no true rhyme or reason to the logic implemented here, but it
really shouldn't matter anyways - it will do the job.
2021-02-18 07:46:41 -06:00
Xevion
1dc9c7d435 Implemented generic command error handling
Also:
- Removed emotes from some of the error messages.
- Changed how emotes were placed into the leaderboard slightly
- Moved around TODO strings into proper files and added more.
- Corrected main.py cog loading references.
- Improved ContestBot.reject with message references and used built-in
delete_after keyword argument.
- Minor docstring/light formatting
2021-02-18 06:07:40 -06:00
Xevion
8164d528a5 Used Embeds in all messages sent
Additionally, helper methods and new constants for Embed colors have
been added to simplify this process of sending messages with embeds.
Colors have been chosen, too.

Extra: The ContestCommandsCog has been given a
name kwarg for the 'help' command to display it better.
2021-02-18 05:11:06 -06:00
Xevion
5a4da4cec0 Implement simple 'status' command
Implements the status command, creating a new Submission.permission_explanation
function in the process. Also changes the leaderboard command's embed
formatting slightly.
2021-02-18 04:31:45 -06:00
Xevion
95a87cb6dd Implemented 'leaderboard' command
This takes use of the previous commit's changes: the Submission.count
column.
2021-02-18 04:07:59 -06:00
Xevion
bd3778182d Added new Submission column: count
Since I'm not good at complex SQLAlchemy syntax and database querying
through SQL or the ORM, I'm simply using a descriptor to update the
count column everytime votes is modified.
2021-02-18 04:06:39 -06:00
Xevion
1b777a3689 Split ContestCog into ContestCommandsCog and ContestEventsCog
expected_react_deletions and expected_msg_deletions were moved into bot
.py
There may be more edits included in this that I cannot see.
Added docstrings to get_message and fetch_message
2021-02-18 01:35:33 -06:00
Xevion
39b0dc9a96 Enforce Period.states for on_raw_reaction_add
New submissions are also properly enforced via Period.states, in-case
one makes it passed message permissions. Added helper reject method
2021-02-17 22:55:31 -06:00
Xevion
7427763b57 Implement Submission.update and get/fetch message helper functions
Added and implemented helper functions for getting and fetching messages
given a payload's integer channel and message IDs.
Implemented Submission.votes list modifications and Submission.update in
 code (tested with real bot)
 Committed constants.py containing ReactionMarker used in models.py
2021-02-17 05:18:25 -06:00
Xevion
5c70a78798 Ensure Submission.update modifies votes column
I forgot to actually add this in properly.
2021-02-17 05:12:52 -06:00
Xevion
8f67b3c785 Fix MutableJSON issues with NestedMutableList
Add new exception SelfVoteException for Submission.increment
Implement new string representation built-in functions for all models
2021-02-17 02:55:55 -06:00
Xevion
35c7d4fb15 Simplify PermissionOverwrite, refactor on_raw_reaction_add's upvote detection 2021-02-17 02:37:04 -06:00
Xevion
ea8bd49216 remove defaults from MutableJSON column, mistakenly flipped comparator 2021-02-16 08:02:43 -06:00
Xevion
33ac0d7792 overhaul voting to support smart single voting protections and enforcing, new exceptions, vote clearing functions inside models, persistence updating 2021-02-16 07:27:02 -06:00
Xevion
0b8aaec332 actually implement message rejection for attachment filtering, TODO'd warning helper func 2021-02-15 05:25:33 -06:00
Xevion
c234487302 minor typehint fixes, make optional arg into optional kwarg, add additional TODOs, add basic attachment filtering 2021-02-15 05:22:22 -06:00
Xevion
d99be7db9d use payload known params instead of cached message, implement raw_bulk_message_deletion, on_raw_reaction_clear, on_raw_reaction_clear_emoji, helpers.is_upvote for better upvote emote checking 2021-02-15 03:43:00 -06:00
Xevion
69f1f42698 lots of TODO ideas, plan for advance command error handling, leaderboard command idea 2021-02-14 01:49:48 -06:00
Xevion
2178a3ec99 Move Submission votes count logic into model, add improved verification system, add verification that the bot is always reacting to the message (on every reaction add/removal) 2021-02-14 01:48:56 -06:00
Xevion
bb28f38fd9 commit constants.py 2021-02-14 01:47:27 -06:00
Xevion
a5116dc093 finished basic reaction logic/protections and vote tallying, formatting & session.query typehints, correct advance command permissions more 2021-02-14 01:23:00 -06:00
Xevion
e6d001f2b7 add voting reactions method, typehint the rest of the bot.py session.query calls 2021-02-14 01:19:56 -06:00
Xevion
21781d3529 simplify models.py imports, add typehints, add future TODO ideas, add set_votes safety logging method, move and typehint Period.submissions as a List 2021-02-14 01:19:18 -06:00
Xevion
28d7768340 add permission/cooldown checks, implement permission setting logic, fix state not being advanced, fix guild.submission disparity and use proper typehinting to catch errors like this 2021-02-13 18:31:38 -06:00
Xevion
1f46a98f37 add guilds to database on connection if not already in database, remove old db.py, switch from query filter_by to simple get by primary key 2021-02-13 08:35:00 -06:00
Xevion
00f5b64f3f fix ambiguous foreign key relationships, Period.state default, fixing back populates 2021-02-13 08:31:09 -06:00
Xevion
ee41885e89 running bot with database, switch to helper function for testing 2021-02-13 08:29:35 -06:00
Xevion
ca10389aea fully re-implement contest cog with sqlalchemy, begin planning proper period logic in TODOs 2021-02-13 08:28:57 -06:00
Xevion
5978068e9b add sqlalchemy to bot startup, fix PyCharm typehinting for Session context manager, simplify autocommit and autoclose separate context managers into singular with kwargs 2021-02-13 05:23:12 -06:00
Xevion
c8e0ae1bf2 refactor base ContestBot logic to use new sqlalchemy models, commit exceptions.py 2021-02-13 05:18:34 -06:00
Xevion
91594646c3 simplify period deactivation logic, refactor advance_state logic into check_not_finished wrapper 2021-02-13 05:14:42 -06:00
Xevion
2eb44b56e4 improve models relationships, add state management to Period model 2021-02-13 05:00:20 -06:00
Xevion
7e578fb132 begin switching to sqlalchemy for database management 2021-02-13 03:23:00 -06:00
Xevion
ea825b9a30 switch to pipfile, new tests 2021-02-12 23:19:35 -06:00
Xevion
89b16fdc04 refactor contest to bot folder, work on generic sqlite update query generator, work on new submissions/voting period logic commands, get away from get_submission_channel 2021-02-12 17:46:46 -06:00