Skip to content

Commit f0b855d

Browse files
authored
Re-Upload
The old current one uploaded again as the pre-release was pushed into the main by mistake.
1 parent f621064 commit f0b855d

File tree

10 files changed

+252
-493
lines changed

10 files changed

+252
-493
lines changed

discord/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
from .role import Role, RoleTags
4242
from .file import File
4343
from .colour import Color, Colour
44-
from .integrations import Integration, IntegrationAccount, BotIntegration, IntegrationApplication, StreamIntegration
45-
from .interactions import Interaction, ButtonClick, SelectionSelect
44+
from .integrations import Integration, IntegrationAccount
4645
from .invite import Invite, PartialInviteChannel, PartialInviteGuild
4746
from .template import Template
4847
from .widget import Widget, WidgetMember, WidgetChannel
@@ -51,7 +50,7 @@
5150
from . import utils, opus, abc
5251
from .enums import *
5352
from .embeds import Embed
54-
from .components import Button, SelectionMenu, ActionRow, ButtonColor, ButtonStyle, select_option
53+
from .components import Button, DropdownMenue, ActionRow, ButtonColor, ButtonStyle
5554
from .mentions import AllowedMentions
5655
from .shard import AutoShardedClient, ShardInfo
5756
from .player import *

discord/abc.py

Lines changed: 19 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from .role import Role
4141
from .invite import Invite
4242
from .file import File
43-
from .components import Button, SelectionMenu, ActionRow
43+
from .components import Button, DropdownMenue, ActionRow
4444
from .voice_client import VoiceClient, VoiceProtocol
4545
from . import utils
4646

