-
-
Notifications
You must be signed in to change notification settings - Fork 17
fix(moderation): properly convert UserId to Member #50
Conversation
1ada5f1
to
3a385a8
Compare
3a385a8
to
b3a8c80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may be mistaken, but does Serenity not automatically provide methods that look up the cache for a member before making a request? Wouldn't it be sufficient to simply use that instead of creating an arbitrary get_member
method?
That is exactly what
I created the |
What do you use the distinguishing logic for? Do you output a different error? |
If the user is not in the guild, we just move on and don't try to change their roles or kick them from VC, but if its an actual error, we return early, as seen here: |
If the user is not in the guild, why would you want to move on and change their roles or kick them? They are not in the server anymore so technically you'd have to return here, rendering the distinguishing logic useless. |
No. We still need to update the database, but we can get rid of the distinguishing logic and just ignore all the errors from |
4d5c893
to
b3a8c80
Compare
# [1.21.0](v1.20.0...v1.21.0) (2023-01-07) ### Bug Fixes * **moderation:** properly convert UserId to Member ([#50](#50)) ([05ff0a2](05ff0a2)) * **workflow:** disable npm cache ([3c0a583](3c0a583)) * **workflow:** use latest version of Node.JS ([2fb3afd](2fb3afd)) ### Features * simplify code block embeds ([8376eb9](8376eb9))
🎉 This PR is included in version 1.21.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# 1.0.0 (2023-01-12) ### Bug Fixes * add ban command to poise framework ([e66e8fd](e66e8fd)) * allow lints ([c0bcc0a](c0bcc0a)) * bot owners [skip ci] ([118ca8b](118ca8b)) * change administrating role [skip ci] ([40238e3](40238e3)) * check member role for excluded roles ([6279a79](6279a79)) * **ci:** build binaries for musl ([ReVanced#9](https://github.com/Axelen123/revanced-discord-bot/issues/9)) ([aae1b07](aae1b07)) * **ci:** move Dockerfile to ubuntu:latest ([8619368](8619368)) * **clippy:** fix clippy warning ([96ce886](96ce886)) * clone submodules recursively ([63c351d](63c351d)) * correct title of auto response [skip ci] ([093f2bf](093f2bf)) * correctly find `slice_end` ([7e2db94](7e2db94)) * create release build to fix ci ([e7d26fd](e7d26fd)) * do not create unnecessary instances of `Regex` ([a3e6d88](a3e6d88)) * exclude dash and underscore for decancer ([8af95f0](8af95f0)) * fix release arg for cargo build ([eab7b1d](eab7b1d)) * handle unavailable guilds ([5519bb2](5519bb2)) * incorrect command option description ([25efe87](25efe87)) * incorrect description for user age condition ([ReVanced#16](https://github.com/Axelen123/revanced-discord-bot/issues/16)) ([999a345](999a345)) * incorrect role [skip ci] ([946bd84](946bd84)) * invalid escape in json value [skip ci] ([488b660](488b660)) * **media-channel:** change order of condition check ([fdf1dca](fdf1dca)) * **media-channel:** check if message contains attachment ([fd8ca42](fd8ca42)) * **media-channel:** correctly check for admin status ([b0ce5ae](b0ce5ae)) * missing opening bracket ([018c8f6](018c8f6)) * **moderation:** don't fail when taken_roles is empty ([bf0c34e](bf0c34e)) * **moderation:** only mute on rejoin if previously muted ([6e9f20d](6e9f20d)) * **moderation:** properly convert UserId to Member ([ReVanced#50](https://github.com/Axelen123/revanced-discord-bot/issues/50)) ([05ff0a2](05ff0a2)) * **moderation:** properly schedule unmutes ([503e095](503e095)) * **moderation:** save overwrites before modifying them ([2f67c59](2f67c59)) * **moderation:** use correct mute duration ([ReVanced#46](https://github.com/Axelen123/revanced-discord-bot/issues/46)) ([a8cedfc](a8cedfc)) * **moderation:** UserId instead of Member parameter ([5fcad81](5fcad81)) * only log debug level in debug builds ([6d8eb9a](6d8eb9a)) * reduce amount of false positives [skip ci] ([6b65929](6b65929)) * reduce false matches [skip ci] ([4f2250c](4f2250c)) * reduce false positives [skip ci] ([c68b8c0](c68b8c0)) * release builds not logging ([d69ae96](d69ae96)) * remove unused cargo config ([0eb9356](0eb9356)) * specify github token to semantic-release ([61167ab](61167ab)) * thread created should be debug, not info ([8afda24](8afda24)) * use snake case and module for configuration ([179ad3e](179ad3e)) * use tracing to fix serenity logging ([704d05f](704d05f)) * **workflow:** disable npm cache ([3c0a583](3c0a583)) * **workflow:** use latest version of Node.JS ([2fb3afd](2fb3afd)) ### Features * `message-responders` & `reload` command ([8fb0ab8](8fb0ab8)) * `thread_introductions` ([b34c9b3](b34c9b3)) * `unban` command ([b7d333c](b7d333c)) * add `rust.yml` workflow ([507656b](507656b)) * add `rustfmt` ([ReVanced#14](https://github.com/Axelen123/revanced-discord-bot/issues/14)) ([422bed5](422bed5)) * adjust match for response [skip ci] ([5e7939a](5e7939a)) * allow `-` and `_` in usernames ([2767888](2767888)) * allow ascii only names ([3f05f8c](3f05f8c)) * ban command ([efaa619](efaa619)) * command descriptions ([8045e18](8045e18)) * decancer user names ([28a19c4](28a19c4)) * decrease maximum age for auto response [skip ci] ([c2fe25a](c2fe25a)) * default configuration for ReVanced ([8a8e94a](8a8e94a)) * do not cure bots ([97c064c](97c064c)) * docker compose file ([ReVanced#56](https://github.com/Axelen123/revanced-discord-bot/issues/56)) ([694ca4b](694ca4b)) * **dockerfile:** rename config file ([ReVanced#57](https://github.com/Axelen123/revanced-discord-bot/issues/57)) ([5327956](5327956)) * embeds ([4293dd5](4293dd5)) * ephemeral response for permission error ([d87091b](d87091b)) * format timestamp ([ReVanced#17](https://github.com/Axelen123/revanced-discord-bot/issues/17)) ([55d0aaf](55d0aaf)) * handle mute when rejoining the server ([042fc8c](042fc8c)) * ignore casing when curing user names ([6c68e73](6c68e73)) * improve matching success [skip ci] ([8efe307](8efe307)) * improve matching success [skip ci] ([3a18a40](3a18a40)) * improve responses [skip ci] ([0548876](0548876)) * initial commit ([c07ad28](c07ad28)) * license ([b51c50b](b51c50b)) * lock & unlock commands ([abdc092](abdc092)) * media and logging channels and unban command ([4ab4c7e](4ab4c7e)) * migrate to command framework ([ba7b82a](ba7b82a)) * **misc:** embed code links ([6cc775a](6cc775a)) * moderation commands ([54171ba](54171ba)) * **moderation:** disconnect from voice channel on mute ([ReVanced#39](https://github.com/Axelen123/revanced-discord-bot/issues/39)) ([b2aa39b](b2aa39b)) * **moderation:** improve log embeds ([ReVanced#37](https://github.com/Axelen123/revanced-discord-bot/issues/37)) ([78f954b](78f954b)) * move `DISCORD_AUTHORIZATION_TOKEN` to `.env` ([42098b9](42098b9)) * **mute:** add translator role to `take` list ([ReVanced#33](https://github.com/Axelen123/revanced-discord-bot/issues/33)) ([7807db2](7807db2)) * new configuration for ReVanced ([d1d99b5](d1d99b5)) * ocr & mute on rejoin ([ReVanced#20](https://github.com/Axelen123/revanced-discord-bot/issues/20)) ([afb7e79](afb7e79)) * only cure users on name change ([1f5063b](1f5063b)) * permanently mute when no duration is specified ([ReVanced#44](https://github.com/Axelen123/revanced-discord-bot/issues/44)) ([573d907](573d907)) * **poll api:** hash discord user id ([ReVanced#48](https://github.com/Axelen123/revanced-discord-bot/issues/48)) ([99c476d](99c476d)) * **poll api:** improve error handling ([ReVanced#52](https://github.com/Axelen123/revanced-discord-bot/issues/52)) ([5229cd6](5229cd6)) * **poll api:** use hmac and base64 ([d7dc351](d7dc351)) * remove `ocr` ([c600c51](c600c51)) * remove now useless auto response [skip ci] ([e607fef](e607fef)) * remove thread introductions [skip ci] ([bca2020](bca2020)) * reply command ([e36df0e](e36df0e)) * response for official links ([2b00d80](2b00d80)) * response to common sponsorblock question [skip ci] ([710a546](710a546)) * simplify code block embeds ([8376eb9](8376eb9)) * take contributor roles on mute ([ReVanced#19](https://github.com/Axelen123/revanced-discord-bot/issues/19)) [skip ci] ([e20e5b1](e20e5b1)) * update logger and other small changes ([cee17a1](cee17a1)) * update ReVanced configuration to new framework ([b137217](b137217)) * use `Swatinem/rust-cache` to cache builds ([cda1bcb](cda1bcb)) * use cargo git dependency instead of submodule ([3c14cbe](3c14cbe)) * **utils:** `poll` command ([ReVanced#40](https://github.com/Axelen123/revanced-discord-bot/issues/40)) ([3be6b46](3be6b46)) * work in progress `ocr` auto responder ([23bc1aa](23bc1aa)) ### Performance Improvements * clone `Arc` of `data.database` ([3ad345b](3ad345b))
I finally managed to do it.