partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Client.delete_invite | |coro|
Revokes an :class:`.Invite`, URL, or ID to an invite.
You must have the :attr:`~.Permissions.manage_channels` permission in
the associated guild to do this.
Parameters
----------
invite: Union[:class:`.Invite`, :class:`str`]
The invite to revoke.
... | discord/client.py | async def delete_invite(self, invite):
"""|coro|
Revokes an :class:`.Invite`, URL, or ID to an invite.
You must have the :attr:`~.Permissions.manage_channels` permission in
the associated guild to do this.
Parameters
----------
invite: Union[:class:`.Invite`, :... | async def delete_invite(self, invite):
"""|coro|
Revokes an :class:`.Invite`, URL, or ID to an invite.
You must have the :attr:`~.Permissions.manage_channels` permission in
the associated guild to do this.
Parameters
----------
invite: Union[:class:`.Invite`, :... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L996-L1020 | [
"async",
"def",
"delete_invite",
"(",
"self",
",",
"invite",
")",
":",
"invite_id",
"=",
"utils",
".",
"resolve_invite",
"(",
"invite",
")",
"await",
"self",
".",
"http",
".",
"delete_invite",
"(",
"invite_id",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.fetch_widget | |coro|
Gets a :class:`.Widget` from a guild ID.
.. note::
The guild must have the widget enabled to get this information.
Parameters
-----------
guild_id: :class:`int`
The ID of the guild.
Raises
-------
Forbidden
T... | discord/client.py | async def fetch_widget(self, guild_id):
"""|coro|
Gets a :class:`.Widget` from a guild ID.
.. note::
The guild must have the widget enabled to get this information.
Parameters
-----------
guild_id: :class:`int`
The ID of the guild.
Rai... | async def fetch_widget(self, guild_id):
"""|coro|
Gets a :class:`.Widget` from a guild ID.
.. note::
The guild must have the widget enabled to get this information.
Parameters
-----------
guild_id: :class:`int`
The ID of the guild.
Rai... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1024-L1052 | [
"async",
"def",
"fetch_widget",
"(",
"self",
",",
"guild_id",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_widget",
"(",
"guild_id",
")",
"return",
"Widget",
"(",
"state",
"=",
"self",
".",
"_connection",
",",
"data",
"=",
"data",
")"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.application_info | |coro|
Retrieve's the bot's application information.
Raises
-------
HTTPException
Retrieving the information failed somehow.
Returns
--------
:class:`.AppInfo`
A namedtuple representing the application info. | discord/client.py | async def application_info(self):
"""|coro|
Retrieve's the bot's application information.
Raises
-------
HTTPException
Retrieving the information failed somehow.
Returns
--------
:class:`.AppInfo`
A namedtuple representing the ap... | async def application_info(self):
"""|coro|
Retrieve's the bot's application information.
Raises
-------
HTTPException
Retrieving the information failed somehow.
Returns
--------
:class:`.AppInfo`
A namedtuple representing the ap... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1054-L1072 | [
"async",
"def",
"application_info",
"(",
"self",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"application_info",
"(",
")",
"if",
"'rpc_origins'",
"not",
"in",
"data",
":",
"data",
"[",
"'rpc_origins'",
"]",
"=",
"None",
"return",
"AppInfo",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.fetch_user | |coro|
Retrieves a :class:`~discord.User` based on their ID. This can only
be used by bot accounts. You do not have to share any guilds
with the user to get this information, however many operations
do require that you do.
.. note::
This method is an API call. For ... | discord/client.py | async def fetch_user(self, user_id):
"""|coro|
Retrieves a :class:`~discord.User` based on their ID. This can only
be used by bot accounts. You do not have to share any guilds
with the user to get this information, however many operations
do require that you do.
.. note... | async def fetch_user(self, user_id):
"""|coro|
Retrieves a :class:`~discord.User` based on their ID. This can only
be used by bot accounts. You do not have to share any guilds
with the user to get this information, however many operations
do require that you do.
.. note... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1074-L1104 | [
"async",
"def",
"fetch_user",
"(",
"self",
",",
"user_id",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_user",
"(",
"user_id",
")",
"return",
"User",
"(",
"state",
"=",
"self",
".",
"_connection",
",",
"data",
"=",
"data",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.fetch_user_profile | |coro|
Gets an arbitrary user's profile. This can only be used by non-bot accounts.
Parameters
------------
user_id: :class:`int`
The ID of the user to fetch their profile for.
Raises
-------
Forbidden
Not allowed to fetch profiles.
... | discord/client.py | async def fetch_user_profile(self, user_id):
"""|coro|
Gets an arbitrary user's profile. This can only be used by non-bot accounts.
Parameters
------------
user_id: :class:`int`
The ID of the user to fetch their profile for.
Raises
-------
F... | async def fetch_user_profile(self, user_id):
"""|coro|
Gets an arbitrary user's profile. This can only be used by non-bot accounts.
Parameters
------------
user_id: :class:`int`
The ID of the user to fetch their profile for.
Raises
-------
F... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1106-L1142 | [
"async",
"def",
"fetch_user_profile",
"(",
"self",
",",
"user_id",
")",
":",
"state",
"=",
"self",
".",
"_connection",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_user_profile",
"(",
"user_id",
")",
"def",
"transform",
"(",
"d",
")",
":",
"retur... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.fetch_webhook | |coro|
Retrieves a :class:`.Webhook` with the specified ID.
Raises
--------
HTTPException
Retrieving the webhook failed.
NotFound
Invalid webhook ID.
Forbidden
You do not have permission to fetch this webhook.
Returns
... | discord/client.py | async def fetch_webhook(self, webhook_id):
"""|coro|
Retrieves a :class:`.Webhook` with the specified ID.
Raises
--------
HTTPException
Retrieving the webhook failed.
NotFound
Invalid webhook ID.
Forbidden
You do not have perm... | async def fetch_webhook(self, webhook_id):
"""|coro|
Retrieves a :class:`.Webhook` with the specified ID.
Raises
--------
HTTPException
Retrieving the webhook failed.
NotFound
Invalid webhook ID.
Forbidden
You do not have perm... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1144-L1164 | [
"async",
"def",
"fetch_webhook",
"(",
"self",
",",
"webhook_id",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_webhook",
"(",
"webhook_id",
")",
"return",
"Webhook",
".",
"from_state",
"(",
"data",
",",
"state",
"=",
"self",
".",
"_conne... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | PartialInviteGuild.icon_url_as | :class:`Asset`: The same operation as :meth:`Guild.icon_url_as`. | discord/invite.py | def icon_url_as(self, *, format='webp', size=1024):
""":class:`Asset`: The same operation as :meth:`Guild.icon_url_as`."""
return Asset._from_guild_image(self._state, self.id, self.icon, 'icons', format=format, size=size) | def icon_url_as(self, *, format='webp', size=1024):
""":class:`Asset`: The same operation as :meth:`Guild.icon_url_as`."""
return Asset._from_guild_image(self._state, self.id, self.icon, 'icons', format=format, size=size) | [
":",
"class",
":",
"Asset",
":",
"The",
"same",
"operation",
"as",
":",
"meth",
":",
"Guild",
".",
"icon_url_as",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/invite.py#L153-L155 | [
"def",
"icon_url_as",
"(",
"self",
",",
"*",
",",
"format",
"=",
"'webp'",
",",
"size",
"=",
"1024",
")",
":",
"return",
"Asset",
".",
"_from_guild_image",
"(",
"self",
".",
"_state",
",",
"self",
".",
"id",
",",
"self",
".",
"icon",
",",
"'icons'",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | PartialInviteGuild.banner_url_as | :class:`Asset`: The same operation as :meth:`Guild.banner_url_as`. | discord/invite.py | def banner_url_as(self, *, format='webp', size=2048):
""":class:`Asset`: The same operation as :meth:`Guild.banner_url_as`."""
return Asset._from_guild_image(self._state, self.id, self.banner, 'banners', format=format, size=size) | def banner_url_as(self, *, format='webp', size=2048):
""":class:`Asset`: The same operation as :meth:`Guild.banner_url_as`."""
return Asset._from_guild_image(self._state, self.id, self.banner, 'banners', format=format, size=size) | [
":",
"class",
":",
"Asset",
":",
"The",
"same",
"operation",
"as",
":",
"meth",
":",
"Guild",
".",
"banner_url_as",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/invite.py#L162-L164 | [
"def",
"banner_url_as",
"(",
"self",
",",
"*",
",",
"format",
"=",
"'webp'",
",",
"size",
"=",
"2048",
")",
":",
"return",
"Asset",
".",
"_from_guild_image",
"(",
"self",
".",
"_state",
",",
"self",
".",
"id",
",",
"self",
".",
"banner",
",",
"'banne... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | PartialInviteGuild.splash_url_as | :class:`Asset`: The same operation as :meth:`Guild.splash_url_as`. | discord/invite.py | def splash_url_as(self, *, format='webp', size=2048):
""":class:`Asset`: The same operation as :meth:`Guild.splash_url_as`."""
return Asset._from_guild_image(self._state, self.id, self.splash, 'splashes', format=format, size=size) | def splash_url_as(self, *, format='webp', size=2048):
""":class:`Asset`: The same operation as :meth:`Guild.splash_url_as`."""
return Asset._from_guild_image(self._state, self.id, self.splash, 'splashes', format=format, size=size) | [
":",
"class",
":",
"Asset",
":",
"The",
"same",
"operation",
"as",
":",
"meth",
":",
"Guild",
".",
"splash_url_as",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/invite.py#L171-L173 | [
"def",
"splash_url_as",
"(",
"self",
",",
"*",
",",
"format",
"=",
"'webp'",
",",
"size",
"=",
"2048",
")",
":",
"return",
"Asset",
".",
"_from_guild_image",
"(",
"self",
".",
"_state",
",",
"self",
".",
"id",
",",
"self",
".",
"splash",
",",
"'splas... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Invite.delete | |coro|
Revokes the instant invite.
You must have the :attr:`~Permissions.manage_channels` permission to do this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this invite. Shows up on the audit log.
Raises
-------
... | discord/invite.py | async def delete(self, *, reason=None):
"""|coro|
Revokes the instant invite.
You must have the :attr:`~Permissions.manage_channels` permission to do this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this invite. Shows up o... | async def delete(self, *, reason=None):
"""|coro|
Revokes the instant invite.
You must have the :attr:`~Permissions.manage_channels` permission to do this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this invite. Shows up o... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/invite.py#L286-L308 | [
"async",
"def",
"delete",
"(",
"self",
",",
"*",
",",
"reason",
"=",
"None",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"delete_invite",
"(",
"self",
".",
"code",
",",
"reason",
"=",
"reason",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Attachment.save | |coro|
Saves this attachment into a file-like object.
Parameters
-----------
fp: Union[BinaryIO, :class:`os.PathLike`]
The file-like object to save this attachment to or the filename
to use. If a filename is passed then a file is created with that
fi... | discord/message.py | async def save(self, fp, *, seek_begin=True, use_cached=False):
"""|coro|
Saves this attachment into a file-like object.
Parameters
-----------
fp: Union[BinaryIO, :class:`os.PathLike`]
The file-like object to save this attachment to or the filename
to u... | async def save(self, fp, *, seek_begin=True, use_cached=False):
"""|coro|
Saves this attachment into a file-like object.
Parameters
-----------
fp: Union[BinaryIO, :class:`os.PathLike`]
The file-like object to save this attachment to or the filename
to u... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L81-L124 | [
"async",
"def",
"save",
"(",
"self",
",",
"fp",
",",
"*",
",",
"seek_begin",
"=",
"True",
",",
"use_cached",
"=",
"False",
")",
":",
"url",
"=",
"self",
".",
"proxy_url",
"if",
"use_cached",
"else",
"self",
".",
"url",
"data",
"=",
"await",
"self",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.raw_mentions | A property that returns an array of user IDs matched with
the syntax of <@user_id> in the message content.
This allows you to receive the user IDs of mentioned users
even in a private message context. | discord/message.py | def raw_mentions(self):
"""A property that returns an array of user IDs matched with
the syntax of <@user_id> in the message content.
This allows you to receive the user IDs of mentioned users
even in a private message context.
"""
return [int(x) for x in re.findall(r'<@... | def raw_mentions(self):
"""A property that returns an array of user IDs matched with
the syntax of <@user_id> in the message content.
This allows you to receive the user IDs of mentioned users
even in a private message context.
"""
return [int(x) for x in re.findall(r'<@... | [
"A",
"property",
"that",
"returns",
"an",
"array",
"of",
"user",
"IDs",
"matched",
"with",
"the",
"syntax",
"of",
"<@user_id",
">",
"in",
"the",
"message",
"content",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L370-L377 | [
"def",
"raw_mentions",
"(",
"self",
")",
":",
"return",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"re",
".",
"findall",
"(",
"r'<@!?([0-9]+)>'",
",",
"self",
".",
"content",
")",
"]"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.raw_channel_mentions | A property that returns an array of channel IDs matched with
the syntax of <#channel_id> in the message content. | discord/message.py | def raw_channel_mentions(self):
"""A property that returns an array of channel IDs matched with
the syntax of <#channel_id> in the message content.
"""
return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)] | def raw_channel_mentions(self):
"""A property that returns an array of channel IDs matched with
the syntax of <#channel_id> in the message content.
"""
return [int(x) for x in re.findall(r'<#([0-9]+)>', self.content)] | [
"A",
"property",
"that",
"returns",
"an",
"array",
"of",
"channel",
"IDs",
"matched",
"with",
"the",
"syntax",
"of",
"<#channel_id",
">",
"in",
"the",
"message",
"content",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L380-L384 | [
"def",
"raw_channel_mentions",
"(",
"self",
")",
":",
"return",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"re",
".",
"findall",
"(",
"r'<#([0-9]+)>'",
",",
"self",
".",
"content",
")",
"]"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.raw_role_mentions | A property that returns an array of role IDs matched with
the syntax of <@&role_id> in the message content. | discord/message.py | def raw_role_mentions(self):
"""A property that returns an array of role IDs matched with
the syntax of <@&role_id> in the message content.
"""
return [int(x) for x in re.findall(r'<@&([0-9]+)>', self.content)] | def raw_role_mentions(self):
"""A property that returns an array of role IDs matched with
the syntax of <@&role_id> in the message content.
"""
return [int(x) for x in re.findall(r'<@&([0-9]+)>', self.content)] | [
"A",
"property",
"that",
"returns",
"an",
"array",
"of",
"role",
"IDs",
"matched",
"with",
"the",
"syntax",
"of",
"<"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L387-L391 | [
"def",
"raw_role_mentions",
"(",
"self",
")",
":",
"return",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"re",
".",
"findall",
"(",
"r'<@&([0-9]+)>'",
",",
"self",
".",
"content",
")",
"]"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.clean_content | A property that returns the content in a "cleaned up"
manner. This basically means that mentions are transformed
into the way the client shows it. e.g. ``<#id>`` will transform
into ``#name``.
This will also transform @everyone and @here mentions into
non-mentions.
.. n... | discord/message.py | def clean_content(self):
"""A property that returns the content in a "cleaned up"
manner. This basically means that mentions are transformed
into the way the client shows it. e.g. ``<#id>`` will transform
into ``#name``.
This will also transform @everyone and @here mentions into... | def clean_content(self):
"""A property that returns the content in a "cleaned up"
manner. This basically means that mentions are transformed
into the way the client shows it. e.g. ``<#id>`` will transform
into ``#name``.
This will also transform @everyone and @here mentions into... | [
"A",
"property",
"that",
"returns",
"the",
"content",
"in",
"a",
"cleaned",
"up",
"manner",
".",
"This",
"basically",
"means",
"that",
"mentions",
"are",
"transformed",
"into",
"the",
"way",
"the",
"client",
"shows",
"it",
".",
"e",
".",
"g",
".",
"<#id"... | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L401-L458 | [
"def",
"clean_content",
"(",
"self",
")",
":",
"transformations",
"=",
"{",
"re",
".",
"escape",
"(",
"'<#%s>'",
"%",
"channel",
".",
"id",
")",
":",
"'#'",
"+",
"channel",
".",
"name",
"for",
"channel",
"in",
"self",
".",
"channel_mentions",
"}",
"men... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.system_content | r"""A property that returns the content that is rendered
regardless of the :attr:`Message.type`.
In the case of :attr:`MessageType.default`\, this just returns the
regular :attr:`Message.content`. Otherwise this returns an English
message denoting the contents of the system message. | discord/message.py | def system_content(self):
r"""A property that returns the content that is rendered
regardless of the :attr:`Message.type`.
In the case of :attr:`MessageType.default`\, this just returns the
regular :attr:`Message.content`. Otherwise this returns an English
message denoting the c... | def system_content(self):
r"""A property that returns the content that is rendered
regardless of the :attr:`Message.type`.
In the case of :attr:`MessageType.default`\, this just returns the
regular :attr:`Message.content`. Otherwise this returns an English
message denoting the c... | [
"r",
"A",
"property",
"that",
"returns",
"the",
"content",
"that",
"is",
"rendered",
"regardless",
"of",
"the",
":",
"attr",
":",
"Message",
".",
"type",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L477-L564 | [
"def",
"system_content",
"(",
"self",
")",
":",
"if",
"self",
".",
"type",
"is",
"MessageType",
".",
"default",
":",
"return",
"self",
".",
"content",
"if",
"self",
".",
"type",
"is",
"MessageType",
".",
"pins_add",
":",
"return",
"'{0.name} pinned a message... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.delete | |coro|
Deletes the message.
Your own messages could be deleted without any proper permissions. However to
delete other people's messages, you need the :attr:`~Permissions.manage_messages`
permission.
.. versionchanged:: 1.1.0
Added the new ``delay`` keyword-only pa... | discord/message.py | async def delete(self, *, delay=None):
"""|coro|
Deletes the message.
Your own messages could be deleted without any proper permissions. However to
delete other people's messages, you need the :attr:`~Permissions.manage_messages`
permission.
.. versionchanged:: 1.1.0
... | async def delete(self, *, delay=None):
"""|coro|
Deletes the message.
Your own messages could be deleted without any proper permissions. However to
delete other people's messages, you need the :attr:`~Permissions.manage_messages`
permission.
.. versionchanged:: 1.1.0
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L566-L601 | [
"async",
"def",
"delete",
"(",
"self",
",",
"*",
",",
"delay",
"=",
"None",
")",
":",
"if",
"delay",
"is",
"not",
"None",
":",
"async",
"def",
"delete",
"(",
")",
":",
"await",
"asyncio",
".",
"sleep",
"(",
"delay",
",",
"loop",
"=",
"self",
".",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.edit | |coro|
Edits the message.
The content must be able to be transformed into a string via ``str(content)``.
Parameters
-----------
content: Optional[:class:`str`]
The new content to replace the message with.
Could be ``None`` to remove the content.
... | discord/message.py | async def edit(self, **fields):
"""|coro|
Edits the message.
The content must be able to be transformed into a string via ``str(content)``.
Parameters
-----------
content: Optional[:class:`str`]
The new content to replace the message with.
Could... | async def edit(self, **fields):
"""|coro|
Edits the message.
The content must be able to be transformed into a string via ``str(content)``.
Parameters
-----------
content: Optional[:class:`str`]
The new content to replace the message with.
Could... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L603-L654 | [
"async",
"def",
"edit",
"(",
"self",
",",
"*",
"*",
"fields",
")",
":",
"try",
":",
"content",
"=",
"fields",
"[",
"'content'",
"]",
"except",
"KeyError",
":",
"pass",
"else",
":",
"if",
"content",
"is",
"not",
"None",
":",
"fields",
"[",
"'content'"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.pin | |coro|
Pins the message.
You must have the :attr:`~Permissions.manage_messages` permission to do
this in a non-private channel context.
Raises
-------
Forbidden
You do not have permissions to pin the message.
NotFound
The message or chan... | discord/message.py | async def pin(self):
"""|coro|
Pins the message.
You must have the :attr:`~Permissions.manage_messages` permission to do
this in a non-private channel context.
Raises
-------
Forbidden
You do not have permissions to pin the message.
NotFound... | async def pin(self):
"""|coro|
Pins the message.
You must have the :attr:`~Permissions.manage_messages` permission to do
this in a non-private channel context.
Raises
-------
Forbidden
You do not have permissions to pin the message.
NotFound... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L656-L676 | [
"async",
"def",
"pin",
"(",
"self",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"pin_message",
"(",
"self",
".",
"channel",
".",
"id",
",",
"self",
".",
"id",
")",
"self",
".",
"pinned",
"=",
"True"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.unpin | |coro|
Unpins the message.
You must have the :attr:`~Permissions.manage_messages` permission to do
this in a non-private channel context.
Raises
-------
Forbidden
You do not have permissions to unpin the message.
NotFound
The message or ... | discord/message.py | async def unpin(self):
"""|coro|
Unpins the message.
You must have the :attr:`~Permissions.manage_messages` permission to do
this in a non-private channel context.
Raises
-------
Forbidden
You do not have permissions to unpin the message.
No... | async def unpin(self):
"""|coro|
Unpins the message.
You must have the :attr:`~Permissions.manage_messages` permission to do
this in a non-private channel context.
Raises
-------
Forbidden
You do not have permissions to unpin the message.
No... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L678-L697 | [
"async",
"def",
"unpin",
"(",
"self",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"unpin_message",
"(",
"self",
".",
"channel",
".",
"id",
",",
"self",
".",
"id",
")",
"self",
".",
"pinned",
"=",
"False"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.add_reaction | |coro|
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild :class:`Emoji`.
You must have the :attr:`~Permissions.read_message_history` permission
to use this. If nobody else has reacted to the message using this
emoji, the :attr:`~Permissions.add_... | discord/message.py | async def add_reaction(self, emoji):
"""|coro|
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild :class:`Emoji`.
You must have the :attr:`~Permissions.read_message_history` permission
to use this. If nobody else has reacted to the message using ... | async def add_reaction(self, emoji):
"""|coro|
Add a reaction to the message.
The emoji may be a unicode emoji or a custom guild :class:`Emoji`.
You must have the :attr:`~Permissions.read_message_history` permission
to use this. If nobody else has reacted to the message using ... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L699-L728 | [
"async",
"def",
"add_reaction",
"(",
"self",
",",
"emoji",
")",
":",
"emoji",
"=",
"self",
".",
"_emoji_reaction",
"(",
"emoji",
")",
"await",
"self",
".",
"_state",
".",
"http",
".",
"add_reaction",
"(",
"self",
".",
"channel",
".",
"id",
",",
"self",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.remove_reaction | |coro|
Remove a reaction by the member from the message.
The emoji may be a unicode emoji or a custom guild :class:`Emoji`.
If the reaction is not your own (i.e. ``member`` parameter is not you) then
the :attr:`~Permissions.manage_messages` permission is needed.
The ``member`... | discord/message.py | async def remove_reaction(self, emoji, member):
"""|coro|
Remove a reaction by the member from the message.
The emoji may be a unicode emoji or a custom guild :class:`Emoji`.
If the reaction is not your own (i.e. ``member`` parameter is not you) then
the :attr:`~Permissions.ma... | async def remove_reaction(self, emoji, member):
"""|coro|
Remove a reaction by the member from the message.
The emoji may be a unicode emoji or a custom guild :class:`Emoji`.
If the reaction is not your own (i.e. ``member`` parameter is not you) then
the :attr:`~Permissions.ma... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L730-L767 | [
"async",
"def",
"remove_reaction",
"(",
"self",
",",
"emoji",
",",
"member",
")",
":",
"emoji",
"=",
"self",
".",
"_emoji_reaction",
"(",
"emoji",
")",
"if",
"member",
".",
"id",
"==",
"self",
".",
"_state",
".",
"self_id",
":",
"await",
"self",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.clear_reactions | |coro|
Removes all the reactions from the message.
You need the :attr:`~Permissions.manage_messages` permission to use this.
Raises
--------
HTTPException
Removing the reactions failed.
Forbidden
You do not have the proper permissions to remove ... | discord/message.py | async def clear_reactions(self):
"""|coro|
Removes all the reactions from the message.
You need the :attr:`~Permissions.manage_messages` permission to use this.
Raises
--------
HTTPException
Removing the reactions failed.
Forbidden
You d... | async def clear_reactions(self):
"""|coro|
Removes all the reactions from the message.
You need the :attr:`~Permissions.manage_messages` permission to use this.
Raises
--------
HTTPException
Removing the reactions failed.
Forbidden
You d... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L785-L799 | [
"async",
"def",
"clear_reactions",
"(",
"self",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"clear_reactions",
"(",
"self",
".",
"channel",
".",
"id",
",",
"self",
".",
"id",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Message.ack | |coro|
Marks this message as read.
The user must not be a bot user.
Raises
-------
HTTPException
Acking failed.
ClientException
You must not be a bot user. | discord/message.py | async def ack(self):
"""|coro|
Marks this message as read.
The user must not be a bot user.
Raises
-------
HTTPException
Acking failed.
ClientException
You must not be a bot user.
"""
state = self._state
if state... | async def ack(self):
"""|coro|
Marks this message as read.
The user must not be a bot user.
Raises
-------
HTTPException
Acking failed.
ClientException
You must not be a bot user.
"""
state = self._state
if state... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L801-L819 | [
"async",
"def",
"ack",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"_state",
"if",
"state",
".",
"is_bot",
":",
"raise",
"ClientException",
"(",
"'Must not be a bot account to ack messages.'",
")",
"return",
"await",
"state",
".",
"http",
".",
"ack_messa... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Activity.large_image_url | Optional[:class:`str`]: Returns a URL pointing to the large image asset of this activity if applicable. | discord/activity.py | def large_image_url(self):
"""Optional[:class:`str`]: Returns a URL pointing to the large image asset of this activity if applicable."""
if self.application_id is None:
return None
try:
large_image = self.assets['large_image']
except KeyError:
return ... | def large_image_url(self):
"""Optional[:class:`str`]: Returns a URL pointing to the large image asset of this activity if applicable."""
if self.application_id is None:
return None
try:
large_image = self.assets['large_image']
except KeyError:
return ... | [
"Optional",
"[",
":",
"class",
":",
"str",
"]",
":",
"Returns",
"a",
"URL",
"pointing",
"to",
"the",
"large",
"image",
"asset",
"of",
"this",
"activity",
"if",
"applicable",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/activity.py#L186-L196 | [
"def",
"large_image_url",
"(",
"self",
")",
":",
"if",
"self",
".",
"application_id",
"is",
"None",
":",
"return",
"None",
"try",
":",
"large_image",
"=",
"self",
".",
"assets",
"[",
"'large_image'",
"]",
"except",
"KeyError",
":",
"return",
"None",
"else"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Activity.small_image_url | Optional[:class:`str`]: Returns a URL pointing to the small image asset of this activity if applicable. | discord/activity.py | def small_image_url(self):
"""Optional[:class:`str`]: Returns a URL pointing to the small image asset of this activity if applicable."""
if self.application_id is None:
return None
try:
small_image = self.assets['small_image']
except KeyError:
return ... | def small_image_url(self):
"""Optional[:class:`str`]: Returns a URL pointing to the small image asset of this activity if applicable."""
if self.application_id is None:
return None
try:
small_image = self.assets['small_image']
except KeyError:
return ... | [
"Optional",
"[",
":",
"class",
":",
"str",
"]",
":",
"Returns",
"a",
"URL",
"pointing",
"to",
"the",
"small",
"image",
"asset",
"of",
"this",
"activity",
"if",
"applicable",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/activity.py#L199-L209 | [
"def",
"small_image_url",
"(",
"self",
")",
":",
"if",
"self",
".",
"application_id",
"is",
"None",
":",
"return",
"None",
"try",
":",
"small_image",
"=",
"self",
".",
"assets",
"[",
"'small_image'",
"]",
"except",
"KeyError",
":",
"return",
"None",
"else"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Spotify.album_cover_url | :class:`str`: The album cover image URL from Spotify's CDN. | discord/activity.py | def album_cover_url(self):
""":class:`str`: The album cover image URL from Spotify's CDN."""
large_image = self._assets.get('large_image', '')
if large_image[:8] != 'spotify:':
return ''
album_image_id = large_image[8:]
return 'https://i.scdn.co/image/' + album_image_... | def album_cover_url(self):
""":class:`str`: The album cover image URL from Spotify's CDN."""
large_image = self._assets.get('large_image', '')
if large_image[:8] != 'spotify:':
return ''
album_image_id = large_image[8:]
return 'https://i.scdn.co/image/' + album_image_... | [
":",
"class",
":",
"str",
":",
"The",
"album",
"cover",
"image",
"URL",
"from",
"Spotify",
"s",
"CDN",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/activity.py#L539-L545 | [
"def",
"album_cover_url",
"(",
"self",
")",
":",
"large_image",
"=",
"self",
".",
"_assets",
".",
"get",
"(",
"'large_image'",
",",
"''",
")",
"if",
"large_image",
"[",
":",
"8",
"]",
"!=",
"'spotify:'",
":",
"return",
"''",
"album_image_id",
"=",
"large... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | when_mentioned_or | A callable that implements when mentioned or other prefixes provided.
These are meant to be passed into the :attr:`.Bot.command_prefix` attribute.
Example
--------
.. code-block:: python3
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'))
.. note::
This callabl... | discord/ext/commands/bot.py | def when_mentioned_or(*prefixes):
"""A callable that implements when mentioned or other prefixes provided.
These are meant to be passed into the :attr:`.Bot.command_prefix` attribute.
Example
--------
.. code-block:: python3
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!... | def when_mentioned_or(*prefixes):
"""A callable that implements when mentioned or other prefixes provided.
These are meant to be passed into the :attr:`.Bot.command_prefix` attribute.
Example
--------
.. code-block:: python3
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!... | [
"A",
"callable",
"that",
"implements",
"when",
"mentioned",
"or",
"other",
"prefixes",
"provided",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L52-L86 | [
"def",
"when_mentioned_or",
"(",
"*",
"prefixes",
")",
":",
"def",
"inner",
"(",
"bot",
",",
"msg",
")",
":",
"r",
"=",
"list",
"(",
"prefixes",
")",
"r",
"=",
"when_mentioned",
"(",
"bot",
",",
"msg",
")",
"+",
"r",
"return",
"r",
"return",
"inner... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.on_command_error | |coro|
The default command error handler provided by the bot.
By default this prints to ``sys.stderr`` however it could be
overridden to have a different implementation.
This only fires if you do not specify any listeners for command error. | discord/ext/commands/bot.py | async def on_command_error(self, context, exception):
"""|coro|
The default command error handler provided by the bot.
By default this prints to ``sys.stderr`` however it could be
overridden to have a different implementation.
This only fires if you do not specify any listener... | async def on_command_error(self, context, exception):
"""|coro|
The default command error handler provided by the bot.
By default this prints to ``sys.stderr`` however it could be
overridden to have a different implementation.
This only fires if you do not specify any listener... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L146-L168 | [
"async",
"def",
"on_command_error",
"(",
"self",
",",
"context",
",",
"exception",
")",
":",
"if",
"self",
".",
"extra_events",
".",
"get",
"(",
"'on_command_error'",
",",
"None",
")",
":",
"return",
"if",
"hasattr",
"(",
"context",
".",
"command",
",",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.add_check | Adds a global check to the bot.
This is the non-decorator interface to :meth:`.check`
and :meth:`.check_once`.
Parameters
-----------
func
The function that was used as a global check.
call_once: :class:`bool`
If the function should only be calle... | discord/ext/commands/bot.py | def add_check(self, func, *, call_once=False):
"""Adds a global check to the bot.
This is the non-decorator interface to :meth:`.check`
and :meth:`.check_once`.
Parameters
-----------
func
The function that was used as a global check.
call_once: :cla... | def add_check(self, func, *, call_once=False):
"""Adds a global check to the bot.
This is the non-decorator interface to :meth:`.check`
and :meth:`.check_once`.
Parameters
-----------
func
The function that was used as a global check.
call_once: :cla... | [
"Adds",
"a",
"global",
"check",
"to",
"the",
"bot",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L200-L218 | [
"def",
"add_check",
"(",
"self",
",",
"func",
",",
"*",
",",
"call_once",
"=",
"False",
")",
":",
"if",
"call_once",
":",
"self",
".",
"_check_once",
".",
"append",
"(",
"func",
")",
"else",
":",
"self",
".",
"_checks",
".",
"append",
"(",
"func",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.remove_check | Removes a global check from the bot.
This function is idempotent and will not raise an exception
if the function is not in the global checks.
Parameters
-----------
func
The function to remove from the global checks.
call_once: :class:`bool`
If t... | discord/ext/commands/bot.py | def remove_check(self, func, *, call_once=False):
"""Removes a global check from the bot.
This function is idempotent and will not raise an exception
if the function is not in the global checks.
Parameters
-----------
func
The function to remove from the glo... | def remove_check(self, func, *, call_once=False):
"""Removes a global check from the bot.
This function is idempotent and will not raise an exception
if the function is not in the global checks.
Parameters
-----------
func
The function to remove from the glo... | [
"Removes",
"a",
"global",
"check",
"from",
"the",
"bot",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L220-L239 | [
"def",
"remove_check",
"(",
"self",
",",
"func",
",",
"*",
",",
"call_once",
"=",
"False",
")",
":",
"l",
"=",
"self",
".",
"_check_once",
"if",
"call_once",
"else",
"self",
".",
"_checks",
"try",
":",
"l",
".",
"remove",
"(",
"func",
")",
"except",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.is_owner | Checks if a :class:`~discord.User` or :class:`~discord.Member` is the owner of
this bot.
If an :attr:`owner_id` is not set, it is fetched automatically
through the use of :meth:`~.Bot.application_info`.
Parameters
-----------
user: :class:`.abc.User`
The use... | discord/ext/commands/bot.py | async def is_owner(self, user):
"""Checks if a :class:`~discord.User` or :class:`~discord.Member` is the owner of
this bot.
If an :attr:`owner_id` is not set, it is fetched automatically
through the use of :meth:`~.Bot.application_info`.
Parameters
-----------
u... | async def is_owner(self, user):
"""Checks if a :class:`~discord.User` or :class:`~discord.Member` is the owner of
this bot.
If an :attr:`owner_id` is not set, it is fetched automatically
through the use of :meth:`~.Bot.application_info`.
Parameters
-----------
u... | [
"Checks",
"if",
"a",
":",
"class",
":",
"~discord",
".",
"User",
"or",
":",
"class",
":",
"~discord",
".",
"Member",
"is",
"the",
"owner",
"of",
"this",
"bot",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L281-L298 | [
"async",
"def",
"is_owner",
"(",
"self",
",",
"user",
")",
":",
"if",
"self",
".",
"owner_id",
"is",
"None",
":",
"app",
"=",
"await",
"self",
".",
"application_info",
"(",
")",
"self",
".",
"owner_id",
"=",
"owner_id",
"=",
"app",
".",
"owner",
".",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.add_listener | The non decorator alternative to :meth:`.listen`.
Parameters
-----------
func: :ref:`coroutine <coroutine>`
The function to call.
name: Optional[:class:`str`]
The name of the event to listen for. Defaults to ``func.__name__``.
Example
--------
... | discord/ext/commands/bot.py | def add_listener(self, func, name=None):
"""The non decorator alternative to :meth:`.listen`.
Parameters
-----------
func: :ref:`coroutine <coroutine>`
The function to call.
name: Optional[:class:`str`]
The name of the event to listen for. Defaults to ``f... | def add_listener(self, func, name=None):
"""The non decorator alternative to :meth:`.listen`.
Parameters
-----------
func: :ref:`coroutine <coroutine>`
The function to call.
name: Optional[:class:`str`]
The name of the event to listen for. Defaults to ``f... | [
"The",
"non",
"decorator",
"alternative",
"to",
":",
"meth",
":",
".",
"listen",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L367-L397 | [
"def",
"add_listener",
"(",
"self",
",",
"func",
",",
"name",
"=",
"None",
")",
":",
"name",
"=",
"func",
".",
"__name__",
"if",
"name",
"is",
"None",
"else",
"name",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"func",
")",
":",
"raise",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.remove_listener | Removes a listener from the pool of listeners.
Parameters
-----------
func
The function that was used as a listener to remove.
name: :class:`str`
The name of the event we want to remove. Defaults to
``func.__name__``. | discord/ext/commands/bot.py | def remove_listener(self, func, name=None):
"""Removes a listener from the pool of listeners.
Parameters
-----------
func
The function that was used as a listener to remove.
name: :class:`str`
The name of the event we want to remove. Defaults to
... | def remove_listener(self, func, name=None):
"""Removes a listener from the pool of listeners.
Parameters
-----------
func
The function that was used as a listener to remove.
name: :class:`str`
The name of the event we want to remove. Defaults to
... | [
"Removes",
"a",
"listener",
"from",
"the",
"pool",
"of",
"listeners",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L399-L417 | [
"def",
"remove_listener",
"(",
"self",
",",
"func",
",",
"name",
"=",
"None",
")",
":",
"name",
"=",
"func",
".",
"__name__",
"if",
"name",
"is",
"None",
"else",
"name",
"if",
"name",
"in",
"self",
".",
"extra_events",
":",
"try",
":",
"self",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.listen | A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as :func:`.on_ready`
The functions being listened to must be a coroutine.
Example
--------
.. code-block:: ... | discord/ext/commands/bot.py | def listen(self, name=None):
"""A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as :func:`.on_ready`
The functions being listened to must be a coroutine.
Example
... | def listen(self, name=None):
"""A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as :func:`.on_ready`
The functions being listened to must be a coroutine.
Example
... | [
"A",
"decorator",
"that",
"registers",
"another",
"function",
"as",
"an",
"external",
"event",
"listener",
".",
"Basically",
"this",
"allows",
"you",
"to",
"listen",
"to",
"multiple",
"events",
"from",
"different",
"places",
"e",
".",
"g",
".",
"such",
"as",... | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L419-L453 | [
"def",
"listen",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"self",
".",
"add_listener",
"(",
"func",
",",
"name",
")",
"return",
"func",
"return",
"decorator"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.add_cog | Adds a "cog" to the bot.
A cog is a class that has its own event listeners and commands.
Parameters
-----------
cog: :class:`.Cog`
The cog to register to the bot.
Raises
-------
TypeError
The cog does not inherit from :class:`.Cog`.
... | discord/ext/commands/bot.py | def add_cog(self, cog):
"""Adds a "cog" to the bot.
A cog is a class that has its own event listeners and commands.
Parameters
-----------
cog: :class:`.Cog`
The cog to register to the bot.
Raises
-------
TypeError
The cog does n... | def add_cog(self, cog):
"""Adds a "cog" to the bot.
A cog is a class that has its own event listeners and commands.
Parameters
-----------
cog: :class:`.Cog`
The cog to register to the bot.
Raises
-------
TypeError
The cog does n... | [
"Adds",
"a",
"cog",
"to",
"the",
"bot",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L457-L479 | [
"def",
"add_cog",
"(",
"self",
",",
"cog",
")",
":",
"if",
"not",
"isinstance",
"(",
"cog",
",",
"Cog",
")",
":",
"raise",
"TypeError",
"(",
"'cogs must derive from Cog'",
")",
"cog",
"=",
"cog",
".",
"_inject",
"(",
"self",
")",
"self",
".",
"__cogs",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.remove_cog | Removes a cog from the bot.
All registered commands and event listeners that the
cog has registered will be removed as well.
If no cog is found then this method has no effect.
Parameters
-----------
name: :class:`str`
The name of the cog to remove. | discord/ext/commands/bot.py | def remove_cog(self, name):
"""Removes a cog from the bot.
All registered commands and event listeners that the
cog has registered will be removed as well.
If no cog is found then this method has no effect.
Parameters
-----------
name: :class:`str`
... | def remove_cog(self, name):
"""Removes a cog from the bot.
All registered commands and event listeners that the
cog has registered will be removed as well.
If no cog is found then this method has no effect.
Parameters
-----------
name: :class:`str`
... | [
"Removes",
"a",
"cog",
"from",
"the",
"bot",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L495-L516 | [
"def",
"remove_cog",
"(",
"self",
",",
"name",
")",
":",
"cog",
"=",
"self",
".",
"__cogs",
".",
"pop",
"(",
"name",
",",
"None",
")",
"if",
"cog",
"is",
"None",
":",
"return",
"help_command",
"=",
"self",
".",
"_help_command",
"if",
"help_command",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.load_extension | Loads an extension.
An extension is a python module that contains commands, cogs, or
listeners.
An extension must have a global function, ``setup`` defined as
the entry point on what to do when the extension is loaded. This entry
point must have a single argument, the ``bot``.
... | discord/ext/commands/bot.py | def load_extension(self, name):
"""Loads an extension.
An extension is a python module that contains commands, cogs, or
listeners.
An extension must have a global function, ``setup`` defined as
the entry point on what to do when the extension is loaded. This entry
point... | def load_extension(self, name):
"""Loads an extension.
An extension is a python module that contains commands, cogs, or
listeners.
An extension must have a global function, ``setup`` defined as
the entry point on what to do when the extension is loaded. This entry
point... | [
"Loads",
"an",
"extension",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L584-L621 | [
"def",
"load_extension",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"__extensions",
":",
"raise",
"errors",
".",
"ExtensionAlreadyLoaded",
"(",
"name",
")",
"try",
":",
"lib",
"=",
"importlib",
".",
"import_module",
"(",
"name",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.unload_extension | Unloads an extension.
When the extension is unloaded, all commands, listeners, and cogs are
removed from the bot and the module is un-imported.
The extension can provide an optional global function, ``teardown``,
to do miscellaneous clean-up if necessary. This function takes a single
... | discord/ext/commands/bot.py | def unload_extension(self, name):
"""Unloads an extension.
When the extension is unloaded, all commands, listeners, and cogs are
removed from the bot and the module is un-imported.
The extension can provide an optional global function, ``teardown``,
to do miscellaneous clean-up... | def unload_extension(self, name):
"""Unloads an extension.
When the extension is unloaded, all commands, listeners, and cogs are
removed from the bot and the module is un-imported.
The extension can provide an optional global function, ``teardown``,
to do miscellaneous clean-up... | [
"Unloads",
"an",
"extension",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L623-L652 | [
"def",
"unload_extension",
"(",
"self",
",",
"name",
")",
":",
"lib",
"=",
"self",
".",
"__extensions",
".",
"get",
"(",
"name",
")",
"if",
"lib",
"is",
"None",
":",
"raise",
"errors",
".",
"ExtensionNotLoaded",
"(",
"name",
")",
"self",
".",
"_remove_... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.reload_extension | Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is
equivalent to a :meth:`unload_extension` followed by a :meth:`load_extension`
except done in an atomic way. That is, if an operation fails mid-reload then
the bot will roll-back... | discord/ext/commands/bot.py | def reload_extension(self, name):
"""Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is
equivalent to a :meth:`unload_extension` followed by a :meth:`load_extension`
except done in an atomic way. That is, if an operation fails m... | def reload_extension(self, name):
"""Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is
equivalent to a :meth:`unload_extension` followed by a :meth:`load_extension`
except done in an atomic way. That is, if an operation fails m... | [
"Atomically",
"reloads",
"an",
"extension",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L654-L705 | [
"def",
"reload_extension",
"(",
"self",
",",
"name",
")",
":",
"lib",
"=",
"self",
".",
"__extensions",
".",
"get",
"(",
"name",
")",
"if",
"lib",
"is",
"None",
":",
"raise",
"errors",
".",
"ExtensionNotLoaded",
"(",
"name",
")",
"# get the previous module... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.get_prefix | |coro|
Retrieves the prefix the bot is listening to
with the message as a context.
Parameters
-----------
message: :class:`discord.Message`
The message context to get the prefix of.
Returns
--------
Union[List[:class:`str`], :class:`str`]
... | discord/ext/commands/bot.py | async def get_prefix(self, message):
"""|coro|
Retrieves the prefix the bot is listening to
with the message as a context.
Parameters
-----------
message: :class:`discord.Message`
The message context to get the prefix of.
Returns
--------
... | async def get_prefix(self, message):
"""|coro|
Retrieves the prefix the bot is listening to
with the message as a context.
Parameters
-----------
message: :class:`discord.Message`
The message context to get the prefix of.
Returns
--------
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L735-L771 | [
"async",
"def",
"get_prefix",
"(",
"self",
",",
"message",
")",
":",
"prefix",
"=",
"ret",
"=",
"self",
".",
"command_prefix",
"if",
"callable",
"(",
"prefix",
")",
":",
"ret",
"=",
"await",
"discord",
".",
"utils",
".",
"maybe_coroutine",
"(",
"prefix",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.get_context | r"""|coro|
Returns the invocation context from the message.
This is a more low-level counter-part for :meth:`.process_commands`
to allow users more fine grained control over the processing.
The returned context is not guaranteed to be a valid invocation
context, :attr:`.Contex... | discord/ext/commands/bot.py | async def get_context(self, message, *, cls=Context):
r"""|coro|
Returns the invocation context from the message.
This is a more low-level counter-part for :meth:`.process_commands`
to allow users more fine grained control over the processing.
The returned context is not guara... | async def get_context(self, message, *, cls=Context):
r"""|coro|
Returns the invocation context from the message.
This is a more low-level counter-part for :meth:`.process_commands`
to allow users more fine grained control over the processing.
The returned context is not guara... | [
"r",
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L773-L842 | [
"async",
"def",
"get_context",
"(",
"self",
",",
"message",
",",
"*",
",",
"cls",
"=",
"Context",
")",
":",
"view",
"=",
"StringView",
"(",
"message",
".",
"content",
")",
"ctx",
"=",
"cls",
"(",
"prefix",
"=",
"None",
",",
"view",
"=",
"view",
","... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.invoke | |coro|
Invokes the command given under the invocation context and
handles all the internal event dispatch mechanisms.
Parameters
-----------
ctx: :class:`.Context`
The invocation context to invoke. | discord/ext/commands/bot.py | async def invoke(self, ctx):
"""|coro|
Invokes the command given under the invocation context and
handles all the internal event dispatch mechanisms.
Parameters
-----------
ctx: :class:`.Context`
The invocation context to invoke.
"""
if ctx.c... | async def invoke(self, ctx):
"""|coro|
Invokes the command given under the invocation context and
handles all the internal event dispatch mechanisms.
Parameters
-----------
ctx: :class:`.Context`
The invocation context to invoke.
"""
if ctx.c... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L844-L866 | [
"async",
"def",
"invoke",
"(",
"self",
",",
"ctx",
")",
":",
"if",
"ctx",
".",
"command",
"is",
"not",
"None",
":",
"self",
".",
"dispatch",
"(",
"'command'",
",",
"ctx",
")",
"try",
":",
"if",
"await",
"self",
".",
"can_run",
"(",
"ctx",
",",
"c... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | BotBase.process_commands | |coro|
This function processes the commands that have been registered
to the bot and other groups. Without this coroutine, none of the
commands will be triggered.
By default, this coroutine is called inside the :func:`.on_message`
event. If you choose to override the :func:`.on... | discord/ext/commands/bot.py | async def process_commands(self, message):
"""|coro|
This function processes the commands that have been registered
to the bot and other groups. Without this coroutine, none of the
commands will be triggered.
By default, this coroutine is called inside the :func:`.on_message`
... | async def process_commands(self, message):
"""|coro|
This function processes the commands that have been registered
to the bot and other groups. Without this coroutine, none of the
commands will be triggered.
By default, this coroutine is called inside the :func:`.on_message`
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L868-L894 | [
"async",
"def",
"process_commands",
"(",
"self",
",",
"message",
")",
":",
"if",
"message",
".",
"author",
".",
"bot",
":",
"return",
"ctx",
"=",
"await",
"self",
".",
"get_context",
"(",
"message",
")",
"await",
"self",
".",
"invoke",
"(",
"ctx",
")"
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.large | :class:`bool`: Indicates if the guild is a 'large' guild.
A large guild is defined as having more than ``large_threshold`` count
members, which for this library is set to the maximum of 250. | discord/guild.py | def large(self):
""":class:`bool`: Indicates if the guild is a 'large' guild.
A large guild is defined as having more than ``large_threshold`` count
members, which for this library is set to the maximum of 250.
"""
if self._large is None:
try:
return ... | def large(self):
""":class:`bool`: Indicates if the guild is a 'large' guild.
A large guild is defined as having more than ``large_threshold`` count
members, which for this library is set to the maximum of 250.
"""
if self._large is None:
try:
return ... | [
":",
"class",
":",
"bool",
":",
"Indicates",
"if",
"the",
"guild",
"is",
"a",
"large",
"guild",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L287-L298 | [
"def",
"large",
"(",
"self",
")",
":",
"if",
"self",
".",
"_large",
"is",
"None",
":",
"try",
":",
"return",
"self",
".",
"_member_count",
">=",
"250",
"except",
"AttributeError",
":",
"return",
"len",
"(",
"self",
".",
"_members",
")",
">=",
"250",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.voice_channels | List[:class:`VoiceChannel`]: A list of voice channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom. | discord/guild.py | def voice_channels(self):
"""List[:class:`VoiceChannel`]: A list of voice channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
"""
r = [ch for ch in self._channels.values() if isinstance(ch, VoiceChannel)]
r.sort(key=lambda ... | def voice_channels(self):
"""List[:class:`VoiceChannel`]: A list of voice channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
"""
r = [ch for ch in self._channels.values() if isinstance(ch, VoiceChannel)]
r.sort(key=lambda ... | [
"List",
"[",
":",
"class",
":",
"VoiceChannel",
"]",
":",
"A",
"list",
"of",
"voice",
"channels",
"that",
"belongs",
"to",
"this",
"guild",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L301-L308 | [
"def",
"voice_channels",
"(",
"self",
")",
":",
"r",
"=",
"[",
"ch",
"for",
"ch",
"in",
"self",
".",
"_channels",
".",
"values",
"(",
")",
"if",
"isinstance",
"(",
"ch",
",",
"VoiceChannel",
")",
"]",
"r",
".",
"sort",
"(",
"key",
"=",
"lambda",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.me | Similar to :attr:`Client.user` except an instance of :class:`Member`.
This is essentially used to get the member version of yourself. | discord/guild.py | def me(self):
"""Similar to :attr:`Client.user` except an instance of :class:`Member`.
This is essentially used to get the member version of yourself.
"""
self_id = self._state.user.id
return self.get_member(self_id) | def me(self):
"""Similar to :attr:`Client.user` except an instance of :class:`Member`.
This is essentially used to get the member version of yourself.
"""
self_id = self._state.user.id
return self.get_member(self_id) | [
"Similar",
"to",
":",
"attr",
":",
"Client",
".",
"user",
"except",
"an",
"instance",
"of",
":",
"class",
":",
"Member",
".",
"This",
"is",
"essentially",
"used",
"to",
"get",
"the",
"member",
"version",
"of",
"yourself",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L311-L316 | [
"def",
"me",
"(",
"self",
")",
":",
"self_id",
"=",
"self",
".",
"_state",
".",
"user",
".",
"id",
"return",
"self",
".",
"get_member",
"(",
"self_id",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.text_channels | List[:class:`TextChannel`]: A list of text channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom. | discord/guild.py | def text_channels(self):
"""List[:class:`TextChannel`]: A list of text channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
"""
r = [ch for ch in self._channels.values() if isinstance(ch, TextChannel)]
r.sort(key=lambda c: (... | def text_channels(self):
"""List[:class:`TextChannel`]: A list of text channels that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
"""
r = [ch for ch in self._channels.values() if isinstance(ch, TextChannel)]
r.sort(key=lambda c: (... | [
"List",
"[",
":",
"class",
":",
"TextChannel",
"]",
":",
"A",
"list",
"of",
"text",
"channels",
"that",
"belongs",
"to",
"this",
"guild",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L324-L331 | [
"def",
"text_channels",
"(",
"self",
")",
":",
"r",
"=",
"[",
"ch",
"for",
"ch",
"in",
"self",
".",
"_channels",
".",
"values",
"(",
")",
"if",
"isinstance",
"(",
"ch",
",",
"TextChannel",
")",
"]",
"r",
".",
"sort",
"(",
"key",
"=",
"lambda",
"c... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.categories | List[:class:`CategoryChannel`]: A list of categories that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom. | discord/guild.py | def categories(self):
"""List[:class:`CategoryChannel`]: A list of categories that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
"""
r = [ch for ch in self._channels.values() if isinstance(ch, CategoryChannel)]
r.sort(key=lambda c:... | def categories(self):
"""List[:class:`CategoryChannel`]: A list of categories that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
"""
r = [ch for ch in self._channels.values() if isinstance(ch, CategoryChannel)]
r.sort(key=lambda c:... | [
"List",
"[",
":",
"class",
":",
"CategoryChannel",
"]",
":",
"A",
"list",
"of",
"categories",
"that",
"belongs",
"to",
"this",
"guild",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L334-L341 | [
"def",
"categories",
"(",
"self",
")",
":",
"r",
"=",
"[",
"ch",
"for",
"ch",
"in",
"self",
".",
"_channels",
".",
"values",
"(",
")",
"if",
"isinstance",
"(",
"ch",
",",
"CategoryChannel",
")",
"]",
"r",
".",
"sort",
"(",
"key",
"=",
"lambda",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.by_category | Returns every :class:`CategoryChannel` and their associated channels.
These channels and categories are sorted in the official Discord UI order.
If the channels do not have a category, then the first element of the tuple is
``None``.
Returns
--------
List[Tuple[Optiona... | discord/guild.py | def by_category(self):
"""Returns every :class:`CategoryChannel` and their associated channels.
These channels and categories are sorted in the official Discord UI order.
If the channels do not have a category, then the first element of the tuple is
``None``.
Returns
-... | def by_category(self):
"""Returns every :class:`CategoryChannel` and their associated channels.
These channels and categories are sorted in the official Discord UI order.
If the channels do not have a category, then the first element of the tuple is
``None``.
Returns
-... | [
"Returns",
"every",
":",
"class",
":",
"CategoryChannel",
"and",
"their",
"associated",
"channels",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L343-L372 | [
"def",
"by_category",
"(",
"self",
")",
":",
"grouped",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"channel",
"in",
"self",
".",
"_channels",
".",
"values",
"(",
")",
":",
"if",
"isinstance",
"(",
"channel",
",",
"CategoryChannel",
")",
":",
"continue"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.system_channel | Optional[:class:`TextChannel`]: Returns the guild's channel used for system messages.
Currently this is only for new member joins. If no channel is set, then this returns ``None``. | discord/guild.py | def system_channel(self):
"""Optional[:class:`TextChannel`]: Returns the guild's channel used for system messages.
Currently this is only for new member joins. If no channel is set, then this returns ``None``.
"""
channel_id = self._system_channel_id
return channel_id and self._... | def system_channel(self):
"""Optional[:class:`TextChannel`]: Returns the guild's channel used for system messages.
Currently this is only for new member joins. If no channel is set, then this returns ``None``.
"""
channel_id = self._system_channel_id
return channel_id and self._... | [
"Optional",
"[",
":",
"class",
":",
"TextChannel",
"]",
":",
"Returns",
"the",
"guild",
"s",
"channel",
"used",
"for",
"system",
"messages",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L379-L385 | [
"def",
"system_channel",
"(",
"self",
")",
":",
"channel_id",
"=",
"self",
".",
"_system_channel_id",
"return",
"channel_id",
"and",
"self",
".",
"_channels",
".",
"get",
"(",
"channel_id",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.default_role | Gets the @everyone role that all members have by default. | discord/guild.py | def default_role(self):
"""Gets the @everyone role that all members have by default."""
return utils.find(lambda r: r.is_default(), self._roles.values()) | def default_role(self):
"""Gets the @everyone role that all members have by default."""
return utils.find(lambda r: r.is_default(), self._roles.values()) | [
"Gets",
"the"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L410-L412 | [
"def",
"default_role",
"(",
"self",
")",
":",
"return",
"utils",
".",
"find",
"(",
"lambda",
"r",
":",
"r",
".",
"is_default",
"(",
")",
",",
"self",
".",
"_roles",
".",
"values",
"(",
")",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.chunked | Returns a boolean indicating if the guild is "chunked".
A chunked guild means that :attr:`member_count` is equal to the
number of members stored in the internal :attr:`members` cache.
If this value returns ``False``, then you should request for
offline members. | discord/guild.py | def chunked(self):
"""Returns a boolean indicating if the guild is "chunked".
A chunked guild means that :attr:`member_count` is equal to the
number of members stored in the internal :attr:`members` cache.
If this value returns ``False``, then you should request for
offline mem... | def chunked(self):
"""Returns a boolean indicating if the guild is "chunked".
A chunked guild means that :attr:`member_count` is equal to the
number of members stored in the internal :attr:`members` cache.
If this value returns ``False``, then you should request for
offline mem... | [
"Returns",
"a",
"boolean",
"indicating",
"if",
"the",
"guild",
"is",
"chunked",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L515-L527 | [
"def",
"chunked",
"(",
"self",
")",
":",
"count",
"=",
"getattr",
"(",
"self",
",",
"'_member_count'",
",",
"None",
")",
"if",
"count",
"is",
"None",
":",
"return",
"False",
"return",
"count",
"==",
"len",
"(",
"self",
".",
"_members",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.shard_id | Returns the shard ID for this guild if applicable. | discord/guild.py | def shard_id(self):
"""Returns the shard ID for this guild if applicable."""
count = self._state.shard_count
if count is None:
return None
return (self.id >> 22) % count | def shard_id(self):
"""Returns the shard ID for this guild if applicable."""
count = self._state.shard_count
if count is None:
return None
return (self.id >> 22) % count | [
"Returns",
"the",
"shard",
"ID",
"for",
"this",
"guild",
"if",
"applicable",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L530-L535 | [
"def",
"shard_id",
"(",
"self",
")",
":",
"count",
"=",
"self",
".",
"_state",
".",
"shard_count",
"if",
"count",
"is",
"None",
":",
"return",
"None",
"return",
"(",
"self",
".",
"id",
">>",
"22",
")",
"%",
"count"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.get_member_named | Returns the first member found that matches the name provided.
The name can have an optional discriminator argument, e.g. "Jake#0001"
or "Jake" will both do the lookup. However the former will give a more
precise result. Note that the discriminator must have all 4 digits
for this to wor... | discord/guild.py | def get_member_named(self, name):
"""Returns the first member found that matches the name provided.
The name can have an optional discriminator argument, e.g. "Jake#0001"
or "Jake" will both do the lookup. However the former will give a more
precise result. Note that the discriminator m... | def get_member_named(self, name):
"""Returns the first member found that matches the name provided.
The name can have an optional discriminator argument, e.g. "Jake#0001"
or "Jake" will both do the lookup. However the former will give a more
precise result. Note that the discriminator m... | [
"Returns",
"the",
"first",
"member",
"found",
"that",
"matches",
"the",
"name",
"provided",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L542-L586 | [
"def",
"get_member_named",
"(",
"self",
",",
"name",
")",
":",
"result",
"=",
"None",
"members",
"=",
"self",
".",
"members",
"if",
"len",
"(",
"name",
")",
">",
"5",
"and",
"name",
"[",
"-",
"5",
"]",
"==",
"'#'",
":",
"# The 5 length is checking to s... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.create_text_channel | |coro|
Creates a :class:`TextChannel` for the guild.
Note that you need the :attr:`~Permissions.manage_channels` permission
to create the channel.
The ``overwrites`` parameter can be used to create a 'secret'
channel upon creation. This parameter expects a :class:`dict` of
... | discord/guild.py | async def create_text_channel(self, name, *, overwrites=None, category=None, reason=None, **options):
"""|coro|
Creates a :class:`TextChannel` for the guild.
Note that you need the :attr:`~Permissions.manage_channels` permission
to create the channel.
The ``overwrites`` parame... | async def create_text_channel(self, name, *, overwrites=None, category=None, reason=None, **options):
"""|coro|
Creates a :class:`TextChannel` for the guild.
Note that you need the :attr:`~Permissions.manage_channels` permission
to create the channel.
The ``overwrites`` parame... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L622-L705 | [
"async",
"def",
"create_text_channel",
"(",
"self",
",",
"name",
",",
"*",
",",
"overwrites",
"=",
"None",
",",
"category",
"=",
"None",
",",
"reason",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"data",
"=",
"await",
"self",
".",
"_create_channel... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.create_voice_channel | |coro|
This is similar to :meth:`create_text_channel` except makes a :class:`VoiceChannel` instead, in addition
to having the following new parameters.
Parameters
-----------
bitrate: :class:`int`
The channel's preferred audio bitrate in bits per second.
use... | discord/guild.py | async def create_voice_channel(self, name, *, overwrites=None, category=None, reason=None, **options):
"""|coro|
This is similar to :meth:`create_text_channel` except makes a :class:`VoiceChannel` instead, in addition
to having the following new parameters.
Parameters
---------... | async def create_voice_channel(self, name, *, overwrites=None, category=None, reason=None, **options):
"""|coro|
This is similar to :meth:`create_text_channel` except makes a :class:`VoiceChannel` instead, in addition
to having the following new parameters.
Parameters
---------... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L707-L725 | [
"async",
"def",
"create_voice_channel",
"(",
"self",
",",
"name",
",",
"*",
",",
"overwrites",
"=",
"None",
",",
"category",
"=",
"None",
",",
"reason",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"data",
"=",
"await",
"self",
".",
"_create_channe... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.create_category | |coro|
Same as :meth:`create_text_channel` except makes a :class:`CategoryChannel` instead.
.. note::
The ``category`` parameter is not supported in this function since categories
cannot have categories. | discord/guild.py | async def create_category(self, name, *, overwrites=None, reason=None):
"""|coro|
Same as :meth:`create_text_channel` except makes a :class:`CategoryChannel` instead.
.. note::
The ``category`` parameter is not supported in this function since categories
cannot have ca... | async def create_category(self, name, *, overwrites=None, reason=None):
"""|coro|
Same as :meth:`create_text_channel` except makes a :class:`CategoryChannel` instead.
.. note::
The ``category`` parameter is not supported in this function since categories
cannot have ca... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L727-L742 | [
"async",
"def",
"create_category",
"(",
"self",
",",
"name",
",",
"*",
",",
"overwrites",
"=",
"None",
",",
"reason",
"=",
"None",
")",
":",
"data",
"=",
"await",
"self",
".",
"_create_channel",
"(",
"name",
",",
"overwrites",
",",
"ChannelType",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.edit | |coro|
Edits the guild.
You must have the :attr:`~Permissions.manage_guild` permission
to edit the guild.
Parameters
----------
name: :class:`str`
The new name of the guild.
description: :class:`str`
The new description of the guild. Thi... | discord/guild.py | async def edit(self, *, reason=None, **fields):
"""|coro|
Edits the guild.
You must have the :attr:`~Permissions.manage_guild` permission
to edit the guild.
Parameters
----------
name: :class:`str`
The new name of the guild.
description: :cl... | async def edit(self, *, reason=None, **fields):
"""|coro|
Edits the guild.
You must have the :attr:`~Permissions.manage_guild` permission
to edit the guild.
Parameters
----------
name: :class:`str`
The new name of the guild.
description: :cl... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L779-L928 | [
"async",
"def",
"edit",
"(",
"self",
",",
"*",
",",
"reason",
"=",
"None",
",",
"*",
"*",
"fields",
")",
":",
"http",
"=",
"self",
".",
"_state",
".",
"http",
"try",
":",
"icon_bytes",
"=",
"fields",
"[",
"'icon'",
"]",
"except",
"KeyError",
":",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.fetch_member | |coro|
Retreives a :class:`Member` from a guild ID, and a member ID.
.. note::
This method is an API call. For general usage, consider :meth:`get_member` instead.
Parameters
-----------
member_id: :class:`int`
The member's ID to fetch from.
Ra... | discord/guild.py | async def fetch_member(self, member_id):
"""|coro|
Retreives a :class:`Member` from a guild ID, and a member ID.
.. note::
This method is an API call. For general usage, consider :meth:`get_member` instead.
Parameters
-----------
member_id: :class:`int`
... | async def fetch_member(self, member_id):
"""|coro|
Retreives a :class:`Member` from a guild ID, and a member ID.
.. note::
This method is an API call. For general usage, consider :meth:`get_member` instead.
Parameters
-----------
member_id: :class:`int`
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L930-L957 | [
"async",
"def",
"fetch_member",
"(",
"self",
",",
"member_id",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_member",
"(",
"self",
".",
"id",
",",
"member_id",
")",
"return",
"Member",
"(",
"data",
"=",
"data",
",",
"s... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.fetch_ban | |coro|
Retrieves the :class:`BanEntry` for a user, which is a namedtuple
with a ``user`` and ``reason`` field. See :meth:`bans` for more
information.
You must have the :attr:`~Permissions.ban_members` permission
to get this information.
Parameters
-----------
... | discord/guild.py | async def fetch_ban(self, user):
"""|coro|
Retrieves the :class:`BanEntry` for a user, which is a namedtuple
with a ``user`` and ``reason`` field. See :meth:`bans` for more
information.
You must have the :attr:`~Permissions.ban_members` permission
to get this informatio... | async def fetch_ban(self, user):
"""|coro|
Retrieves the :class:`BanEntry` for a user, which is a namedtuple
with a ``user`` and ``reason`` field. See :meth:`bans` for more
information.
You must have the :attr:`~Permissions.ban_members` permission
to get this informatio... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L959-L992 | [
"async",
"def",
"fetch_ban",
"(",
"self",
",",
"user",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_ban",
"(",
"user",
".",
"id",
",",
"self",
".",
"id",
")",
"return",
"BanEntry",
"(",
"user",
"=",
"User",
"(",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.bans | |coro|
Retrieves all the users that are banned from the guild.
This coroutine returns a :class:`list` of BanEntry objects, which is a
namedtuple with a ``user`` field to denote the :class:`User`
that got banned along with a ``reason`` field specifying
why the user was banned th... | discord/guild.py | async def bans(self):
"""|coro|
Retrieves all the users that are banned from the guild.
This coroutine returns a :class:`list` of BanEntry objects, which is a
namedtuple with a ``user`` field to denote the :class:`User`
that got banned along with a ``reason`` field specifying
... | async def bans(self):
"""|coro|
Retrieves all the users that are banned from the guild.
This coroutine returns a :class:`list` of BanEntry objects, which is a
namedtuple with a ``user`` field to denote the :class:`User`
that got banned along with a ``reason`` field specifying
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L994-L1023 | [
"async",
"def",
"bans",
"(",
"self",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_bans",
"(",
"self",
".",
"id",
")",
"return",
"[",
"BanEntry",
"(",
"user",
"=",
"User",
"(",
"state",
"=",
"self",
".",
"_state",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.prune_members | r"""|coro|
Prunes the guild from its inactive members.
The inactive members are denoted if they have not logged on in
``days`` number of days and they have no roles.
You must have the :attr:`~Permissions.kick_members` permission
to use this.
To check how many members ... | discord/guild.py | async def prune_members(self, *, days, compute_prune_count=True, reason=None):
r"""|coro|
Prunes the guild from its inactive members.
The inactive members are denoted if they have not logged on in
``days`` number of days and they have no roles.
You must have the :attr:`~Permis... | async def prune_members(self, *, days, compute_prune_count=True, reason=None):
r"""|coro|
Prunes the guild from its inactive members.
The inactive members are denoted if they have not logged on in
``days`` number of days and they have no roles.
You must have the :attr:`~Permis... | [
"r",
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1025-L1071 | [
"async",
"def",
"prune_members",
"(",
"self",
",",
"*",
",",
"days",
",",
"compute_prune_count",
"=",
"True",
",",
"reason",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"days",
",",
"int",
")",
":",
"raise",
"InvalidArgument",
"(",
"'Expected ... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.estimate_pruned_members | |coro|
Similar to :meth:`prune_members` except instead of actually
pruning members, it returns how many members it would prune
from the guild had it been called.
Parameters
-----------
days: :class:`int`
The number of days before counting as inactive.
... | discord/guild.py | async def estimate_pruned_members(self, *, days):
"""|coro|
Similar to :meth:`prune_members` except instead of actually
pruning members, it returns how many members it would prune
from the guild had it been called.
Parameters
-----------
days: :class:`int`
... | async def estimate_pruned_members(self, *, days):
"""|coro|
Similar to :meth:`prune_members` except instead of actually
pruning members, it returns how many members it would prune
from the guild had it been called.
Parameters
-----------
days: :class:`int`
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1094-L1125 | [
"async",
"def",
"estimate_pruned_members",
"(",
"self",
",",
"*",
",",
"days",
")",
":",
"if",
"not",
"isinstance",
"(",
"days",
",",
"int",
")",
":",
"raise",
"InvalidArgument",
"(",
"'Expected int for ``days``, received {0.__class__.__name__} instead.'",
".",
"for... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.invites | |coro|
Returns a list of all active instant invites from the guild.
You must have the :attr:`~Permissions.manage_guild` permission to get
this information.
Raises
-------
Forbidden
You do not have proper permissions to get the information.
HTTPExcep... | discord/guild.py | async def invites(self):
"""|coro|
Returns a list of all active instant invites from the guild.
You must have the :attr:`~Permissions.manage_guild` permission to get
this information.
Raises
-------
Forbidden
You do not have proper permissions to ge... | async def invites(self):
"""|coro|
Returns a list of all active instant invites from the guild.
You must have the :attr:`~Permissions.manage_guild` permission to get
this information.
Raises
-------
Forbidden
You do not have proper permissions to ge... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1127-L1156 | [
"async",
"def",
"invites",
"(",
"self",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"invites_from",
"(",
"self",
".",
"id",
")",
"result",
"=",
"[",
"]",
"for",
"invite",
"in",
"data",
":",
"channel",
"=",
"self",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.fetch_emojis | r"""|coro|
Retrieves all custom :class:`Emoji`\s from the guild.
.. note::
This method is an API call. For general usage, consider :attr:`emojis` instead.
Raises
---------
HTTPException
An error occurred fetching the emojis.
Returns
--... | discord/guild.py | async def fetch_emojis(self):
r"""|coro|
Retrieves all custom :class:`Emoji`\s from the guild.
.. note::
This method is an API call. For general usage, consider :attr:`emojis` instead.
Raises
---------
HTTPException
An error occurred fetching t... | async def fetch_emojis(self):
r"""|coro|
Retrieves all custom :class:`Emoji`\s from the guild.
.. note::
This method is an API call. For general usage, consider :attr:`emojis` instead.
Raises
---------
HTTPException
An error occurred fetching t... | [
"r",
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1158-L1178 | [
"async",
"def",
"fetch_emojis",
"(",
"self",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_all_custom_emojis",
"(",
"self",
".",
"id",
")",
"return",
"[",
"Emoji",
"(",
"guild",
"=",
"self",
",",
"state",
"=",
"self",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.fetch_emoji | |coro|
Retrieves a custom :class:`Emoji` from the guild.
.. note::
This method is an API call.
For general usage, consider iterating over :attr:`emojis` instead.
Parameters
-------------
emoji_id: :class:`int`
The emoji's ID.
Raise... | discord/guild.py | async def fetch_emoji(self, emoji_id):
"""|coro|
Retrieves a custom :class:`Emoji` from the guild.
.. note::
This method is an API call.
For general usage, consider iterating over :attr:`emojis` instead.
Parameters
-------------
emoji_id: :clas... | async def fetch_emoji(self, emoji_id):
"""|coro|
Retrieves a custom :class:`Emoji` from the guild.
.. note::
This method is an API call.
For general usage, consider iterating over :attr:`emojis` instead.
Parameters
-------------
emoji_id: :clas... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1180-L1208 | [
"async",
"def",
"fetch_emoji",
"(",
"self",
",",
"emoji_id",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_custom_emoji",
"(",
"self",
".",
"id",
",",
"emoji_id",
")",
"return",
"Emoji",
"(",
"guild",
"=",
"self",
",",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.create_custom_emoji | r"""|coro|
Creates a custom :class:`Emoji` for the guild.
There is currently a limit of 50 static and animated emojis respectively per guild,
unless the guild has the ``MORE_EMOJI`` feature which extends the limit to 200.
You must have the :attr:`~Permissions.manage_emojis` permission... | discord/guild.py | async def create_custom_emoji(self, *, name, image, roles=None, reason=None):
r"""|coro|
Creates a custom :class:`Emoji` for the guild.
There is currently a limit of 50 static and animated emojis respectively per guild,
unless the guild has the ``MORE_EMOJI`` feature which extends the ... | async def create_custom_emoji(self, *, name, image, roles=None, reason=None):
r"""|coro|
Creates a custom :class:`Emoji` for the guild.
There is currently a limit of 50 static and animated emojis respectively per guild,
unless the guild has the ``MORE_EMOJI`` feature which extends the ... | [
"r",
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1210-L1250 | [
"async",
"def",
"create_custom_emoji",
"(",
"self",
",",
"*",
",",
"name",
",",
"image",
",",
"roles",
"=",
"None",
",",
"reason",
"=",
"None",
")",
":",
"img",
"=",
"utils",
".",
"_bytes_to_base64_data",
"(",
"image",
")",
"if",
"roles",
":",
"roles",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.create_role | |coro|
Creates a :class:`Role` for the guild.
All fields are optional.
You must have the :attr:`~Permissions.manage_roles` permission to
do this.
Parameters
-----------
name: :class:`str`
The role name. Defaults to 'new role'.
permissions: ... | discord/guild.py | async def create_role(self, *, reason=None, **fields):
"""|coro|
Creates a :class:`Role` for the guild.
All fields are optional.
You must have the :attr:`~Permissions.manage_roles` permission to
do this.
Parameters
-----------
name: :class:`str`
... | async def create_role(self, *, reason=None, **fields):
"""|coro|
Creates a :class:`Role` for the guild.
All fields are optional.
You must have the :attr:`~Permissions.manage_roles` permission to
do this.
Parameters
-----------
name: :class:`str`
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1252-L1318 | [
"async",
"def",
"create_role",
"(",
"self",
",",
"*",
",",
"reason",
"=",
"None",
",",
"*",
"*",
"fields",
")",
":",
"try",
":",
"perms",
"=",
"fields",
".",
"pop",
"(",
"'permissions'",
")",
"except",
"KeyError",
":",
"fields",
"[",
"'permissions'",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.kick | |coro|
Kicks a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.kick_members` permission to
do this.
Parameters
-----------
user: :class:`abc.Snowflake`
The user to kick from their guild.... | discord/guild.py | async def kick(self, user, *, reason=None):
"""|coro|
Kicks a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.kick_members` permission to
do this.
Parameters
-----------
user: :class:`abc.Sn... | async def kick(self, user, *, reason=None):
"""|coro|
Kicks a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.kick_members` permission to
do this.
Parameters
-----------
user: :class:`abc.Sn... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1320-L1344 | [
"async",
"def",
"kick",
"(",
"self",
",",
"user",
",",
"*",
",",
"reason",
"=",
"None",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"kick",
"(",
"user",
".",
"id",
",",
"self",
".",
"id",
",",
"reason",
"=",
"reason",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.ban | |coro|
Bans a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.ban_members` permission to
do this.
Parameters
-----------
user: :class:`abc.Snowflake`
The user to ban from their guild.
... | discord/guild.py | async def ban(self, user, *, reason=None, delete_message_days=1):
"""|coro|
Bans a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.ban_members` permission to
do this.
Parameters
-----------
... | async def ban(self, user, *, reason=None, delete_message_days=1):
"""|coro|
Bans a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.ban_members` permission to
do this.
Parameters
-----------
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1346-L1373 | [
"async",
"def",
"ban",
"(",
"self",
",",
"user",
",",
"*",
",",
"reason",
"=",
"None",
",",
"delete_message_days",
"=",
"1",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"ban",
"(",
"user",
".",
"id",
",",
"self",
".",
"id",
",",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.unban | |coro|
Unbans a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.ban_members` permission to
do this.
Parameters
-----------
user: :class:`abc.Snowflake`
The user to unban.
reason:... | discord/guild.py | async def unban(self, user, *, reason=None):
"""|coro|
Unbans a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.ban_members` permission to
do this.
Parameters
-----------
user: :class:`abc.S... | async def unban(self, user, *, reason=None):
"""|coro|
Unbans a user from the guild.
The user must meet the :class:`abc.Snowflake` abc.
You must have the :attr:`~Permissions.ban_members` permission to
do this.
Parameters
-----------
user: :class:`abc.S... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1375-L1399 | [
"async",
"def",
"unban",
"(",
"self",
",",
"user",
",",
"*",
",",
"reason",
"=",
"None",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"unban",
"(",
"user",
".",
"id",
",",
"self",
".",
"id",
",",
"reason",
"=",
"reason",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.vanity_invite | |coro|
Returns the guild's special vanity invite.
The guild must be partnered, i.e. have 'VANITY_URL' in
:attr:`~Guild.features`.
You must have the :attr:`~Permissions.manage_guild` permission to use
this as well.
Raises
-------
Forbidden
Y... | discord/guild.py | async def vanity_invite(self):
"""|coro|
Returns the guild's special vanity invite.
The guild must be partnered, i.e. have 'VANITY_URL' in
:attr:`~Guild.features`.
You must have the :attr:`~Permissions.manage_guild` permission to use
this as well.
Raises
... | async def vanity_invite(self):
"""|coro|
Returns the guild's special vanity invite.
The guild must be partnered, i.e. have 'VANITY_URL' in
:attr:`~Guild.features`.
You must have the :attr:`~Permissions.manage_guild` permission to use
this as well.
Raises
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1401-L1438 | [
"async",
"def",
"vanity_invite",
"(",
"self",
")",
":",
"# we start with { code: abc }",
"payload",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_vanity_code",
"(",
"self",
".",
"id",
")",
"# get the vanity URL channel since default channels aren't",
"# ... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.ack | |coro|
Marks every message in this guild as read.
The user must not be a bot user.
Raises
-------
HTTPException
Acking failed.
ClientException
You must not be a bot user. | discord/guild.py | def ack(self):
"""|coro|
Marks every message in this guild as read.
The user must not be a bot user.
Raises
-------
HTTPException
Acking failed.
ClientException
You must not be a bot user.
"""
state = self._state
... | def ack(self):
"""|coro|
Marks every message in this guild as read.
The user must not be a bot user.
Raises
-------
HTTPException
Acking failed.
ClientException
You must not be a bot user.
"""
state = self._state
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1440-L1458 | [
"def",
"ack",
"(",
"self",
")",
":",
"state",
"=",
"self",
".",
"_state",
"if",
"state",
".",
"is_bot",
":",
"raise",
"ClientException",
"(",
"'Must not be a bot account to ack messages.'",
")",
"return",
"state",
".",
"http",
".",
"ack_guild",
"(",
"self",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.audit_logs | Return an :class:`AsyncIterator` that enables receiving the guild's audit logs.
You must have the :attr:`~Permissions.view_audit_log` permission to use this.
Examples
----------
Getting the first 100 entries: ::
async for entry in guild.audit_logs(limit=100):
... | discord/guild.py | def audit_logs(self, *, limit=100, before=None, after=None, oldest_first=None, user=None, action=None):
"""Return an :class:`AsyncIterator` that enables receiving the guild's audit logs.
You must have the :attr:`~Permissions.view_audit_log` permission to use this.
Examples
----------
... | def audit_logs(self, *, limit=100, before=None, after=None, oldest_first=None, user=None, action=None):
"""Return an :class:`AsyncIterator` that enables receiving the guild's audit logs.
You must have the :attr:`~Permissions.view_audit_log` permission to use this.
Examples
----------
... | [
"Return",
"an",
":",
"class",
":",
"AsyncIterator",
"that",
"enables",
"receiving",
"the",
"guild",
"s",
"audit",
"logs",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1460-L1520 | [
"def",
"audit_logs",
"(",
"self",
",",
"*",
",",
"limit",
"=",
"100",
",",
"before",
"=",
"None",
",",
"after",
"=",
"None",
",",
"oldest_first",
"=",
"None",
",",
"user",
"=",
"None",
",",
"action",
"=",
"None",
")",
":",
"if",
"user",
":",
"use... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Guild.widget | |coro|
Returns the widget of the guild.
.. note::
The guild must have the widget enabled to get this information.
Raises
-------
Forbidden
The widget for this guild is disabled.
HTTPException
Retrieving the widget failed.
R... | discord/guild.py | async def widget(self):
"""|coro|
Returns the widget of the guild.
.. note::
The guild must have the widget enabled to get this information.
Raises
-------
Forbidden
The widget for this guild is disabled.
HTTPException
Retri... | async def widget(self):
"""|coro|
Returns the widget of the guild.
.. note::
The guild must have the widget enabled to get this information.
Raises
-------
Forbidden
The widget for this guild is disabled.
HTTPException
Retri... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1522-L1545 | [
"async",
"def",
"widget",
"(",
"self",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_widget",
"(",
"self",
".",
"id",
")",
"return",
"Widget",
"(",
"state",
"=",
"self",
".",
"_state",
",",
"data",
"=",
"data",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | AutoShardedClient.latency | :class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This operates similarly to :meth:`.Client.latency` except it uses the average
latency of every shard's latency. To get a list of shard latency, check the
:attr:`latencies` property. Returns ``nan`` if there are... | discord/shard.py | def latency(self):
""":class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This operates similarly to :meth:`.Client.latency` except it uses the average
latency of every shard's latency. To get a list of shard latency, check the
:attr:`latencies` property... | def latency(self):
""":class:`float`: Measures latency between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This operates similarly to :meth:`.Client.latency` except it uses the average
latency of every shard's latency. To get a list of shard latency, check the
:attr:`latencies` property... | [
":",
"class",
":",
"float",
":",
"Measures",
"latency",
"between",
"a",
"HEARTBEAT",
"and",
"a",
"HEARTBEAT_ACK",
"in",
"seconds",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/shard.py#L163-L172 | [
"def",
"latency",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"shards",
":",
"return",
"float",
"(",
"'nan'",
")",
"return",
"sum",
"(",
"latency",
"for",
"_",
",",
"latency",
"in",
"self",
".",
"latencies",
")",
"/",
"len",
"(",
"self",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | AutoShardedClient.latencies | List[Tuple[:class:`int`, :class:`float`]]: A list of latencies between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This returns a list of tuples with elements ``(shard_id, latency)``. | discord/shard.py | def latencies(self):
"""List[Tuple[:class:`int`, :class:`float`]]: A list of latencies between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This returns a list of tuples with elements ``(shard_id, latency)``.
"""
return [(shard_id, shard.ws.latency) for shard_id, shard in self.shards.ite... | def latencies(self):
"""List[Tuple[:class:`int`, :class:`float`]]: A list of latencies between a HEARTBEAT and a HEARTBEAT_ACK in seconds.
This returns a list of tuples with elements ``(shard_id, latency)``.
"""
return [(shard_id, shard.ws.latency) for shard_id, shard in self.shards.ite... | [
"List",
"[",
"Tuple",
"[",
":",
"class",
":",
"int",
":",
"class",
":",
"float",
"]]",
":",
"A",
"list",
"of",
"latencies",
"between",
"a",
"HEARTBEAT",
"and",
"a",
"HEARTBEAT_ACK",
"in",
"seconds",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/shard.py#L175-L180 | [
"def",
"latencies",
"(",
"self",
")",
":",
"return",
"[",
"(",
"shard_id",
",",
"shard",
".",
"ws",
".",
"latency",
")",
"for",
"shard_id",
",",
"shard",
"in",
"self",
".",
"shards",
".",
"items",
"(",
")",
"]"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | AutoShardedClient.request_offline_members | r"""|coro|
Requests previously offline members from the guild to be filled up
into the :attr:`Guild.members` cache. This function is usually not
called. It should only be used if you have the ``fetch_offline_members``
parameter set to ``False``.
When the client logs on and conn... | discord/shard.py | async def request_offline_members(self, *guilds):
r"""|coro|
Requests previously offline members from the guild to be filled up
into the :attr:`Guild.members` cache. This function is usually not
called. It should only be used if you have the ``fetch_offline_members``
parameter s... | async def request_offline_members(self, *guilds):
r"""|coro|
Requests previously offline members from the guild to be filled up
into the :attr:`Guild.members` cache. This function is usually not
called. It should only be used if you have the ``fetch_offline_members``
parameter s... | [
"r",
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/shard.py#L182-L211 | [
"async",
"def",
"request_offline_members",
"(",
"self",
",",
"*",
"guilds",
")",
":",
"if",
"any",
"(",
"not",
"g",
".",
"large",
"or",
"g",
".",
"unavailable",
"for",
"g",
"in",
"guilds",
")",
":",
"raise",
"InvalidArgument",
"(",
"'An unavailable or non-... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | AutoShardedClient.close | |coro|
Closes the connection to discord. | discord/shard.py | async def close(self):
"""|coro|
Closes the connection to discord.
"""
if self.is_closed():
return
self._closed = True
for vc in self.voice_clients:
try:
await vc.disconnect()
except Exception:
pass
... | async def close(self):
"""|coro|
Closes the connection to discord.
"""
if self.is_closed():
return
self._closed = True
for vc in self.voice_clients:
try:
await vc.disconnect()
except Exception:
pass
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/shard.py#L275-L295 | [
"async",
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_closed",
"(",
")",
":",
"return",
"self",
".",
"_closed",
"=",
"True",
"for",
"vc",
"in",
"self",
".",
"voice_clients",
":",
"try",
":",
"await",
"vc",
".",
"disconnect",
"(",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | AutoShardedClient.change_presence | |coro|
Changes the client's presence.
The activity parameter is a :class:`Activity` object (not a string) that represents
the activity being done currently. This could also be the slimmed down versions,
:class:`Game` and :class:`Streaming`.
Example: ::
game = disc... | discord/shard.py | async def change_presence(self, *, activity=None, status=None, afk=False, shard_id=None):
"""|coro|
Changes the client's presence.
The activity parameter is a :class:`Activity` object (not a string) that represents
the activity being done currently. This could also be the slimmed down ... | async def change_presence(self, *, activity=None, status=None, afk=False, shard_id=None):
"""|coro|
Changes the client's presence.
The activity parameter is a :class:`Activity` object (not a string) that represents
the activity being done currently. This could also be the slimmed down ... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/shard.py#L297-L359 | [
"async",
"def",
"change_presence",
"(",
"self",
",",
"*",
",",
"activity",
"=",
"None",
",",
"status",
"=",
"None",
",",
"afk",
"=",
"False",
",",
"shard_id",
"=",
"None",
")",
":",
"if",
"status",
"is",
"None",
":",
"status",
"=",
"'online'",
"statu... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Role.members | Returns a :class:`list` of :class:`Member` with this role. | discord/role.py | def members(self):
"""Returns a :class:`list` of :class:`Member` with this role."""
all_members = self.guild.members
if self.is_default():
return all_members
role_id = self.id
return [member for member in all_members if member._roles.has(role_id)] | def members(self):
"""Returns a :class:`list` of :class:`Member` with this role."""
all_members = self.guild.members
if self.is_default():
return all_members
role_id = self.id
return [member for member in all_members if member._roles.has(role_id)] | [
"Returns",
"a",
":",
"class",
":",
"list",
"of",
":",
"class",
":",
"Member",
"with",
"this",
"role",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/role.py#L170-L177 | [
"def",
"members",
"(",
"self",
")",
":",
"all_members",
"=",
"self",
".",
"guild",
".",
"members",
"if",
"self",
".",
"is_default",
"(",
")",
":",
"return",
"all_members",
"role_id",
"=",
"self",
".",
"id",
"return",
"[",
"member",
"for",
"member",
"in... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Role.edit | |coro|
Edits the role.
You must have the :attr:`~Permissions.manage_roles` permission to
use this.
All fields are optional.
Parameters
-----------
name: :class:`str`
The new role name to change to.
permissions: :class:`Permissions`
... | discord/role.py | async def edit(self, *, reason=None, **fields):
"""|coro|
Edits the role.
You must have the :attr:`~Permissions.manage_roles` permission to
use this.
All fields are optional.
Parameters
-----------
name: :class:`str`
The new role name to ch... | async def edit(self, *, reason=None, **fields):
"""|coro|
Edits the role.
You must have the :attr:`~Permissions.manage_roles` permission to
use this.
All fields are optional.
Parameters
-----------
name: :class:`str`
The new role name to ch... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/role.py#L202-L260 | [
"async",
"def",
"edit",
"(",
"self",
",",
"*",
",",
"reason",
"=",
"None",
",",
"*",
"*",
"fields",
")",
":",
"position",
"=",
"fields",
".",
"get",
"(",
"'position'",
")",
"if",
"position",
"is",
"not",
"None",
":",
"await",
"self",
".",
"_move",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Role.delete | |coro|
Deletes the role.
You must have the :attr:`~Permissions.manage_roles` permission to
use this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this role. Shows up on the audit log.
Raises
--------
... | discord/role.py | async def delete(self, *, reason=None):
"""|coro|
Deletes the role.
You must have the :attr:`~Permissions.manage_roles` permission to
use this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this role. Shows up on the ... | async def delete(self, *, reason=None):
"""|coro|
Deletes the role.
You must have the :attr:`~Permissions.manage_roles` permission to
use this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this role. Shows up on the ... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/role.py#L262-L283 | [
"async",
"def",
"delete",
"(",
"self",
",",
"*",
",",
"reason",
"=",
"None",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"delete_role",
"(",
"self",
".",
"guild",
".",
"id",
",",
"self",
".",
"id",
",",
"reason",
"=",
"reason",
")... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Blueprint.group | Create a list of blueprints, optionally grouping them under a
general URL prefix.
:param blueprints: blueprints to be registered as a group
:param url_prefix: URL route to be prepended to all sub-prefixes | sanic/blueprints.py | def group(*blueprints, url_prefix=""):
"""
Create a list of blueprints, optionally grouping them under a
general URL prefix.
:param blueprints: blueprints to be registered as a group
:param url_prefix: URL route to be prepended to all sub-prefixes
"""
def chain(... | def group(*blueprints, url_prefix=""):
"""
Create a list of blueprints, optionally grouping them under a
general URL prefix.
:param blueprints: blueprints to be registered as a group
:param url_prefix: URL route to be prepended to all sub-prefixes
"""
def chain(... | [
"Create",
"a",
"list",
"of",
"blueprints",
"optionally",
"grouping",
"them",
"under",
"a",
"general",
"URL",
"prefix",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L68-L93 | [
"def",
"group",
"(",
"*",
"blueprints",
",",
"url_prefix",
"=",
"\"\"",
")",
":",
"def",
"chain",
"(",
"nested",
")",
":",
"\"\"\"itertools.chain() but leaves strings untouched\"\"\"",
"for",
"i",
"in",
"nested",
":",
"if",
"isinstance",
"(",
"i",
",",
"(",
... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.register | Register the blueprint to the sanic app.
:param app: Instance of :class:`sanic.app.Sanic` class
:param options: Options to be used while registering the
blueprint into the app.
*url_prefix* - URL Prefix to override the blueprint prefix | sanic/blueprints.py | def register(self, app, options):
"""
Register the blueprint to the sanic app.
:param app: Instance of :class:`sanic.app.Sanic` class
:param options: Options to be used while registering the
blueprint into the app.
*url_prefix* - URL Prefix to override the bluepr... | def register(self, app, options):
"""
Register the blueprint to the sanic app.
:param app: Instance of :class:`sanic.app.Sanic` class
:param options: Options to be used while registering the
blueprint into the app.
*url_prefix* - URL Prefix to override the bluepr... | [
"Register",
"the",
"blueprint",
"to",
"the",
"sanic",
"app",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L95-L164 | [
"def",
"register",
"(",
"self",
",",
"app",
",",
"options",
")",
":",
"url_prefix",
"=",
"options",
".",
"get",
"(",
"\"url_prefix\"",
",",
"self",
".",
"url_prefix",
")",
"# Routes",
"for",
"future",
"in",
"self",
".",
"routes",
":",
"# attach the bluepri... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.route | Create a blueprint route from a decorated function.
:param uri: endpoint at which the route will be accessible.
:param methods: list of acceptable HTTP methods.
:param host: IP Address of FQDN for the sanic server to use.
:param strict_slashes: Enforce the API urls are requested with a
... | sanic/blueprints.py | def route(
self,
uri,
methods=frozenset({"GET"}),
host=None,
strict_slashes=None,
stream=False,
version=None,
name=None,
):
"""Create a blueprint route from a decorated function.
:param uri: endpoint at which the route will be accessib... | def route(
self,
uri,
methods=frozenset({"GET"}),
host=None,
strict_slashes=None,
stream=False,
version=None,
name=None,
):
"""Create a blueprint route from a decorated function.
:param uri: endpoint at which the route will be accessib... | [
"Create",
"a",
"blueprint",
"route",
"from",
"a",
"decorated",
"function",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L166-L207 | [
"def",
"route",
"(",
"self",
",",
"uri",
",",
"methods",
"=",
"frozenset",
"(",
"{",
"\"GET\"",
"}",
")",
",",
"host",
"=",
"None",
",",
"strict_slashes",
"=",
"None",
",",
"stream",
"=",
"False",
",",
"version",
"=",
"None",
",",
"name",
"=",
"Non... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.websocket | Create a blueprint websocket route from a decorated function.
:param uri: endpoint at which the route will be accessible.
:param host: IP Address of FQDN for the sanic server to use.
:param strict_slashes: Enforce the API urls are requested with a
training */*
:param version... | sanic/blueprints.py | def websocket(
self, uri, host=None, strict_slashes=None, version=None, name=None
):
"""Create a blueprint websocket route from a decorated function.
:param uri: endpoint at which the route will be accessible.
:param host: IP Address of FQDN for the sanic server to use.
:par... | def websocket(
self, uri, host=None, strict_slashes=None, version=None, name=None
):
"""Create a blueprint websocket route from a decorated function.
:param uri: endpoint at which the route will be accessible.
:param host: IP Address of FQDN for the sanic server to use.
:par... | [
"Create",
"a",
"blueprint",
"websocket",
"route",
"from",
"a",
"decorated",
"function",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L260-L282 | [
"def",
"websocket",
"(",
"self",
",",
"uri",
",",
"host",
"=",
"None",
",",
"strict_slashes",
"=",
"None",
",",
"version",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"strict_slashes",
"is",
"None",
":",
"strict_slashes",
"=",
"self",
".",
... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.add_websocket_route | Create a blueprint websocket route from a function.
:param handler: function for handling uri requests. Accepts function,
or class instance with a view_class method.
:param uri: endpoint at which the route will be accessible.
:param host: IP Address of FQDN for the sanic... | sanic/blueprints.py | def add_websocket_route(
self, handler, uri, host=None, version=None, name=None
):
"""Create a blueprint websocket route from a function.
:param handler: function for handling uri requests. Accepts function,
or class instance with a view_class method.
:param ... | def add_websocket_route(
self, handler, uri, host=None, version=None, name=None
):
"""Create a blueprint websocket route from a function.
:param handler: function for handling uri requests. Accepts function,
or class instance with a view_class method.
:param ... | [
"Create",
"a",
"blueprint",
"websocket",
"route",
"from",
"a",
"function",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L284-L298 | [
"def",
"add_websocket_route",
"(",
"self",
",",
"handler",
",",
"uri",
",",
"host",
"=",
"None",
",",
"version",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"self",
".",
"websocket",
"(",
"uri",
"=",
"uri",
",",
"host",
"=",
"host",
",",
"vers... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.listener | Create a listener from a decorated function.
:param event: Event to listen to. | sanic/blueprints.py | def listener(self, event):
"""Create a listener from a decorated function.
:param event: Event to listen to.
"""
def decorator(listener):
self.listeners[event].append(listener)
return listener
return decorator | def listener(self, event):
"""Create a listener from a decorated function.
:param event: Event to listen to.
"""
def decorator(listener):
self.listeners[event].append(listener)
return listener
return decorator | [
"Create",
"a",
"listener",
"from",
"a",
"decorated",
"function",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L300-L310 | [
"def",
"listener",
"(",
"self",
",",
"event",
")",
":",
"def",
"decorator",
"(",
"listener",
")",
":",
"self",
".",
"listeners",
"[",
"event",
"]",
".",
"append",
"(",
"listener",
")",
"return",
"listener",
"return",
"decorator"
] | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.middleware | Create a blueprint middleware from a decorated function.
:param args: Positional arguments to be used while invoking the
middleware
:param kwargs: optional keyword args that can be used with the
middleware. | sanic/blueprints.py | def middleware(self, *args, **kwargs):
"""
Create a blueprint middleware from a decorated function.
:param args: Positional arguments to be used while invoking the
middleware
:param kwargs: optional keyword args that can be used with the
middleware.
"""
... | def middleware(self, *args, **kwargs):
"""
Create a blueprint middleware from a decorated function.
:param args: Positional arguments to be used while invoking the
middleware
:param kwargs: optional keyword args that can be used with the
middleware.
"""
... | [
"Create",
"a",
"blueprint",
"middleware",
"from",
"a",
"decorated",
"function",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L312-L339 | [
"def",
"middleware",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"register_middleware",
"(",
"_middleware",
")",
":",
"future_middleware",
"=",
"FutureMiddleware",
"(",
"_middleware",
",",
"args",
",",
"kwargs",
")",
"self",
".... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.exception | This method enables the process of creating a global exception
handler for the current blueprint under question.
:param args: List of Python exceptions to be caught by the handler
:param kwargs: Additional optional arguments to be passed to the
exception handler
:return a d... | sanic/blueprints.py | def exception(self, *args, **kwargs):
"""
This method enables the process of creating a global exception
handler for the current blueprint under question.
:param args: List of Python exceptions to be caught by the handler
:param kwargs: Additional optional arguments to be passed... | def exception(self, *args, **kwargs):
"""
This method enables the process of creating a global exception
handler for the current blueprint under question.
:param args: List of Python exceptions to be caught by the handler
:param kwargs: Additional optional arguments to be passed... | [
"This",
"method",
"enables",
"the",
"process",
"of",
"creating",
"a",
"global",
"exception",
"handler",
"for",
"the",
"current",
"blueprint",
"under",
"question",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L341-L359 | [
"def",
"exception",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"handler",
")",
":",
"exception",
"=",
"FutureException",
"(",
"handler",
",",
"args",
",",
"kwargs",
")",
"self",
".",
"exceptions",
".",
... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.static | Create a blueprint static route from a decorated function.
:param uri: endpoint at which the route will be accessible.
:param file_or_directory: Static asset. | sanic/blueprints.py | def static(self, uri, file_or_directory, *args, **kwargs):
"""Create a blueprint static route from a decorated function.
:param uri: endpoint at which the route will be accessible.
:param file_or_directory: Static asset.
"""
name = kwargs.pop("name", "static")
if not nam... | def static(self, uri, file_or_directory, *args, **kwargs):
"""Create a blueprint static route from a decorated function.
:param uri: endpoint at which the route will be accessible.
:param file_or_directory: Static asset.
"""
name = kwargs.pop("name", "static")
if not nam... | [
"Create",
"a",
"blueprint",
"static",
"route",
"from",
"a",
"decorated",
"function",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L361-L377 | [
"def",
"static",
"(",
"self",
",",
"uri",
",",
"file_or_directory",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"kwargs",
".",
"pop",
"(",
"\"name\"",
",",
"\"static\"",
")",
"if",
"not",
"name",
".",
"startswith",
"(",
"self",
... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Blueprint.get | Add an API URL under the **GET** *HTTP* method
:param uri: URL to be tagged to **GET** method of *HTTP*
:param host: Host IP or FQDN for the service to use
:param strict_slashes: Instruct :class:`sanic.app.Sanic` to check
if the request URLs need to terminate with a */*
:par... | sanic/blueprints.py | def get(
self, uri, host=None, strict_slashes=None, version=None, name=None
):
"""
Add an API URL under the **GET** *HTTP* method
:param uri: URL to be tagged to **GET** method of *HTTP*
:param host: Host IP or FQDN for the service to use
:param strict_slashes: Instr... | def get(
self, uri, host=None, strict_slashes=None, version=None, name=None
):
"""
Add an API URL under the **GET** *HTTP* method
:param uri: URL to be tagged to **GET** method of *HTTP*
:param host: Host IP or FQDN for the service to use
:param strict_slashes: Instr... | [
"Add",
"an",
"API",
"URL",
"under",
"the",
"**",
"GET",
"**",
"*",
"HTTP",
"*",
"method"
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/blueprints.py#L380-L401 | [
"def",
"get",
"(",
"self",
",",
"uri",
",",
"host",
"=",
"None",
",",
"strict_slashes",
"=",
"None",
",",
"version",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"self",
".",
"route",
"(",
"uri",
",",
"methods",
"=",
"frozenset",
"(",... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | add_status_code | Decorator used for adding exceptions to :class:`SanicException`. | sanic/exceptions.py | def add_status_code(code):
"""
Decorator used for adding exceptions to :class:`SanicException`.
"""
def class_decorator(cls):
cls.status_code = code
_sanic_exceptions[code] = cls
return cls
return class_decorator | def add_status_code(code):
"""
Decorator used for adding exceptions to :class:`SanicException`.
"""
def class_decorator(cls):
cls.status_code = code
_sanic_exceptions[code] = cls
return cls
return class_decorator | [
"Decorator",
"used",
"for",
"adding",
"exceptions",
"to",
":",
"class",
":",
"SanicException",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/exceptions.py#L124-L134 | [
"def",
"add_status_code",
"(",
"code",
")",
":",
"def",
"class_decorator",
"(",
"cls",
")",
":",
"cls",
".",
"status_code",
"=",
"code",
"_sanic_exceptions",
"[",
"code",
"]",
"=",
"cls",
"return",
"cls",
"return",
"class_decorator"
] | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | abort | Raise an exception based on SanicException. Returns the HTTP response
message appropriate for the given status code, unless provided.
:param status_code: The HTTP status code to return.
:param message: The HTTP response body. Defaults to the messages
in response.py for the given status ... | sanic/exceptions.py | def abort(status_code, message=None):
"""
Raise an exception based on SanicException. Returns the HTTP response
message appropriate for the given status code, unless provided.
:param status_code: The HTTP status code to return.
:param message: The HTTP response body. Defaults to the messages
... | def abort(status_code, message=None):
"""
Raise an exception based on SanicException. Returns the HTTP response
message appropriate for the given status code, unless provided.
:param status_code: The HTTP status code to return.
:param message: The HTTP response body. Defaults to the messages
... | [
"Raise",
"an",
"exception",
"based",
"on",
"SanicException",
".",
"Returns",
"the",
"HTTP",
"response",
"message",
"appropriate",
"for",
"the",
"given",
"status",
"code",
"unless",
"provided",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/exceptions.py#L284-L298 | [
"def",
"abort",
"(",
"status_code",
",",
"message",
"=",
"None",
")",
":",
"if",
"message",
"is",
"None",
":",
"message",
"=",
"STATUS_CODES",
".",
"get",
"(",
"status_code",
")",
"# These are stored as bytes in the STATUS_CODES dict",
"message",
"=",
"message",
... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Sanic.add_task | Schedule a task to run later, after the loop has started.
Different from asyncio.ensure_future in that it does not
also return a future, and the actual ensure_future call
is delayed until before server start.
:param task: future, couroutine or awaitable | sanic/app.py | def add_task(self, task):
"""Schedule a task to run later, after the loop has started.
Different from asyncio.ensure_future in that it does not
also return a future, and the actual ensure_future call
is delayed until before server start.
:param task: future, couroutine or awaita... | def add_task(self, task):
"""Schedule a task to run later, after the loop has started.
Different from asyncio.ensure_future in that it does not
also return a future, and the actual ensure_future call
is delayed until before server start.
:param task: future, couroutine or awaita... | [
"Schedule",
"a",
"task",
"to",
"run",
"later",
"after",
"the",
"loop",
"has",
"started",
".",
"Different",
"from",
"asyncio",
".",
"ensure_future",
"in",
"that",
"it",
"does",
"not",
"also",
"return",
"a",
"future",
"and",
"the",
"actual",
"ensure_future",
... | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/app.py#L94-L120 | [
"def",
"add_task",
"(",
"self",
",",
"task",
")",
":",
"try",
":",
"if",
"callable",
"(",
"task",
")",
":",
"try",
":",
"self",
".",
"loop",
".",
"create_task",
"(",
"task",
"(",
"self",
")",
")",
"except",
"TypeError",
":",
"self",
".",
"loop",
... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Sanic.route | Decorate a function to be registered as a route
:param uri: path of the URL
:param methods: list or tuple of methods allowed
:param host:
:param strict_slashes:
:param stream:
:param version:
:param name: user defined route name for url_for
:return: decor... | sanic/app.py | def route(
self,
uri,
methods=frozenset({"GET"}),
host=None,
strict_slashes=None,
stream=False,
version=None,
name=None,
):
"""Decorate a function to be registered as a route
:param uri: path of the URL
:param methods: list or ... | def route(
self,
uri,
methods=frozenset({"GET"}),
host=None,
strict_slashes=None,
stream=False,
version=None,
name=None,
):
"""Decorate a function to be registered as a route
:param uri: path of the URL
:param methods: list or ... | [
"Decorate",
"a",
"function",
"to",
"be",
"registered",
"as",
"a",
"route"
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/app.py#L149-L205 | [
"def",
"route",
"(",
"self",
",",
"uri",
",",
"methods",
"=",
"frozenset",
"(",
"{",
"\"GET\"",
"}",
")",
",",
"host",
"=",
"None",
",",
"strict_slashes",
"=",
"None",
",",
"stream",
"=",
"False",
",",
"version",
"=",
"None",
",",
"name",
"=",
"Non... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Sanic.websocket | Decorate a function to be registered as a websocket route
:param uri: path of the URL
:param subprotocols: optional list of str with supported subprotocols
:param host:
:return: decorated function | sanic/app.py | def websocket(
self, uri, host=None, strict_slashes=None, subprotocols=None, name=None
):
"""Decorate a function to be registered as a websocket route
:param uri: path of the URL
:param subprotocols: optional list of str with supported subprotocols
:param host:
:retur... | def websocket(
self, uri, host=None, strict_slashes=None, subprotocols=None, name=None
):
"""Decorate a function to be registered as a websocket route
:param uri: path of the URL
:param subprotocols: optional list of str with supported subprotocols
:param host:
:retur... | [
"Decorate",
"a",
"function",
"to",
"be",
"registered",
"as",
"a",
"websocket",
"route",
":",
"param",
"uri",
":",
"path",
"of",
"the",
"URL",
":",
"param",
"subprotocols",
":",
"optional",
"list",
"of",
"str",
"with",
"supported",
"subprotocols",
":",
"par... | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/app.py#L439-L499 | [
"def",
"websocket",
"(",
"self",
",",
"uri",
",",
"host",
"=",
"None",
",",
"strict_slashes",
"=",
"None",
",",
"subprotocols",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"self",
".",
"enable_websocket",
"(",
")",
"# Fix case where the user did not pre... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
train | Sanic.add_websocket_route | A helper method to register a function as a websocket route.
:param handler: a callable function or instance of a class
that can handle the websocket request
:param host: Host IP or FQDN details
:param uri: URL path that will be mapped to the websocket
... | sanic/app.py | def add_websocket_route(
self,
handler,
uri,
host=None,
strict_slashes=None,
subprotocols=None,
name=None,
):
"""
A helper method to register a function as a websocket route.
:param handler: a callable function or instance of a class
... | def add_websocket_route(
self,
handler,
uri,
host=None,
strict_slashes=None,
subprotocols=None,
name=None,
):
"""
A helper method to register a function as a websocket route.
:param handler: a callable function or instance of a class
... | [
"A",
"helper",
"method",
"to",
"register",
"a",
"function",
"as",
"a",
"websocket",
"route",
"."
] | huge-success/sanic | python | https://github.com/huge-success/sanic/blob/6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd/sanic/app.py#L501-L535 | [
"def",
"add_websocket_route",
"(",
"self",
",",
"handler",
",",
"uri",
",",
"host",
"=",
"None",
",",
"strict_slashes",
"=",
"None",
",",
"subprotocols",
"=",
"None",
",",
"name",
"=",
"None",
",",
")",
":",
"if",
"strict_slashes",
"is",
"None",
":",
"... | 6a4a3f617fdbe1d3ee8bdc9d1b12ad2d0b34acdd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.