4141from .role import Role
4242from .invite import Invite
4343from .file import File
44- from .components import Button , SelectionMenu , ActionRow
44+ from .components import Button , SelectMenu , ActionRow
4545from .voice_client import VoiceClient , VoiceProtocol
4646from . import utils
4747
@@ -175,7 +175,10 @@ def __init__(self, **kwargs):
175175 self .id = kwargs .pop ('id' )
176176 self .allow = int (kwargs .pop ('allow_new' , 0 ))
177177 self .deny = int (kwargs .pop ('deny_new' , 0 ))
178- self .type = sys .intern (kwargs .pop ('type' ))
178+ type = kwargs .pop ('type' )
179+ if type not in ('role' , 'user' , 'member' ):
180+ type = {0 : 'role' , 1 : 'user' }.get (type )
181+ self .type = sys .intern (type )
179182
180183 def _asdict (self ):
181184 return {
@@ -962,8 +965,10 @@ async def send(self, content=None, *, tts=False, embed=None, embeds=None, compon
962965 Indicates if the message should be sent using text-to-speech.
963966 embed: :class:`~discord.Embed`
964967 The rich embed for the content.
965- components: List[:class:`discord.ActionRow`]
966- A list of :type:`discord.Actionrow`'s
968+ embeds: List[:class:`~discord.Embed`]
969+ A list containing up to ten embeds
970+ components: List[Union[:class:`ActionRow`, List[Union[:class:`Button`, :class:`SelectMenu`]]]]
971+ A list of :type:`discord.ActionRow`'s or a list of :class:`Button`'s or :class:`SelectMenu`'
967972 file: :class:`~discord.File`
968973 The file to upload.
969974 files: List[:class:`~discord.File`]
@@ -1032,12 +1037,12 @@ async def send(self, content=None, *, tts=False, embed=None, embeds=None, compon
10321037 for component in ([components ] if not isinstance (components , list ) else components ):
10331038 if isinstance (component , Button ):
10341039 _components .extend (ActionRow (component ).sendable ())
1035- elif isinstance (component , SelectionMenu ):
1040+ elif isinstance (component , SelectMenu ):
10361041 _components .extend (ActionRow (component ).sendable ())
10371042 elif isinstance (component , ActionRow ):
10381043 _components .extend (component .sendable ())
10391044 elif isinstance (component , list ):
1040- _components .extend (ActionRow (* [obj for obj in component if any ([isinstance (obj , Button ), isinstance (obj , SelectionMenu )])]).sendable ())
1045+ _components .extend (ActionRow (* [obj for obj in component if any ([isinstance (obj , Button ), isinstance (obj , SelectMenu )])]).sendable ())
10411046 components = _components
10421047
10431048 if allowed_mentions is not None :
@@ -1070,17 +1075,14 @@ async def send(self, content=None, *, tts=False, embed=None, embeds=None, compon
10701075 followup = kwargs .pop ('followup' , False )
10711076 if is_interaction_responce is False or None :
10721077 hidden = None
1073- if hidden is not None :
1074- embedlist = []
1075- if embed :
1076- embedlist .append (embed )
1077- if embeds :
1078- embedlist .extend ([e .to_dict () for e in embeds ])
1079- embeds = embedlist
1080- if len (embeds ) > 10 :
1081- raise InvalidArgument (f'The maximum number of embeds that can be sent with a response is 10, get: { len (embeds )} ' )
1082- elif embeds :
1083- raise InvalidArgument ('Normal Messages dont support multible Embeds.' )
1078+ embedlist = []
1079+ if embed :
1080+ embedlist .append (embed )
1081+ if embeds :
1082+ embedlist .extend ([e .to_dict () for e in embeds ])
1083+ embeds = embedlist
1084+ if len (embeds ) > 10 :
1085+ raise InvalidArgument (f'The maximum number of embeds that can be sent with a response is 10, get: { len (embeds )} ' )
10841086 if file is not None :
10851087 if not isinstance (file , File ):
10861088 raise InvalidArgument ('file parameter must be File' )
@@ -1100,7 +1102,7 @@ async def send(self, content=None, *, tts=False, embed=None, embeds=None, compon
11001102 followup = followup )
11011103 else :
11021104 data = await state .http .send_files (channel .id , files = [file ], allowed_mentions = allowed_mentions ,
1103- content = content , tts = tts , embed = embed , components = components ,
1105+ content = content , tts = tts , embeds = embeds , components = components ,
11041106 nonce = nonce , message_reference = reference )
11051107 finally :
11061108 file .close ()
@@ -1144,7 +1146,7 @@ async def send(self, content=None, *, tts=False, embed=None, embeds=None, compon
11441146 flags = 64 if hidden is True else None ,
11451147 followup = followup )
11461148 else :
1147- data = await state .http .send_message (channel .id , content , tts = tts , embed = embed , components = components ,
1149+ data = await state .http .send_message (channel .id , content , tts = tts , embeds = embeds , components = components ,
11481150 nonce = nonce , allowed_mentions = allowed_mentions ,
11491151 message_reference = reference )
11501152 if not hidden is True :
0 commit comments