mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[V3 Modlog] Modlog layout and formatting changes (#1089)
* Modlog layout and formatting changes * Remove unused import
This commit is contained in:
parent
14ba572acd
commit
fb0be051aa
@ -64,91 +64,91 @@ class Mod:
|
||||
{
|
||||
"name": "ban",
|
||||
"default_setting": True,
|
||||
"image": ":hammer:",
|
||||
"image": "\N{HAMMER}",
|
||||
"case_str": "Ban",
|
||||
"audit_type": "ban"
|
||||
},
|
||||
{
|
||||
"name": "kick",
|
||||
"default_setting": True,
|
||||
"image": ":boot:",
|
||||
"image": "\N{WOMANS BOOTS}",
|
||||
"case_str": "Kick",
|
||||
"audit_type": "kick"
|
||||
},
|
||||
{
|
||||
"name": "hackban",
|
||||
"default_setting": True,
|
||||
"image": ":bust_in_silhouette: :hammer:",
|
||||
"image": "\N{BUST IN SILHOUETTE}\N{HAMMER}",
|
||||
"case_str": "Hackban",
|
||||
"audit_type": "ban"
|
||||
},
|
||||
{
|
||||
"name": "softban",
|
||||
"default_setting": True,
|
||||
"image": ":dash: :hammer:",
|
||||
"image": "\N{DASH SYMBOL}\N{HAMMER}",
|
||||
"case_str": "Softban",
|
||||
"audit_type": "ban"
|
||||
},
|
||||
{
|
||||
"name": "unban",
|
||||
"default_setting": True,
|
||||
"image": ":dove:",
|
||||
"image": "\N{DOVE OF PEACE}",
|
||||
"case_str": "Unban",
|
||||
"audit_type": "unban"
|
||||
},
|
||||
{
|
||||
"name": "voiceban",
|
||||
"default_setting": True,
|
||||
"image": ":mute:",
|
||||
"image": "\N{SPEAKER WITH CANCELLATION STROKE}",
|
||||
"case_str": "Voice Ban",
|
||||
"audit_type": "member_update"
|
||||
},
|
||||
{
|
||||
"name": "voiceunban",
|
||||
"default_setting": True,
|
||||
"image": ":speaker:",
|
||||
"image": "\N{SPEAKER}",
|
||||
"case_str": "Voice Unban",
|
||||
"audit_type": "member_update"
|
||||
},
|
||||
{
|
||||
"name": "vmute",
|
||||
"default_setting": False,
|
||||
"image": ":mute:",
|
||||
"image": "\N{SPEAKER WITH CANCELLATION STROKE}",
|
||||
"case_str": "Voice Mute",
|
||||
"audit_type": "overwrite_update"
|
||||
},
|
||||
{
|
||||
"name": "cmute",
|
||||
"default_setting": False,
|
||||
"image": ":mute:",
|
||||
"image": "\N{SPEAKER WITH CANCELLATION STROKE}",
|
||||
"case_str": "Channel Mute",
|
||||
"audit_type": "overwrite_update"
|
||||
},
|
||||
{
|
||||
"name": "smute",
|
||||
"default_setting": True,
|
||||
"image": ":mute:",
|
||||
"image": "\N{SPEAKER WITH CANCELLATION STROKE}",
|
||||
"case_str": "Guild Mute",
|
||||
"audit_type": "overwrite_update"
|
||||
},
|
||||
{
|
||||
"name": "vunmute",
|
||||
"default_setting": False,
|
||||
"image": ":speaker:",
|
||||
"image": "\N{SPEAKER}",
|
||||
"case_str": "Voice Unmute",
|
||||
"audit_type": "overwrite_update"
|
||||
},
|
||||
{
|
||||
"name": "cunmute",
|
||||
"default_setting": False,
|
||||
"image": ":speaker:",
|
||||
"image": "\N{SPEAKER}",
|
||||
"case_str": "Channel Unmute",
|
||||
"audit_type": "overwrite_update"
|
||||
},
|
||||
{
|
||||
"name": "sunmute",
|
||||
"default_setting": True,
|
||||
"image": ":speaker:",
|
||||
"image": "\N{SPEAKER}",
|
||||
"case_str": "Guild Unmute",
|
||||
"audit_type": "overwrite_update"
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
import discord
|
||||
import os
|
||||
from datetime import datetime
|
||||
from typing import List, Union
|
||||
|
||||
import discord
|
||||
|
||||
from redbot.core import Config
|
||||
from redbot.core.bot import Red
|
||||
from redbot.core.utils.chat_formatting import bold
|
||||
from typing import List, Union
|
||||
from datetime import datetime
|
||||
|
||||
__all__ = [
|
||||
"Case", "CaseType", "get_next_case_number", "get_case", "get_all_cases",
|
||||
@ -83,37 +83,37 @@ class Case:
|
||||
|
||||
async def message_content(self):
|
||||
"""
|
||||
Format a case message
|
||||
Format a case message
|
||||
|
||||
Returns
|
||||
-------
|
||||
discord.Embed
|
||||
A rich embed representing a case message
|
||||
|
||||
|
||||
"""
|
||||
casetype = await get_casetype(self.action_type)
|
||||
title = "{}".format(bold("Case #{} | {} {}".format(
|
||||
self.case_number, casetype.case_str, casetype.image)))
|
||||
title = "{}".format("Case #{} | {} {}".format(
|
||||
self.case_number, casetype.case_str, casetype.image))
|
||||
|
||||
if self.reason:
|
||||
reason = "**Reason:** {}".format(self.reason)
|
||||
else:
|
||||
reason = \
|
||||
"**Reason:** Type [p]reason {} <reason> to add it".format(
|
||||
"**Reason:** Use `[p]reason {} <reason>` to add it".format(
|
||||
self.case_number
|
||||
)
|
||||
|
||||
emb = discord.Embed(title=title, description=reason)
|
||||
user = "{}#{} ({})\n".format(
|
||||
self.user.name, self.user.discriminator, self.user.id)
|
||||
emb.set_author(name=user, icon_url=self.user.avatar_url)
|
||||
|
||||
moderator = "{}#{} ({})\n".format(
|
||||
self.moderator.name,
|
||||
self.moderator.discriminator,
|
||||
self.moderator.id
|
||||
)
|
||||
emb.set_author(name=moderator, icon_url=self.moderator.avatar_url)
|
||||
user = "{}#{} ({})\n".format(
|
||||
self.user.name, self.user.discriminator, self.user.id)
|
||||
emb.add_field(name="User", value=user)
|
||||
emb.add_field(name="Moderator", value=moderator, inline=False)
|
||||
if self.until:
|
||||
start = datetime.fromtimestamp(self.created_at)
|
||||
end = datetime.fromtimestamp(self.until)
|
||||
@ -126,7 +126,7 @@ class Case:
|
||||
emb.add_field(name="Duration", value=duration)
|
||||
|
||||
if self.channel:
|
||||
emb.add_field(name="Channel", value=self.channel.name)
|
||||
emb.add_field(name="Channel", value=self.channel.name, inline=False)
|
||||
if self.amended_by:
|
||||
amended_by = "{}#{} ({})".format(
|
||||
self.amended_by.name,
|
||||
@ -151,7 +151,7 @@ class Case:
|
||||
-------
|
||||
dict
|
||||
The case in the form of a dict
|
||||
|
||||
|
||||
"""
|
||||
data = {
|
||||
"case_number": self.case_number,
|
||||
@ -181,12 +181,12 @@ class Case:
|
||||
The bot's instance. Needed to get the target user
|
||||
data: dict
|
||||
The JSON representation of the case to be gotten
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
Case
|
||||
The case object for the requested case
|
||||
|
||||
|
||||
"""
|
||||
guild = mod_channel.guild
|
||||
message = await mod_channel.get_message(data["message"])
|
||||
@ -330,7 +330,7 @@ async def get_case(case_number: int, guild: discord.Guild,
|
||||
-------
|
||||
Case
|
||||
The case associated with the case number
|
||||
|
||||
|
||||
Raises
|
||||
------
|
||||
RuntimeError
|
||||
@ -397,7 +397,7 @@ async def create_case(guild: discord.Guild, created_at: datetime, action_type: s
|
||||
The time the action is in effect until
|
||||
channel: `discord.TextChannel` or `discord.VoiceChannel`
|
||||
The channel the action was taken in
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
Case
|
||||
@ -407,7 +407,7 @@ async def create_case(guild: discord.Guild, created_at: datetime, action_type: s
|
||||
------
|
||||
RuntimeError
|
||||
If the mod log channel doesn't exist
|
||||
|
||||
|
||||
"""
|
||||
mod_channel = None
|
||||
if hasattr(guild, "owner"):
|
||||
@ -577,12 +577,12 @@ async def register_casetypes(new_types: List[dict]) -> List[CaseType]:
|
||||
----------
|
||||
new_types: list
|
||||
The new types to register
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
`True` if all were registered successfully
|
||||
|
||||
|
||||
Raises
|
||||
------
|
||||
RuntimeError
|
||||
@ -593,7 +593,7 @@ async def register_casetypes(new_types: List[dict]) -> List[CaseType]:
|
||||
See Also
|
||||
--------
|
||||
redbot.core.modlog.register_casetype
|
||||
|
||||
|
||||
"""
|
||||
type_list = []
|
||||
for new_type in new_types:
|
||||
@ -622,7 +622,7 @@ async def get_modlog_channel(guild: discord.Guild
|
||||
----------
|
||||
guild: `discord.Guild`
|
||||
The guild to get the modlog channel for
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
`discord.TextChannel` or `None`
|
||||
@ -654,7 +654,7 @@ async def set_modlog_channel(guild: discord.Guild,
|
||||
The guild to set a mod log channel for
|
||||
channel: `discord.TextChannel` or `None`
|
||||
The channel to be set as modlog channel
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
@ -675,7 +675,7 @@ async def reset_cases(guild: discord.Guild) -> bool:
|
||||
----------
|
||||
guild: `discord.Guild`
|
||||
The guild to reset cases for
|
||||
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user