yagpdb icon indicating copy to clipboard operation
yagpdb copied to clipboard

moderation: make clean consistently ignore trigger msg

Open jo3-l opened this issue 3 years ago • 4 comments

Make clean ignore the triggering message, so -cl 5 will remove 5 messages -- as opposed to 4 messages plus the trigger -- from the perspective of the user.

jo3-l avatar May 12 '21 23:05 jo3-l

We should change this to silently include the own message and not include it in the count, probably as a separate parameter.

jogramming avatar May 19 '21 14:05 jogramming

Addressed in https://github.com/jonas747/yagpdb/pull/922/commits/a4b3e4dad6562fb4b604e3fb90b8bb46b456a494, trigger is now not included in the final count. Also during tests it looked like this actually still adds one even if triggered by exec/execAdmin (despite the comment) so I went ahead and added a check for the ExecutedByCC context key.

jo3-l avatar May 19 '21 17:05 jo3-l

What i meant was take in a "authorID" param for the delete function, and just silently include that

Increasing the count by 1 is kind of a hack and could potentially include a extra message if the message was deleted before the command was handled

jogramming avatar May 20 '21 11:05 jogramming

Ah OK. Just to clarify, would you like this to manually delete the trigger message in AdvancedDeleteMessages instead of including it in the bulk delete, or only include it in the bulk delete if the message ID is present in the slice of fetched messages?

~~Update: assuming that you meant the latter (only including it in the list of messages to bulk delete if it was found in the slice of messages fetched), I couldn't find any way to get the message ID that the interaction corresponds to (probably missing something here). Gonna wait for your response before doing anything more.~~ Nvm -- looks like GetOriginalInteractionResponse is what I'm looking for.

Update 2: Assuming the latter approach is what you're talking about, this should be fixed now. (in https://github.com/jonas747/yagpdb/pull/922/commits/7e5b7f6f9003ffa358cddbd8eb19043c899e1dc1)

jo3-l avatar May 20 '21 15:05 jo3-l