Skip to content

Commit 0357b1e

Browse files
2 parents 33f2572 + 761f547 commit 0357b1e

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

discord/app/commands.py

Whitespace-only changes.

discord/commands/commands.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -507,21 +507,20 @@ def __init__(
507507
self._converter = None
508508
self.channel_types: List[SlashCommandOptionType] = kwargs.pop("channel_types", [])
509509
if not isinstance(input_type, SlashCommandOptionType):
510-
to_assign = input_type() if isinstance(input_type, type) else input_type
511-
_type = SlashCommandOptionType.from_datatype(to_assign.__class__)
512-
if _type == SlashCommandOptionType.custom:
513-
self._converter = to_assign
510+
if hasattr(input_type, "convert"):
511+
self._converter = input_type
514512
input_type = SlashCommandOptionType.string
515-
elif _type == SlashCommandOptionType.channel:
516-
if not isinstance(input_type, tuple):
517-
input_type = (input_type,)
518-
for i in input_type:
519-
if i.__name__ == 'GuildChannel':
520-
continue
521-
522-
channel_type = channel_type_map[i.__name__]
523-
self.channel_types.append(channel_type)
524513
else:
514+
_type = SlashCommandOptionType.from_datatype(input_type)
515+
if _type == SlashCommandOptionType.channel:
516+
if not isinstance(input_type, tuple):
517+
input_type = (input_type,)
518+
for i in input_type:
519+
if i.__name__ == 'GuildChannel':
520+
continue
521+
522+
channel_type = channel_type_map[i.__name__]
523+
self.channel_types.append(channel_type)
525524
input_type = _type
526525
self.input_type = input_type
527526
self.required: bool = kwargs.pop("required", True)

discord/role.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ class Role(Hashable):
175175
unicode_emoji: Optional[:class:`str`]
176176
The role's unicode emoji.
177177
Only available to guilds that contain ``ROLE_ICONS`` in :attr:`Guild.features`.
178+
179+
.. versionadded:: 2.0
178180
"""
179181

180182
__slots__ = (
@@ -328,7 +330,10 @@ def members(self) -> List[Member]:
328330

329331
@property
330332
def icon(self) -> Optional[Asset]:
331-
"""Optional[:class:`Asset`]: Returns the role's icon asset, if available."""
333+
"""Optional[:class:`Asset`]: Returns the role's icon asset, if available.
334+
335+
.. versionadded:: 2.0
336+
"""
332337
if self._icon is None:
333338
return None
334339

@@ -384,7 +389,7 @@ async def edit(
384389
Can now pass ``int`` to ``colour`` keyword-only parameter.
385390
386391
.. versionchanged:: 2.0
387-
Edits are no longer in-place, the newly edited role is returned instead.
392+
Edits are no longer in-place, the newly edited role is returned instead. Added ``icon`` and ``unicode_emoji``.
388393
389394
Parameters
390395
-----------

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,14 @@
7373
extras_require=extras_require,
7474
python_requires='>=3.8.0',
7575
classifiers=[
76-
'Development Status :: 5 - Production/Stable',
76+
'Development Status :: 3 - Alpha',
7777
'License :: OSI Approved :: MIT License',
7878
'Intended Audience :: Developers',
7979
'Natural Language :: English',
8080
'Operating System :: OS Independent',
8181
'Programming Language :: Python :: 3.8',
8282
'Programming Language :: Python :: 3.9',
83+
'Programming Language :: Python :: 3.10'
8384
'Topic :: Internet',
8485
'Topic :: Software Development :: Libraries',
8586
'Topic :: Software Development :: Libraries :: Python Modules',

0 commit comments

Comments
 (0)