mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
* Readd work due to redoing branch * [modlog] Move to core and start work on separating it from cogs * More work on modlog separation * [Core] Finish logic for modlog, do docstrings, async getters * [Core] Add stuff to dunder all * [Docs] Add mod log docs * [Core] Move away from dunder str for Case class * [Docs] don't need to doc special members in modlog docs * More on mod log to implement commands * More work on Mod * [Mod] compatibility with async getters * [Tests] start tests for mod * [Tests] attempted fix * [Tests] mod tests passing now! * [ModLog] update for i18n * modlog.pot -> messages.pot * [Mod] i18n * fix getting admin/mod roles * Fix doc building * [Mod/Modlog] redo imports * [Tests] fix imports in mod tests * [Mod] fix logger problem * [Mod] cleanup errors * A couple of bug fixes Async getters, some old `config.set` syntax * Filter ignores private channels * Fix softban Was still relying on default channels * Actually ignore private channels * Add check for ignored channels * Fix logic for ignore check * Send confirm messages before making case * Pass in guild when setting modlog * Thanks autocomplete * Maintain all data for case * Properly ignore softbans in events * [Mod] bugfixes * [Mod] more changes * [ModLog] timestamp change * [Mod] split filter and cleanup to their own cogs + regen messages.pot * [Cleanup] change logic * [Cleanup] increase limit for channel.history * [Mod] await getter in modset banmentionspam * [Mod] attempt duplicate modlog message fix * [Mod] get_user -> get_user_info * [Modlog] change reason command so the case author can edit their cases (#806) * [Modlog] make reason command guild only * [Modlog] clarify the reason command's help * [Mod] package path changes + numpy style docstrings for modlog * [Mod] change ban and unban events to need view audit log perms to find/create a case * [Modlog] refactoring * [Filter] add autoban feature * [Mod] update case types + event changes * [Mod/Modlog] fix tests, fix permissions things * [Docs] fix up modlog docs * Regenerate messages.pot
96 lines
2.1 KiB
ReStructuredText
96 lines
2.1 KiB
ReStructuredText
.. V3 Mod log
|
|
|
|
.. role:: python(code)
|
|
:language: python
|
|
|
|
|
|
=======
|
|
Mod log
|
|
=======
|
|
|
|
Mod log has now been separated from Mod for V3.
|
|
|
|
***********
|
|
Basic Usage
|
|
***********
|
|
|
|
.. code-block:: python
|
|
|
|
from redbot.core import modlog
|
|
import discord
|
|
|
|
class MyCog:
|
|
@commands.command()
|
|
@checks.admin_or_permissions(ban_members=True)
|
|
async def ban(self, ctx, user: discord.Member, reason: str=None):
|
|
await ctx.guild.ban(user)
|
|
case = modlog.create_case(
|
|
ctx.guild, ctx.message.created_at, "ban", user,
|
|
ctx.author, reason, until=None, channel=None
|
|
)
|
|
await ctx.send("Done. It was about time.")
|
|
|
|
|
|
**********************
|
|
Registering Case types
|
|
**********************
|
|
|
|
To register a single case type:
|
|
|
|
.. code-block:: python
|
|
|
|
from redbot.core import modlog
|
|
import discord
|
|
|
|
class MyCog:
|
|
def __init__(self, bot):
|
|
ban_case = {
|
|
"name": "ban",
|
|
"default_setting": True,
|
|
"image": ":hammer:",
|
|
"case_str": "Ban",
|
|
"audit_type": "ban"
|
|
}
|
|
modlog.register_casetype(**ban_case)
|
|
|
|
To register multiple case types:
|
|
|
|
.. code-block:: python
|
|
|
|
from redbot.core import modlog
|
|
import discord
|
|
|
|
class MyCog:
|
|
def __init__(self, bot):
|
|
new_types = [
|
|
{
|
|
"name": "ban",
|
|
"default_setting": True,
|
|
"image": ":hammer:",
|
|
"case_str": "Ban",
|
|
"audit_type": "ban"
|
|
},
|
|
{
|
|
"name": "kick",
|
|
"default_setting": True,
|
|
"image": ":boot:",
|
|
"case_str": "Kick",
|
|
"audit_type": "kick"
|
|
}
|
|
]
|
|
modlog.register_casetypes(new_types)
|
|
|
|
.. important::
|
|
Image should be the emoji you want to represent your case type with.
|
|
|
|
|
|
*************
|
|
API Reference
|
|
*************
|
|
|
|
Mod log
|
|
=======
|
|
|
|
.. automodule:: redbot.core.modlog
|
|
:members:
|