@@ -936,7 +936,7 @@ async def _get_channel(self):
936936
async def send(self, content=None, *, tts=False, embed=None, components=None, file=None,
937937
files=None, delete_after=None, nonce=None,
938938
allowed_mentions=None, reference=None,
939-
mention_author=None, hidden=None, **kwargs):
939+
mention_author=None):
940940
"""|coro|
941941
942942
Sends a message to the destination with the content given.
@@ -997,10 +997,6 @@ async def send(self, content=None, *, tts=False, embed=None, components=None, fi
997997
998998
.. versionadded:: 1.6
999999
1000-
hidden: Optional[:class:`bool`]
1001-
If :bool:`True` the message will be only bee visible for the performer of the interaction.
1002-
If this isnt called within an :class:`RawInteractionCreateEvent` it will be ignored
1003-
10041000
Raises
10051001
--------
10061002
~discord.HTTPException
@@ -1031,12 +1027,12 @@ async def send(self, content=None, *, tts=False, embed=None, components=None, fi
10311027
for component in ([components] if not isinstance(components, list) else components):
10321028
if isinstance(component, Button):
10331029
_components.extend(ActionRow(component).sendable())
1034-
elif isinstance(component, SelectionMenu):
1035-
_components.extend(ActionRow(component).sendable())
1030+
elif isinstance(component, DropdownMenue):
1031+
_components.append(component.to_dict())
10361032
elif isinstance(component, ActionRow):
10371033
_components.extend(component.sendable())
10381034
elif isinstance(component, list):
1039-
_components.extend(ActionRow(*[obj for obj in component if any(isinstance(obj, Button) or isinstance(obj, SelectionMenu))]).sendable())
1035+
_components.extend(ActionRow(*[obj for obj in component if isinstance(obj, Button)]).sendable())
10401036
components = _components
10411037

10421038
if allowed_mentions is not None:
@@ -1060,34 +1056,14 @@ async def send(self, content=None, *, tts=False, embed=None, components=None, fi
10601056
if file is not None and files is not None:
10611057
raise InvalidArgument('cannot pass both file and files parameter to send()')
10621058

1063-
is_interaction_responce = kwargs.pop('__is_interaction_responce', None)
1064-
deferred = kwargs.pop('__deferred', False)
1065-
use_webhook = kwargs.pop('__use_webhook', False)
1066-
interaction_id = kwargs.pop('__interaction_id', None)
1067-
interaction_token = kwargs.pop('__interaction_token', None)
1068-
application_id = kwargs.pop('__application_id', None)
1069-
if is_interaction_responce == False or None:
1070-
hidden = None
10711059
if file is not None:
10721060
if not isinstance(file, File):
10731061
raise InvalidArgument('file parameter must be File')
10741062

10751063
try:
1076-
if hidden is not None:
1077-
data = await state.http.send_interaction_response(use_webhook=use_webhook,
1078-
interaction_id=interaction_id,
1079-
token=interaction_token,
1080-
application_id=application_id,
1081-
deferred=deferred,
1082-
files=[file], allowed_mentions=allowed_mentions,
1083-
content=content, tts=tts, embed=embed,
1084-
components=components,
1085-
nonce=nonce, message_reference=reference,
1086-
flags=64 if hidden else None)
1087-
else:
1088-
data = await state.http.send_files(channel.id, files=[file], allowed_mentions=allowed_mentions,
1089-
content=content, tts=tts, embed=embed, components=components,
1090-
nonce=nonce, message_reference=reference)
1064+
data = await state.http.send_files(channel.id, files=[file], allowed_mentions=allowed_mentions,
1065+
content=content, tts=tts, embed=embed, components=components,
1066+
nonce=nonce, message_reference=reference)
10911067
finally:
10921068
file.close()
10931069

@@ -1098,45 +1074,21 @@ async def send(self, content=None, *, tts=False, embed=None, components=None, fi
10981074
raise InvalidArgument('files parameter must be a list of File')
10991075

11001076
try:
1101-
if hidden is not None:
1102-
data = await state.http.send_interaction_response(use_webhook=use_webhook,
1103-
interaction_id=interaction_id,
1104-
token=interaction_token,
1105-
application_id=application_id,
1106-
deferred=deferred,
1107-
files=file, allowed_mentions=allowed_mentions,
1108-
content=content, tts=tts, embed=embed,
1109-
components=components,
1110-
nonce=nonce, message_reference=reference,
1111-
flags=64 if hidden else None)
1112-
else:
1113-
data = await state.http.send_files(channel.id, files=files, content=content, tts=tts,
1114-
embed=embed, components=components, nonce=nonce,
1115-
allowed_mentions=allowed_mentions, message_reference=reference)
1077+
data = await state.http.send_files(channel.id, files=files, content=content, tts=tts,
1078+
embed=embed, components=components, nonce=nonce,
1079+
allowed_mentions=allowed_mentions, message_reference=reference)
11161080
finally:
11171081
for f in files:
11181082
f.close()
11191083
else:
1120-
if hidden is not None:
1121-
data = await state.http.send_interaction_response(use_webhook=use_webhook,
1122-
interaction_id=interaction_id,
1123-
token=interaction_token,
1124-
application_id=application_id,
1125-
deferred=deferred, allowed_mentions=allowed_mentions,
1126-
content=content, tts=tts, embed=embed,
1127-
components=components,
1128-
nonce=nonce, message_reference=reference,
1129-
flags=64 if hidden else None)
1130-
else:
1131-
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed, components=components,
1132-
nonce=nonce, allowed_mentions=allowed_mentions,
1133-
message_reference=reference)
1134-
if not hidden is True:
1135-
ret = state.create_message(channel=channel, data=data)
1136-
if delete_after is not None and hidden is None:
1137-
await ret.delete(delay=delete_after)
1138-
return ret
1139-
return None
1084+
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed, components=components,
1085+
nonce=nonce, allowed_mentions=allowed_mentions,
1086+
message_reference=reference)
1087+
1088+
ret = state.create_message(channel=channel, data=data)
1089+
if delete_after is not None:
1090+
await ret.delete(delay=delete_after)
1091+
return ret
11401092

11411093
async def trigger_typing(self):
11421094
"""|coro|

discord/client.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -972,18 +972,12 @@ def check(reaction, user):
972972
"""
973973

974974
future = self.loop.create_future()
975-
if event.lower().lstrip('raw_') in ('button_click', 'selection_select'):
976-
ck = check
975+
if check is None:
977976
def _check(*args):
978-
return ck(*args) if check else True and args[0].component.component_type == {'button_click': 2, 'selection_select': 3}.get(event.lower().lstrip('raw_'))
977+
return True
979978
check = _check
980-
ev = event.lower()
981-
else:
982-
if check is None:
983-
def _check(*args):
984-
return True
985-
check = _check
986-
ev = event.lower()
979+
980+
ev = event.lower()
987981
try:
988982
listeners = self._listeners[ev]
989983
except KeyError:

0 commit comments

Comments
 (0)