Conversation
Updated the 'purge' command to allow deletion by amount, date, or message link.
Fixed linting errors
There was a problem hiding this comment.
Pull request overview
This PR enhances the purge command to support three mutually exclusive deletion methods: by amount (1-100 messages), by message link (all messages after a specific message), or by date (all messages after DD-MM-YYYY format). This provides moderators with more flexible message management options.
Key Changes:
- Modified the
purgecommand to accept optional parameters for amount, message_link, and date - Added validation to ensure exactly one parameter is provided
- Implemented separate logic branches for each deletion method with appropriate error handling
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixed the typo and linting error
LINTING ERROR!!
|
@sach-12 Done? |
|
Why are there modifications in the |
|
|
||
| if amount < 1 or amount > 100: | ||
| await interaction.followup.send(content="Please specify a number between 1 and 100", ephemeral=True) | ||
| if sum(x is not None for x in [amount, message_link, date]) != 1: |
There was a problem hiding this comment.
Is it possible to use any here instead of sum?
There was a problem hiding this comment.
I used sum because we need to make sure exactly one of the three parameters is provided. any would only tell us if at least one is provided, which still allows two or three arguments at the same time(it just allows, we can find a workaround to select only one out of it, but then it defeats the purpose) . Using sum(x is not None …) lets us count how many were given and enforce the requirement cleanly.
I really don't understand how that happened. I never modified them manually...nevertheless, I have reverted the changes! |
Implemented the /ban slash command with proper permission checks, DM notifications, logging to mod channel, and error handling.
This reverts commit df897e1. This was not meant to be in this PR
Updated the 'purge' command to allow deletion by amount, date, or message link.
📌 Description
Updated the purge command to support additional deletion methods based on moderator needs.
This PR implements three mutually exclusive purge options:
This enhancement resolves: #65
🧱 Type of Change
🧪 How Has This Been Tested?
tests/unit/)tests/integration/)✅ Checklist
.envvars updated (if applicable)🛠️ Affected Bot Areas
/ping,/help)pyproject.toml)📸 Screenshots / Demos (if applicable)
🧠 Additional Notes