Skip to content

Commit

Permalink
fix: also raise if contexts decorator is used with dm_permission
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftinv committed Nov 28, 2024
1 parent 8154d90 commit 6e04667
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions disnake/ext/commands/base_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,10 @@ def decorator(func: T) -> T:
raise TypeError("Cannot set `contexts` on subcommands or subcommand groups")
# special case - don't overwrite if `_guild_only` was set, since that takes priority
if not func._guild_only:
if func.body._dm_permission is not None:
raise ValueError(
"Cannot use both `dm_permission` and `contexts` at the same time"
)
if func.body.contexts is not None:
raise ValueError("Cannot set `contexts` in both parameter and decorator")
func.body.contexts = contexts
Expand Down

0 comments on commit 6e04667

Please sign in to comment.