yagpdb
yagpdb copied to clipboard
moderation: make clean consistently ignore trigger msg
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.
We should change this to silently include the own message and not include it in the count, probably as a separate parameter.
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.
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
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)