[ModLog API] Add default casetypes, remove need for a specific auditlog action #2901

Merged
DiscordLiz merged 10 commits from 2897 into V3/develop 2019-07-27 21:37:30 +02:00
DiscordLiz commented 2019-07-24 17:10:02 +02:00 (Migrated from github.com)

Type

  • Bugfix
  • Enhancement
  • New feature

Description of the changes

This is doing multiple things.

  1. Modlog entries are no longer reliant on the mod cog being loaded.
  2. This adds some default, preregistered generic casetypes for cog creator use.
  3. This removes the audit_type parameter from CaseTypes
  4. This fixes the double post to modlog for bans which are registered by cogs other than red's mod cog
  • The choice of fix was to require case usage for all bot actions intended to be caught.
  • Red now only detects actions made by other users directly in the interface.
  • This can be improved if https://github.com/discordapp/discord-api-docs/issues/575 is implemented in a way which doesn't wait on the auditlog to appear or if events are ever changed to include the auditlog info with them.

resolves #2897

### Type - [ ] Bugfix - [X] Enhancement - [ ] New feature ### Description of the changes This is doing multiple things. 1. Modlog entries are no longer reliant on the mod cog being loaded. 2. This adds some default, preregistered generic casetypes for cog creator use. 3. This removes the `audit_type` parameter from CaseTypes 4. This fixes the double post to modlog for bans which are registered by cogs other than red's mod cog - The choice of fix was to require case usage for all bot actions intended to be caught. - Red now only detects actions made by other users directly in the interface. - This can be improved if https://github.com/discordapp/discord-api-docs/issues/575 is implemented in a way which doesn't wait on the auditlog to appear or if events are ever changed to include the auditlog info with them. resolves #2897
palmtree5 (Migrated from github.com) reviewed 2019-07-24 17:10:02 +02:00
tekulvw (Migrated from github.com) reviewed 2019-07-24 17:10:02 +02:00
Twentysix26 (Migrated from github.com) reviewed 2019-07-24 17:10:02 +02:00
Jackenmen commented 2019-07-24 17:20:00 +02:00 (Migrated from github.com)

I know it's a draft and all that, but wouldn't it be better if the case could be first created without a mod so that it shows up in modlog and later add a mod if we manage to find it in audit log? Yes, I know there is a [p]reason command that requires moderator to be available in case, but at least the ban will still show up in modlog, if we don't find audit log entry.

I know it's a draft and all that, but wouldn't it be better if the case could be first created without a mod so that it shows up in modlog and later add a mod if we manage to find it in audit log? Yes, I know there is a `[p]reason` command that requires moderator to be available in case, but at least the ban will still show up in modlog, if we don't find audit log entry.
DiscordLiz commented 2019-07-24 17:34:07 +02:00 (Migrated from github.com)

No.
This still detects and records non-bot ban actions for servers that care about a full record, but doesn't log actions taken by the bot unless a cog creates a case. This prevents the awkward issues with double case entries for 3rd party cogs which issue bans. I also moved all the listeners out of the mod cog so that modlog can function with or without mod loaded.

No. This still detects and records non-bot ban actions for servers that care about a full record, but doesn't log actions taken by the bot unless a cog creates a case. This prevents the awkward issues with double case entries for 3rd party cogs which issue bans. I also moved all the listeners out of the mod cog so that modlog can function with or without mod loaded.
TrustyJAID (Migrated from github.com) reviewed 2019-07-27 19:44:53 +02:00
@ -51,12 +57,88 @@ async def _init():
_conf.register_custom(_CASETYPES)
TrustyJAID (Migrated from github.com) commented 2019-07-27 19:44:53 +02:00

This should be entry.user.id.

This should be `entry.user.id`.
DiscordLiz (Migrated from github.com) reviewed 2019-07-27 19:53:49 +02:00
@ -51,12 +57,88 @@ async def _init():
_conf.register_custom(_CASETYPES)
DiscordLiz (Migrated from github.com) commented 2019-07-27 19:53:49 +02:00

I've fixed that and the other instance of using the wrong attribute.

I've fixed that and the other instance of using the wrong attribute.
mikeshardmind (Migrated from github.com) requested changes 2019-07-27 21:18:22 +02:00
mikeshardmind (Migrated from github.com) left a comment

A few remaining things before this is ready for use.

A few remaining things before this is ready for use.
@ -51,12 +57,88 @@ async def _init():
_conf.register_custom(_CASETYPES)
mikeshardmind (Migrated from github.com) commented 2019-07-27 20:58:57 +02:00

This before/after condition needs to exist inside the find as well. (Try fetching the auditlogs manually to see why)
(on both listeners)

This before/after condition needs to exist inside the find as well. (Try fetching the auditlogs manually to see why) (on both listeners)
mikeshardmind (Migrated from github.com) commented 2019-07-27 21:17:13 +02:00

needs a break after this (and other) to prevent sleeping again before making the case

needs a break after this (and other) to prevent sleeping again before making the case
@ -54,0 +99,4 @@
if not guild.me.guild_permissions.view_audit_log:
return
try:
mikeshardmind (Migrated from github.com) commented 2019-07-27 20:59:36 +02:00

Can you add a 10 second sleep here (and on the other) to help make the servers without a large audit log delay not wait as long?

Can you add a 10 second sleep here (and on the other) to help make the servers without a large audit log delay not wait as long?
DiscordLiz (Migrated from github.com) reviewed 2019-07-27 21:29:43 +02:00
@ -51,12 +57,88 @@ async def _init():
_conf.register_custom(_CASETYPES)
DiscordLiz (Migrated from github.com) commented 2019-07-27 21:29:42 +02:00

I went for a slight restructure of the loop instead.

I went for a slight restructure of the loop instead.
mikeshardmind (Migrated from github.com) approved these changes 2019-07-27 21:36:26 +02:00
mikeshardmind (Migrated from github.com) left a comment

Thanks for following up on reviews, This seems ready for use now.

Thanks for following up on reviews, This seems ready for use now.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot!2901
No description provided.