aboutsummaryrefslogtreecommitdiffstats
path: root/bot/cogs/sync/syncers.py (follow)
Commit message (Collapse)AuthorAgeLines
* Move extensions into sub-directoriesGravatar MarkKoz2020-08-13-347/+0
|
* Allow role pings in Syncers and help_channels.pyGravatar Leon Sandøy2020-07-12-1/+6
| | | | | | | | | | | | | | | | | Now that we're running Discord 1.4.0a, we need to explicitely allow all the role mentions for sends that don't use ping one of the globally whitelisted role pings, which are Moderators, Admins and Owners. We were pinging roles other than Mods+ in exactly two cases: - Inside the Syncers, whenever we ask for sync confirmation (if the number of roles or users to sync is unusually high) - In the help_channels.py system, whenever we max out help channels and are unable to create more. This commit addresses both of these. GitHub #1038 https://github.com/python-discord/bot/issues/1038
* Remove all sending of avatar_hash.Gravatar Leon Sandøy2020-05-27-2/+1
| | | | | | | This is a companion commit to this PR: https://github.com/python-discord/site/pull/356 This PR must be merged before this commit.
* (Syncers): Fixed wrong except statementGravatar ks1292020-04-09-1/+2
| | | Replaced `TimeoutError` with `asyncio.TimeoutError`.
* Increase syncer logging levelGravatar S. Co12020-03-28-1/+1
|
* Logging severity pass from reviewGravatar S. Co12020-03-28-1/+1
|
* Move syncer confirmation reaction check out of finally clauseGravatar S. Co12020-03-01-11/+11
| | | Returning directly out of a `finally` clause can cause any exceptions raised in the clause to be discarded, so we can remove the finally clause entirely and shift the control statements into the body of the function
* Fix mismatched constant names in syncer testsGravatar S. Co12020-02-25-4/+4
|
* Sync: code style refactoringGravatar MarkKoz2020-02-23-5/+6
| | | | | | * Convert diff namedtuple to dict outside the dict comprehension * Define long condition as a boolean instead of in the if statement * Pass role and user dicts to aiohttp normally instead of unpacking
* Sync: add confirmation timeout and max diff to configGravatar MarkKoz2020-02-19-14/+11
|
* Sync tests: ignore coverage for abstract methodsGravatar MarkKoz2020-02-12-3/+3
| | | | | | It's impossible to create an instance of the base class which does not have the abstract methods implemented, so it doesn't really matter what they do.
* Sync: create a separate function to get the confirmation resultGravatar MarkKoz2020-02-12-9/+32
|
* Sync: fix precedence of conditional expression in _reaction_checkGravatar MarkKoz2020-02-12-1/+1
|
* Sync: make the reaction check an instance method instead of nestedGravatar MarkKoz2020-02-12-13/+28
| | | | The function will be easier to test if it's separate rather than nested.
* Sync: handle API errors gracefullyGravatar MarkKoz2020-02-12-10/+21
| | | | | | | The whole sync is aborted when an error is caught for simplicity's sake. The sync message is edited to display the error and the traceback is logged. To distinguish an error from an abort/timeout, the latter now uses a warning emoji while the former uses the red cross.
* Sync: mention core devs when results are shown & fix missing spaceGravatar MarkKoz2020-02-12-6/+8
|
* Sync: split _confirm() into two functionsGravatar MarkKoz2020-02-12-10/+32
| | | | | | One is responsible for sending the confirmation prompt while the other waits for the reaction. The split allows for the confirmation prompt to be edited with the results of automatic syncs too.
* Sync: keep the mention for all edits of the confirmation promptGravatar MarkKoz2020-02-12-4/+6
| | | | This makes it clearer to users where the notification came from.
* Sync: add trace and debug loggingGravatar MarkKoz2020-02-12-1/+16
|
* Sync: fix confirmation reaction checkGravatar MarkKoz2020-02-12-5/+10
| | | | | | | * Ignore bot reactions * Check for core dev role if sync is automatic * Require author as an argument to _confirm() so it can be compared against the reaction author
* Sync: remove author mention from confirm promptGravatar MarkKoz2020-02-12-2/+2
|
* Sync: fix overwriting message with None after editing itGravatar MarkKoz2020-02-12-1/+1
|
* Sync: fix passing context instead of message to _confirm()Gravatar MarkKoz2020-02-12-4/+5
| | | | * Mention possibility of timing out as a reason for aborting a sync
* Sync: fix missing await for fetch_channelGravatar MarkKoz2020-02-12-1/+1
|
* Sync: allow for None values in DiffsGravatar MarkKoz2020-02-12-4/+4
|
* Sync: make Role, User, and Diff privateGravatar MarkKoz2020-02-12-15/+15
|
* Sync: remove generic type from DiffGravatar MarkKoz2020-02-12-19/+10
| | | | | | | | | | It doesn't play along well with NamedTuple due to metaclass conflicts. The workaround involved created a NamedTuple-only base class, which does work but at the cost of confusing some static type checkers. Since Diff is now an internal data structure, it no longer really needs to have precise type annotations. Therefore, a normal namedtuple is adequate.
* Sync: move sync logic into Syncer base classGravatar MarkKoz2020-02-12-61/+47
| | | | | | | | | | | | The interface was becoming cumbersome to work with so it was all moved to a single location. Now just calling Syncer.sync() will take care of everything. * Remove Optional type annotation from Diff attributes * _confirm() can edit the original message and use it as the prompt * Calculate the total diff and compare it against the max before sending a confirmation prompt * Remove abort message from sync(); _confirm() will handle that
* Sync: prompt to confirm when diff is greater than 10Gravatar MarkKoz2020-02-12-24/+146
| | | | | | | | | | | The confirmation prompt will be sent to the dev-core channel or the specified context. Confirmation is done via reactions and waits 5 minutes before timing out. * Add name property to Syncers * Make _get_diff private; only sync() needs to be called now * Change spelling of synchronize to synchronise * Update docstrings
* Sync: create classes for syncersGravatar MarkKoz2020-02-12-224/+138
| | | | | | | | | Replaces the functions with a class for each syncer. The classes inherit from a Syncer base class. A NamedTuple was also created to replace the tuple of the object differences that was previously being returned. * Use namedtuple._asdict to simplify converting namedtuples to JSON
* Change all Bot imports to use the subclassGravatar MarkKoz2019-12-07-3/+4
|
* Apply suggestions from code reviewGravatar S. Co12019-09-22-1/+1
| | | Co-Authored-By: Mark <[email protected]>
* Docstring linting chunk 5Gravatar sco12019-09-10-6/+1
|
* Incorporating Mark's feedback on return annotationsGravatar Sebastiaan Zeeff2019-08-16-11/+15
|
* Kaizen: Change all string concats to f-stringsGravatar Sebastiaan Zeeff2019-08-16-3/+3
|
* Adding missing function annotationsGravatar Sebastiaan Zeeff2019-08-16-2/+2
|
* Adding support for storing role positions and deleting rolesGravatar Sebastiaan Zeeff2019-08-15-9/+17
|
* Move diff logging to cog, add manual sync commands.Gravatar Johannes Christ2019-01-03-10/+14
|
* Add documentation strings and comments.Gravatar Johannes Christ2019-01-03-10/+71
|
* Remove obsolete `user is None` check.Gravatar Johannes Christ2019-01-03-3/+0
|
* Respect immutability.Gravatar Johannes Christ2019-01-03-2/+2
|
* Create or update roles as needed.Gravatar Johannes Christ2019-01-03-4/+21
|
* Update users who joined and left.Gravatar Johannes Christ2019-01-03-3/+27
|
* Remove useless `chunk_by` function.Gravatar Johannes Christ2019-01-03-7/+0
|
* Sync updated users since last boot.Gravatar Johannes Christ2019-01-03-19/+18
|
* Send users one by one.Gravatar Johannes Christ2019-01-01-17/+14
|
* Implement basic member syncing.Gravatar Johannes Christ2019-01-01-19/+95
|
* Factor out sync cog to package.Gravatar Johannes Christ2019-01-01-0/+59