aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-24 08:55:55 -0400
committerRapptz <[email protected]>2021-04-24 08:55:55 -0400
commitfb024546ffd12cda771bb58a762b2ebc824f0299 (patch)
treefa3605e3a5198e789a89e71bb07757255c73547a
parent[commands] Add FlagConverter.__iter__ (diff)
downloaddiscord.py-fb024546ffd12cda771bb58a762b2ebc824f0299.tar.xz
discord.py-fb024546ffd12cda771bb58a762b2ebc824f0299.zip
[commands] Fix Literal converter not working within flags
-rw-r--r--discord/ext/commands/flags.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/discord/ext/commands/flags.py b/discord/ext/commands/flags.py
index 68a02911..6bbfb00b 100644
--- a/discord/ext/commands/flags.py
+++ b/discord/ext/commands/flags.py
@@ -41,6 +41,7 @@ from dataclasses import dataclass, field
from typing import (
Dict,
Iterator,
+ Literal,
Optional,
Pattern,
Set,
@@ -230,6 +231,9 @@ def get_flags(namespace: Dict[str, Any], globals: Dict[str, Any], locals: Dict[s
flag.max_args = -1
if flag.override is MISSING:
flag.override = True
+ elif origin is Literal:
+ if flag.max_args is MISSING:
+ flag.max_args = 1
else:
raise TypeError(f'Unsupported typing annotation {annotation!r} for {flag.name!r} flag')