File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -482,14 +482,13 @@ def from_type(cls, t: type):
482482 return cls .CHANNEL
483483 if issubclass (t , discord .abc .Role ):
484484 return cls .ROLE
485- # Here's the issue. Typechecking for a **Union** somewhat differs per version (from 3.6.8+)
486-
487485 if hasattr (typing , "_GenericAlias" ): # 3.7 onwards
488- if isinstance (t , typing ._UnionGenericAlias ): # noqa
489- return cls .MENTIONABLE # 3.9+
490- elif t .__origin__ is typing .Union : # 3.7-3.8
486+ # Easier than imports
487+ if (
488+ t .__origin__ is not None and t .__origin__ is typing .Union
489+ ): # proven in 3.7.8+, 3.8.6+, 3.9+ definitively
491490 return cls .MENTIONABLE
492- else : # py 3.6
491+ if not hasattr ( typing , "_GenericAlias" ) : # py 3.6
493492 if isinstance (t , typing ._Union ): # noqa
494493 return cls .MENTIONABLE
495494
You can’t perform that action at this time.
0 commit comments