Red-discordbot: Feature request, core modlog.py, Add Timestamp for sanitized embeds.

Created on 26 Jul 2020  路  13Comments  路  Source: Cog-Creators/Red-DiscordBot

Feature request

Add Timestamp for sanitization outside embeds with core modlog python file.

Select the type of feature you are requesting:

  • [x] Cog
  • [ ] Command
  • [ ] API functionality

Describe your requested feature

Referencing code section: https://github.com/Cog-Creators/Red-DiscordBot/blob/28b5be21b3d3dac5313c2c701bdb4ce491889b04/redbot/core/modlog.py#L380-L394

We should have the timestamp being shown on the sanitized embed of the current case as seen below

        else:
            user = filter_mass_mentions(filter_urls(user))  # Further sanitization outside embeds
            case_text = ""
            case_text += "{}\n".format(title)
            case_text += _("**User:** {}\n").format(user)
            case_text += _("**Moderator:** {}\n").format(moderator)
            case_text += _("**Time Stamp:** {}\n").format(datetime.fromtimestamp(self.created_at)) # Time Stamp added here
            case_text += "{}\n".format(reason)
            if until and duration:
                case_text += _("**Until:** {}\n**Duration:** {}\n").format(until, duration)
            if self.channel:
                case_text += _("**Channel**: {}\n").format(self.channel.name)
            if amended_by:
                case_text += _("**Amended by:** {}\n").format(amended_by)
            if last_modified:
                case_text += _("**Last modified at:** {}\n").format(last_modified)
            return case_text.strip()

Result:
image

Modlog API Needs Discussion Feature

Most helpful comment

but this method is also used for things such as the immediate sending where the timestamp would just be noise.

I do would like to know where would this be noise at? Example?

When modlog cases are created, (ie right when the action is taken) they also get sent to the modlog channel using message content. As this is happening right at the time of the action, adding the timestamp to it here is just noise, as the time of the message is also the time of the action.

This can be better solved by things which display modlog cases for later viewing actually utilizing the attributes of the cases, rather than putting it here.

All 13 comments

I'm curious on why you want this as its own separate field, as discord provides an timestamp on the message.

I'm curious on why you want this as its own separate field, as discord provides an timestamp on the message.

Time stamp of the current warning, not the current date and time of the message*

example:
image
test warns from March 1st and Second

image
No time stamp,

with timestamp
image

Kowlin means this:
image
Time of case creation and time of message creation are pretty much equivalent, unless I'm missing something.

It'll be good to have when checking overall logs of a single user, seeing when their strike/ flag/ action was taken against them

image

I can see how the lack of that info in non-embed variants of [p]casesfor and [p]case commands is an issue. Considering that we would have to add it to those commands, we probably could also add it to the message in modlog channel as well, although I still haven't heard a use case from you that isn't already fulfilled by the timestamp of the sent message in modlog channel.

Also, it doesn't seem like you're using core modlog cog for this - the command output is different from the one in that cog.

They're using my version of [p]casesfor which adds the lines. Casereader in https://github.com/Dav-Git/Dav-Cogs It does in fact print out standard modlog entries though.

They're using my version of [p]casesfor which adds the lines. Casereader in https://github.com/Dav-Git/Dav-Cogs It does in fact print out standard modlog entries though.

this

I can see how the lack of that info in non-embed variants of [p]casesfor and [p]case commands is an issue. Considering that we would have to add it to those commands, we probably could also add it to the message in modlog channel as well, although I still haven't heard a use case from you that isn't already fulfilled by the timestamp of the sent message in modlog channel.

Also, it doesn't seem like you're using core modlog cog for this - the command output is different from the one in that cog.

Still the core modlog system just using extendedmodlog for better managing of warnings.

as editing modlog core file affects the output of sanitized modlogs as i shown in the start

https://github.com/Cog-Creators/Red-DiscordBot/blob/28b5be21b3d3dac5313c2c701bdb4ce491889b04/redbot/core/modlog.py#L380-L394

addthing this in the modlog core file

case_text += _("**Time Stamp:** {}\n").format(datetime.fromtimestamp(self.created_at)) 

Affects the output of the sanitizing.

This doesn't belong in the message content method IMO. Things displaying it (including core's casesfor should add the timestamp to the display (they have access to it) if needed, but this method is also used for things such as the immediate sending where the timestamp would just be noise.

This doesn't belong in the message content method IMO.

Could always add optional keyword argument for that so that [p]casesfor and [p]case commands could still utilise the same method.

this method is also used for things such as the immediate sending where the timestamp would just be noise.

I don't use modlog myself, but same as you, I was thinking that this might be considered noise for some (it isn't so much for me but I am not modlog user) so I'm inclined to agree that it most likely shouldn't be changed.

I'm not sure of the top of my head if modlog cases always contain a timestamp. If that's teh case I'd agree that this should be implemented in casesfor and case instead of being added to all modlog messages.

I'm not sure of the top of my head if modlog cases always contain a timestamp. If that's teh case I'd agree that this should be implemented in casesfor and case instead of being added to all modlog messages.

They should up on the embed of casesfor and case, but do not show up on the sanitized version,

Ref for embed: Line 377
https://github.com/Cog-Creators/Red-DiscordBot/blob/28b5be21b3d3dac5313c2c701bdb4ce491889b04/redbot/core/modlog.py#L357-L378

Compared to sanitized which as no date or time of the warn for the case
Ref: https://github.com/Cog-Creators/Red-DiscordBot/blob/28b5be21b3d3dac5313c2c701bdb4ce491889b04/redbot/core/modlog.py#L379-L394

No date is included.

I would find it useful to have the date of action included in the 'clean' version of the warn/strike/ etc, im sure other users will find it useful aswell.


Having a timestamp in the sanitize version is no different than a embed, unless adding a new text line breaks the bot, which i have found it does not break anything, including these cogs
image


The timestamp of action in a the cleaned version of embed is super useful, it adds no new functions or adds new calls that could interfere

but this method is also used for things such as the immediate sending where the timestamp would just be noise.

I do would like to know where would this be noise at? Example?

but this method is also used for things such as the immediate sending where the timestamp would just be noise.

I do would like to know where would this be noise at? Example?

When modlog cases are created, (ie right when the action is taken) they also get sent to the modlog channel using message content. As this is happening right at the time of the action, adding the timestamp to it here is just noise, as the time of the message is also the time of the action.

This can be better solved by things which display modlog cases for later viewing actually utilizing the attributes of the cases, rather than putting it here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clovisd picture clovisd  路  3Comments

IdkGoodName picture IdkGoodName  路  3Comments

TrustyJAID picture TrustyJAID  路  3Comments

Kowlin picture Kowlin  路  4Comments

StaffTroll picture StaffTroll  路  5Comments