-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handling permission checks correctly with details #360
Merged
flaree
merged 5 commits into
Ballsdex-Team:master
from
imtherealF1:pr/handle-permission-checks
Aug 30, 2024
Merged
handling permission checks correctly with details #360
flaree
merged 5 commits into
Ballsdex-Team:master
from
imtherealF1:pr/handle-permission-checks
Aug 30, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
flaree
requested changes
Aug 30, 2024
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.
line 368:
theres a return early for a CheckFailure, meaning for regular commands your code isnt ran
flaree
approved these changes
Aug 30, 2024
benektelse
pushed a commit
to benektelse/BallsDex-DiscordBot
that referenced
this pull request
Oct 29, 2024
* [Admin] Add user and server info tooling (Ballsdex-Team#218) * Server and user info tools * Seperate mapping * Update ballsdex/packages/admin/cog.py Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * Update ballsdex/packages/admin/cog.py Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * precommit --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * trade: typo in description (Ballsdex-Team#263) * admin: improvements (mostly typo fixes) (Ballsdex-Team#253) * admin cog.py improvements It is just some details, such as adding some brackets, full stops etc. * fixing testing if this works * should fix the issue moving self bot one line below, should fix the issue * should work i had forgotten to replace balls with {settings.collectible_name}s, hence why when i moved self.bot one line down precommit failed * ... ty max * . * config typo fixes (Ballsdex-Team#264) * cog,py config typo fix * components.py config typo fix * Making disabled ball unshowable (Ballsdex-Team#260) * fix * hot fix * right pr * Hotfix :D * I LOVVVEEE SPLITTING! i lied * wording * isort is my best friend! i lied again * Trade: Change "countryball" to {settings.collectible_name} (Ballsdex-Team#267) * change "countryball" to {settings.collectible_name} in many places * smol mistake fixed * fix * [players] add / to text in donation policy * [chore] Change hardcoded countryball text to config value * change countryball to {settings.collectible_name} * change countryball to {settings.collectible_name} * [trades] correctly unfavourite when using donation modal * Fix extra space in /ball give (Ballsdex-Team#271) * models: remove extra spaces in catch names * trade: add special and shiny arg to /remove (Ballsdex-Team#251) * transformers: remove dots in autocomplete value This allows forcing the Discord client to refresh the autocompletion results without changing the query * balls: add shiny and special arg to /give (Ballsdex-Team#254) * trade: add ball arg to history (Ballsdex-Team#249) * Add ball arg to trade history * trade: fix history query --------- Co-authored-by: Auguste "laggron42" Charpentier <laggron42@gmail.com> * admin: rework rarity command * admin: spawn bomb command * admin-panel: add policies to players * ballsdex: release bump * small space fix (Ballsdex-Team#277) it pretty much made the special description all go to the countryball description, sry about that * admin-panel: Put hidden to use in Special events (Ballsdex-Team#278) * yippie * .. * ..! bruh github auto 2 ditto marks when * admin-panel: permission check on custom endpoints * admin: response changed to ephemeral msg + some arg description fixes (Ballsdex-Team#284) * even more admin cog.py typo fixes, * happy now pre-commit? * you better work now * admin: Add log action and make ephemeral (Ballsdex-Team#290) * balls: Add special to balls list (Ballsdex-Team#286) * readme: add developer server link * readme: fix wrong link * settings: handle every text-prefix as a string (Ballsdex-Team#294) * :D * add a default Co-authored-by: Auguste Charpentier <laggron42@gmail.com> * Force default prefix * Forgot cast to string --------- Co-authored-by: Auguste Charpentier <laggron42@gmail.com> * balls: confirm favourite in balls give (Ballsdex-Team#288) * Add confirmation check to balls give for favourites * appease isort * fix bugs --------- Co-authored-by: Auguste "laggron42" Charpentier <laggron42@gmail.com> * adding `special` and `shiny` arg to `/balls favourite` (Ballsdex-Team#285) * adding `special` and `shiny` arg to `/balls favourite` it was missing from there, so why not add it * those spaces... --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * [admin] fix guild icon when not available * slight issue fix * just testing to see if this works * stupid mistake * [core] changing text to replace with collectible name this of course is so that in other dexes, the "countryball" will get translated as {settings.collectible_name} Co-authored-by: Jamie <31554168+flaree@users.noreply.github.com> * info: translate help command * typo fix in readme (Ballsdex-Team#301) * [readme] Remove no support server reference * Update README.md * i luv u flaree ❤️ * admin: changing "ball" to "countryball" so that it gets replaced with {settings.collectible_name} (Ballsdex-Team#304) * changing "ball" to "countryball" so that it gets replaced * here * core: cooldown show active cooldown timer (Ballsdex-Team#282) * [core] For cooldown show active timer * Update ballsdex/core/bot.py per laggrons suggestion Co-authored-by: Auguste Charpentier <laggron42@gmail.com> * run pre-commit --------- Co-authored-by: Auguste Charpentier <laggron42@gmail.com> * balls: add missing characters (Ballsdex-Team#309) * Small fix * Add some more characters.py * Fix line length Co-authored-by: Auguste Charpentier <laggron42@gmail.com> --------- Co-authored-by: Auguste Charpentier <laggron42@gmail.com> * poetry: upgrade to 3.12, update deps * docker: fix image tag * poetry: rollback fastapi-admin * pipeline: Update base python * Add user id to embed if ran from admin (Ballsdex-Team#321) * [balls] add stats to balls give (Ballsdex-Team#326) * fix description logic in ball description * Add sats to balls give * revert model change * final revert * add stroke width (Ballsdex-Team#329) * [Trade] Add bulk add support (Ballsdex-Team#212) * Begin inital work on bulk add for trades * Add bulk group support + text changes * Add text change to confirm * Check if < 25 balls * prefetch related fields * prefetch related fields * style * version bump * [trade] bulk add changes (Ballsdex-Team#330) * making messages ephemeral and changing ball to settings.collectible_name * small changes and bug fix to bulk add * fixing stats in balls give (Ballsdex-Team#332) * fixing stats in balls give * fixing stats in balls give * making some messages ephemeral (Ballsdex-Team#336) * [balls] small bug fix (Ballsdex-Team#334) * [precommit] update and fix checks (Ballsdex-Team#333) * beginning work on fixing the checks * fixing checks * fixing checks * fixing checks * fixing checks * fixing checks * fixing checks * fixing checks * fixing checks * fixing checks * fixing checks * fixing checks * [trade] check if tradeable before creating menu (Ballsdex-Team#331) * check for tradeable value before confirming * round to nearest 25 * remove untradeable first * Fix `line too long` to make pyprosject pass check. --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * version bump * [balls] Fix duplicate stats showing in `/balls give` (Ballsdex-Team#341) * [balls] change countryball to `{settings.collectible_name}` and title (Ballsdex-Team#342) * changing countryball to {settings.collectible_name} and title * e * [meta] Change `Trade` to `donate` in `balls give` when ball is favorited. (Ballsdex-Team#343) * [admin] make it impossible to blacklist yourself (Ballsdex-Team#344) * Fix all the file endings and enforce LF (Ballsdex-Team#345) * Renormalized the files * Add .gitattributes * Revert "Renormalized the files" This reverts commit 04a1578. * Renormalize the right files. * Add .tff as binaries to not be normalized * adding poetry lock --no-update to pre commit (Ballsdex-Team#339) Co-authored-by: Kowlin <10947836+Kowlin@users.noreply.github.com> * fix: update pre-commit workflow to fix placing of locking (Ballsdex-Team#347) * grammatical changes to responses in /admin balls reset and /admin balls count (Ballsdex-Team#349) * [docker] version is deprecated and spits a warning (Ballsdex-Team#335) Co-authored-by: Jamie <31554168+flaree@users.noreply.github.com> * [config] adding max favorites to the generated config file (Ballsdex-Team#355) * [meta] Update CONTRIBUTING.md. (Ballsdex-Team#358) * grammatical changes to admin info guild/user (Ballsdex-Team#359) * grammatical changes to admin info guild/user * leaving a whitespace for code formatting checks to pass * [trade] fix countryball history arguement showing all history (Ballsdex-Team#354) * fixing trade history sort countryball * changing the code for checks to pass * [balls] see total stats in list (Ballsdex-Team#353) * seeing stats through balls list * splitting code for standardization Co-authored-by: Jamie <31554168+flaree@users.noreply.github.com> --------- Co-authored-by: Jamie <31554168+flaree@users.noreply.github.com> * Don't show favourite icon in trade (Ballsdex-Team#361) * [balls] Show shiny and special in completion failure msg (Ballsdex-Team#362) * [info] More details credits regarding owner and project info (Ballsdex-Team#363) * adding dimensions to the collection card label in admin/resources (Ballsdex-Team#357) * adding dimensions to the collection card label * changing dimensions to ratio * handling permission checks correctly with details (Ballsdex-Team#360) * handling permission checks correctly with details * changing ' to " for formatting checks to pass * removing the unnecessary return * adding the disabledcommand check back * making the 2 error types a tuple * [trade] Add trade view (Ballsdex-Team#364) * Add trade view * fix recursion error * [config] adding interaction check to config embed, making channel optional, and some logic changes (Ballsdex-Team#350) * adding interaction check to config embed and small logic changes * making channel optional, if no channel the bot uses interaction channel * 3 lines into 1 for black checks to pass * changing the code for pyright * changes for pyright checks to pass * removing extra newline at the end of file * checking if bot has the correct permissions with a decorator * passing discord.Member instead of Player * more changes for pyright * even more changes for pyright * ensuring channel is a Text.Channel and not interaction.channel * changing the code to access the disabled attribute * making sure the channel is a text channel * changing cmd description and making code easier and simpler * small change in the bot's response * re-adding a description that i accidentally removed * leaving whitespace between description and init * adding user permission checks in a decorator * removing an unnecessary "self.stop()" * adding permission checks in decorators in /config disable * removing unnecessary permission checks --------- Co-authored-by: Jamie <31554168+flaree@users.noreply.github.com> * [trade] Add ability to select all on page (Ballsdex-Team#365) * Add ability to select all on page * Update menu.py * Update issue templates (Ballsdex-Team#287) * made rarity also sort by country name (Ballsdex-Team#367) * [ballsdex] version bump * [trade] handle no countryballs * [chore] appease pre-commit * [chore] appease pre-commit * [ballsdex] version bump * admin: change docstring from ball to countryball (Ballsdex-Team#370) * [trade] changing ball to countryball/settings.collectible_name (Ballsdex-Team#369) * changing ball to countryball and settings.collectible_name * removing return await for code consistency * changing ball to countryball again * more return await and grammar changes * reverting unnecessary changes --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * removing double whitespace in balls list response (Ballsdex-Team#373) * [admin] Add admin blacklist history (Ballsdex-Team#327) * [admin] Add admin blacklist history * Appease precommit * appease pre-commit * Address changes * [balls] changing syntax for stats through balls list (Ballsdex-Team#375) * changing syntax for stats through balls list * changing the syntax again, cleaner design * [settings] Pluralization Support, with {settings.plural_collectible_name} (Ballsdex-Team#378) * adding plural collectible name to settings * adding plural collectible name to json-config-ref.json * changing collectible_name+s to plural collectible name * changing to plural collectible name in players cog * changing to plural collectible name in trade menu * changing to plural collectible name in admin cog * changing to plural collectible name in balls cog * changing to plural collectible name in config cog * changing to plural collectible name in info cog * changing to plural collectible name in trade cog * making a line 2 lines for formatting checks to pass * ensuring correct grammar in a /balls favorite check * added a check to /favorite if max favorites in settings is 0 * small bug fix with return * [trade] changing "this interaction ends in 30 mins" to a discord timestamp (Ballsdex-Team#381) * changing "this interaction ends in 30 mins" to timestamp * adding the imports to make the code work * handling the timestamp logic with format_dt * removing the variable self.end_time * testing to see if this solves the conflict, will revert if not * reverting changes * small syntax error fix * Use utcnow from utils --------- Co-authored-by: flaree <flare2399@gmail.com> * update plural name to use get instead of assuming it exists * Remove logging of missing permissions * [config] /config silent, surpress wrong name and errors * adding the silent config logic to countryballs/components * making a new sql migration file for silent config * adding silent to admin/resources * adding silent to core/models * adding the silent logic to config/components * adding the command /config silent * removing unnecessary comma * removing unnecessary whitespaces * removing /config silent, adding silent as an arg in /config channel * removing the unnecessary silent activation embed * Update command description --------- Co-authored-by: flaree <flare2399@gmail.com> * [settings] making the biggest defense/attack stat bonus configurable (Ballsdex-Team#383) * making max stat bonuses configurable in settings * adding the configurable stats to config-ref.json * adjusting the stat generation logic when a ball is spawned * adding the new configurable stat logic to admin give * making the descriptions more clear in settings * making descriptions more clear again * changing the descriptions in config-ref.json too * 2 lines into 3 for code formatting checks to pass * removing some required properties * improving the comments even more and giving warnings * changing to max health bonus * changing to max health bonus * changing to max health bonus in admin cog * changing to max health bonus * small change, changing _ to - * changing _ to - * same change again * solving the first conflict * reverting last commit --------- Co-authored-by: flaree <flare2399@gmail.com> * [admin] change ball to countryball in command arg names (Ballsdex-Team#389) * adding a . at a bot response (Ballsdex-Team#390) * [ballsdex] grammar checks/small fixes in logged info (Ballsdex-Team#391) * plural grammar checks in logged infos * grammar checks in countryballs cog * adding a dot at a bot response * [config] bug fix, adding a try-except with DoesNotExist (Ballsdex-Team#392) * adding a try-except with DoesNotExist * properly initializing config * [Balls] move translations to a new field for easier management (Ballsdex-Team#387) * Move translations to a new field * Add translations after * [player] new /player stats command (Ballsdex-Team#372) * making the new /player stats command * small changes for code formatting checks to pass * importing the class balls * changing import order for isort checks to pass * fixing the completion logic * changing code for formatting checks to pass * removing unnecssary () * reducing the database pulls to 2 from 7 and design changes * small change for code formatting checks to pass * importing DoesNotExist * adding "caught countryballs owned" to the command * actually reducing the database pulls now * appeasing pre-commit * removing unnecessary import * Add deferall due to costly calls --------- Co-authored-by: flaree <flare2399@gmail.com> * [policies] add mention policy (Ballsdex-Team#325) * [policies] add mention policy * fix migration * remove other code * handling ttf files as binary (Ballsdex-Team#393) * [pagination] remove entries from footer (Ballsdex-Team#398) * chore: fix line endings * [trade] Make trade only available in guilds (Ballsdex-Team#397) * [player] adding more checks to avoid errors in /stats and making it ephemeral (Ballsdex-Team#402) * adding more checks to avoid getting errors * adding forgotten import * [trade] fix bulk to show final page (Ballsdex-Team#400) * . * Show last page for bulk * [player] add friend and block system (Ballsdex-Team#340) --------- Co-authored-by: flaree <flare2399@gmail.com> Co-authored-by: Jamie <31554168+flaree@users.noreply.github.com> * [utils] Move pagify + pagify help text (Ballsdex-Team#403) * . * Move pagify utils * pagify help text * precommit * [ballsdex] version bump * [players] fix stats (Ballsdex-Team#404) * . * [players] fix stats * [friends] handle blacklisted and blocked user correctly * blacklist check + handling mentions policy * bug fix, stops the chance of having a user blocked+friended * Undo transformer change * [settings] changing from collectible_name+s to plural (Ballsdex-Team#413) * changing collectible_name to plural_collectible_name * changing collectible_name to plural_collectible_name * changing collectible_name to plural_collectible_name * appeasing pre-commit * Add missing space from /config disable (Ballsdex-Team#414) * [player] added /player friend policy. (Ballsdex-Team#406) * adding /player friend policy * adding friendpolicy to models * adding the sql file * making a donationpolicy message ephemeral * bug fix with /friends add * small fix, adding correct value Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * adding a policy group cog * changing the name of friend privacy cmd * small changes to choices pop for same server privacy option * fixing pre-commit --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * Modernize Discord server badge (Ballsdex-Team#417) * [admin] add stats in /admin balls info (Ballsdex-Team#408) * [privacy] ignore friend check if staff (Ballsdex-Team#409) * . * if staff ignore friend check * precommit * de-dupe code * [utils] adding friend+mention policy map to enums (Ballsdex-Team#425) * adding the 2 new policy maps to enums.py * very important bug fix * [admin] adding friend+mention policy to admin user info (Ballsdex-Team#427) * [player] Change `/player stats` to `/player info` (Ballsdex-Team#426) * changing /player info to /player stats * appeasing pre-commit * appeasing isort --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * [countryballs] defer catching earlier (Ballsdex-Team#430) * . * defer catching of countryball to avoid i was caught already * [player] checking if there is an active friend request before sending another one (Ballsdex-Team#421) * adding an active friend request check * re-adding the description, accidentally removed * removing unnecessary spaces --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * [balls] Fix no space when selecting event in balls list. (Ballsdex-Team#416) * adding a space in bot response * using a variable that combines ball_txt and special_txt * [trade] adding a check for locked for trade + favorited balls for bulk add (Ballsdex-Team#419) * not allowing locked balls to be added to a trade with bulk add * undo change * re-adding the check + favorited ball check * adding the await i forgot to add --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * [ballsdex] Bump dependencies (Ballsdex-Team#374) * dependencies bump * updating a lot of dependencies * leaving aerich to 0.6.3 * update poetry lock file --------- Co-authored-by: Auguste "laggron42" Charpentier <laggron42@gmail.com> * [privacy] fix if interacting player doesnt exist (Ballsdex-Team#429) * . * Fix an issue where interacting player doesnt exist --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * [utils] allowing custom cancel/accept edit msg in ConfirmChoiceView (Ballsdex-Team#411) * allowing custom cancel/accept edit msg in confirmchoiceview * appeasing pyright * appeasing black * appeasing black again * adding custom texts in players cog * adding custom text to balls cog * adding custom text to admin cog * adding custom text to trade cog * adding a comma * appeasing pre-commit * appeasing pre-commit again * de-duping code * placing default string in the constructor * reverting change, changing true to false * appeasing pre-commit * [player] ordering friends and block list from earliest date to latest (Ballsdex-Team#438) * bot: message content flag * contributing: update guides * [trade] bug fix, plural check and more precise wording in /view and /begin (Ballsdex-Team#439) * bug fix, better wording + plural check with /trade view * more precise wording to block checks in /trade begin * appeasing pre-commit --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * [player] dont allow users to be blocked during active friend request (Ballsdex-Team#450) * bug fix, not allowing users to be blocked during active friend req * appeasing pre-commit --------- Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> * [admin] fix caught Unique in `/admin info user` (Ballsdex-Team#454) * docker: change pgpackup ouput path (Ballsdex-Team#453) * poetry: update to python 3.13 (Ballsdex-Team#447) * poetry: update to python 3.13 * poetry: allow python 3.12 * poetry: remove asyncpg lock * dev: add models to dev environment (Ballsdex-Team#452) * admin: fix admin reset when player doesn't exist --------- Co-authored-by: Jamie <31554168+flaree@users.noreply.github.com> Co-authored-by: MAX <63972751+ltzmax@users.noreply.github.com> Co-authored-by: Kingofthehill4965 <167987818+Kingofthehill4965@users.noreply.github.com> Co-authored-by: imtherealF1 <168587794+imtherealF1@users.noreply.github.com> Co-authored-by: George Sofroniou <66422818+GeorgeSofroniouCy@users.noreply.github.com> Co-authored-by: Auguste "laggron42" Charpentier <laggron42@gmail.com> Co-authored-by: zNeolythic <poemtodo@gmail.com> Co-authored-by: Max Parry <66670928+Buggem@users.noreply.github.com> Co-authored-by: DotZZ <93223349+DaRealDotZ@users.noreply.github.com> Co-authored-by: Kowlin <10947836+Kowlin@users.noreply.github.com> Co-authored-by: Valen <92762944+Valen7440@users.noreply.github.com> Co-authored-by: flaree <flare2399@gmail.com> Co-authored-by: Zayaan AR <zayaan.rajput@gmail.com> Co-authored-by: Zayaan AR <zayaanar@atomlabs.ie>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #351