repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Rapptz/discord.py | discord/ext/commands/help.py | DefaultHelpCommand.send_pages | async def send_pages(self):
"""A helper utility to send the page output from :attr:`paginator` to the destination."""
destination = self.get_destination()
for page in self.paginator.pages:
await destination.send(page) | python | async def send_pages(self):
"""A helper utility to send the page output from :attr:`paginator` to the destination."""
destination = self.get_destination()
for page in self.paginator.pages:
await destination.send(page) | [
"async",
"def",
"send_pages",
"(",
"self",
")",
":",
"destination",
"=",
"self",
".",
"get_destination",
"(",
")",
"for",
"page",
"in",
"self",
".",
"paginator",
".",
"pages",
":",
"await",
"destination",
".",
"send",
"(",
"page",
")"
] | A helper utility to send the page output from :attr:`paginator` to the destination. | [
"A",
"helper",
"utility",
"to",
"send",
"the",
"page",
"output",
"from",
":",
"attr",
":",
"paginator",
"to",
"the",
"destination",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L913-L917 | train |
Rapptz/discord.py | discord/ext/commands/help.py | MinimalHelpCommand.add_bot_commands_formatting | def add_bot_commands_formatting(self, commands, heading):
"""Adds the minified bot heading with commands to the output.
The formatting should be added to the :attr:`paginator`.
The default implementation is a bold underline heading followed
by commands separated by an EN SPACE (U+2002)... | python | def add_bot_commands_formatting(self, commands, heading):
"""Adds the minified bot heading with commands to the output.
The formatting should be added to the :attr:`paginator`.
The default implementation is a bold underline heading followed
by commands separated by an EN SPACE (U+2002)... | [
"def",
"add_bot_commands_formatting",
"(",
"self",
",",
"commands",
",",
"heading",
")",
":",
"if",
"commands",
":",
"# U+2002 Middle Dot",
"joined",
"=",
"'\\u2002'",
".",
"join",
"(",
"c",
".",
"name",
"for",
"c",
"in",
"commands",
")",
"self",
".",
"pag... | Adds the minified bot heading with commands to the output.
The formatting should be added to the :attr:`paginator`.
The default implementation is a bold underline heading followed
by commands separated by an EN SPACE (U+2002) in the next line.
Parameters
-----------
co... | [
"Adds",
"the",
"minified",
"bot",
"heading",
"with",
"commands",
"to",
"the",
"output",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L1092-L1111 | train |
Rapptz/discord.py | discord/ext/commands/help.py | MinimalHelpCommand.add_subcommand_formatting | def add_subcommand_formatting(self, command):
"""Adds formatting information on a subcommand.
The formatting should be added to the :attr:`paginator`.
The default implementation is the prefix and the :attr:`Command.qualified_name`
optionally followed by an En dash and the command's :at... | python | def add_subcommand_formatting(self, command):
"""Adds formatting information on a subcommand.
The formatting should be added to the :attr:`paginator`.
The default implementation is the prefix and the :attr:`Command.qualified_name`
optionally followed by an En dash and the command's :at... | [
"def",
"add_subcommand_formatting",
"(",
"self",
",",
"command",
")",
":",
"fmt",
"=",
"'{0}{1} \\N{EN DASH} {2}'",
"if",
"command",
".",
"short_doc",
"else",
"'{0}{1}'",
"self",
".",
"paginator",
".",
"add_line",
"(",
"fmt",
".",
"format",
"(",
"self",
".",
... | Adds formatting information on a subcommand.
The formatting should be added to the :attr:`paginator`.
The default implementation is the prefix and the :attr:`Command.qualified_name`
optionally followed by an En dash and the command's :attr:`Command.short_doc`.
Parameters
-----... | [
"Adds",
"formatting",
"information",
"on",
"a",
"subcommand",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L1113-L1127 | train |
Rapptz/discord.py | discord/ext/commands/help.py | MinimalHelpCommand.add_aliases_formatting | def add_aliases_formatting(self, aliases):
"""Adds the formatting information on a command's aliases.
The formatting should be added to the :attr:`paginator`.
The default implementation is the :attr:`aliases_heading` bolded
followed by a comma separated list of aliases.
This i... | python | def add_aliases_formatting(self, aliases):
"""Adds the formatting information on a command's aliases.
The formatting should be added to the :attr:`paginator`.
The default implementation is the :attr:`aliases_heading` bolded
followed by a comma separated list of aliases.
This i... | [
"def",
"add_aliases_formatting",
"(",
"self",
",",
"aliases",
")",
":",
"self",
".",
"paginator",
".",
"add_line",
"(",
"'**%s** %s'",
"%",
"(",
"self",
".",
"aliases_heading",
",",
"', '",
".",
"join",
"(",
"aliases",
")",
")",
",",
"empty",
"=",
"True"... | Adds the formatting information on a command's aliases.
The formatting should be added to the :attr:`paginator`.
The default implementation is the :attr:`aliases_heading` bolded
followed by a comma separated list of aliases.
This is not called if there are no aliases to format.
... | [
"Adds",
"the",
"formatting",
"information",
"on",
"a",
"command",
"s",
"aliases",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L1129-L1144 | train |
Rapptz/discord.py | discord/ext/commands/help.py | MinimalHelpCommand.add_command_formatting | def add_command_formatting(self, command):
"""A utility function to format commands and groups.
Parameters
------------
command: :class:`Command`
The command to format.
"""
if command.description:
self.paginator.add_line(command.description, empt... | python | def add_command_formatting(self, command):
"""A utility function to format commands and groups.
Parameters
------------
command: :class:`Command`
The command to format.
"""
if command.description:
self.paginator.add_line(command.description, empt... | [
"def",
"add_command_formatting",
"(",
"self",
",",
"command",
")",
":",
"if",
"command",
".",
"description",
":",
"self",
".",
"paginator",
".",
"add_line",
"(",
"command",
".",
"description",
",",
"empty",
"=",
"True",
")",
"signature",
"=",
"self",
".",
... | A utility function to format commands and groups.
Parameters
------------
command: :class:`Command`
The command to format. | [
"A",
"utility",
"function",
"to",
"format",
"commands",
"and",
"groups",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L1146-L1171 | train |
Rapptz/discord.py | discord/voice_client.py | VoiceClient.disconnect | async def disconnect(self, *, force=False):
"""|coro|
Disconnects this voice client from voice.
"""
if not force and not self.is_connected():
return
self.stop()
self._connected.clear()
try:
if self.ws:
await self.ws.close... | python | async def disconnect(self, *, force=False):
"""|coro|
Disconnects this voice client from voice.
"""
if not force and not self.is_connected():
return
self.stop()
self._connected.clear()
try:
if self.ws:
await self.ws.close... | [
"async",
"def",
"disconnect",
"(",
"self",
",",
"*",
",",
"force",
"=",
"False",
")",
":",
"if",
"not",
"force",
"and",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"return",
"self",
".",
"stop",
"(",
")",
"self",
".",
"_connected",
".",
"cle... | |coro|
Disconnects this voice client from voice. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/voice_client.py#L269-L287 | train |
Rapptz/discord.py | discord/voice_client.py | VoiceClient.move_to | async def move_to(self, channel):
"""|coro|
Moves you to a different voice channel.
Parameters
-----------
channel: :class:`abc.Snowflake`
The channel to move to. Must be a voice channel.
"""
guild_id, _ = self.channel._get_voice_state_pair()
... | python | async def move_to(self, channel):
"""|coro|
Moves you to a different voice channel.
Parameters
-----------
channel: :class:`abc.Snowflake`
The channel to move to. Must be a voice channel.
"""
guild_id, _ = self.channel._get_voice_state_pair()
... | [
"async",
"def",
"move_to",
"(",
"self",
",",
"channel",
")",
":",
"guild_id",
",",
"_",
"=",
"self",
".",
"channel",
".",
"_get_voice_state_pair",
"(",
")",
"await",
"self",
".",
"main_ws",
".",
"voice_state",
"(",
"guild_id",
",",
"channel",
".",
"id",
... | |coro|
Moves you to a different voice channel.
Parameters
-----------
channel: :class:`abc.Snowflake`
The channel to move to. Must be a voice channel. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/voice_client.py#L289-L300 | train |
Rapptz/discord.py | discord/voice_client.py | VoiceClient.play | def play(self, source, *, after=None):
"""Plays an :class:`AudioSource`.
The finalizer, ``after`` is called after the source has been exhausted
or an error occurred.
If an error happens while the audio player is running, the exception is
caught and the audio player is then stop... | python | def play(self, source, *, after=None):
"""Plays an :class:`AudioSource`.
The finalizer, ``after`` is called after the source has been exhausted
or an error occurred.
If an error happens while the audio player is running, the exception is
caught and the audio player is then stop... | [
"def",
"play",
"(",
"self",
",",
"source",
",",
"*",
",",
"after",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"raise",
"ClientException",
"(",
"'Not connected to voice.'",
")",
"if",
"self",
".",
"is_playing",
"(",
... | Plays an :class:`AudioSource`.
The finalizer, ``after`` is called after the source has been exhausted
or an error occurred.
If an error happens while the audio player is running, the exception is
caught and the audio player is then stopped.
Parameters
-----------
... | [
"Plays",
"an",
":",
"class",
":",
"AudioSource",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/voice_client.py#L334-L371 | train |
Rapptz/discord.py | discord/voice_client.py | VoiceClient.send_audio_packet | def send_audio_packet(self, data, *, encode=True):
"""Sends an audio packet composed of the data.
You must be connected to play audio.
Parameters
----------
data: bytes
The :term:`py:bytes-like object` denoting PCM or Opus voice data.
encode: bool
... | python | def send_audio_packet(self, data, *, encode=True):
"""Sends an audio packet composed of the data.
You must be connected to play audio.
Parameters
----------
data: bytes
The :term:`py:bytes-like object` denoting PCM or Opus voice data.
encode: bool
... | [
"def",
"send_audio_packet",
"(",
"self",
",",
"data",
",",
"*",
",",
"encode",
"=",
"True",
")",
":",
"self",
".",
"checked_add",
"(",
"'sequence'",
",",
"1",
",",
"65535",
")",
"if",
"encode",
":",
"encoded_data",
"=",
"self",
".",
"encoder",
".",
"... | Sends an audio packet composed of the data.
You must be connected to play audio.
Parameters
----------
data: bytes
The :term:`py:bytes-like object` denoting PCM or Opus voice data.
encode: bool
Indicates if ``data`` should be encoded into Opus.
... | [
"Sends",
"an",
"audio",
"packet",
"composed",
"of",
"the",
"data",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/voice_client.py#L415-L446 | train |
Rapptz/discord.py | discord/client.py | Client.on_error | async def on_error(self, event_method, *args, **kwargs):
"""|coro|
The default error handler provided by the client.
By default this prints to :data:`sys.stderr` however it could be
overridden to have a different implementation.
Check :func:`discord.on_error` for more details.
... | python | async def on_error(self, event_method, *args, **kwargs):
"""|coro|
The default error handler provided by the client.
By default this prints to :data:`sys.stderr` however it could be
overridden to have a different implementation.
Check :func:`discord.on_error` for more details.
... | [
"async",
"def",
"on_error",
"(",
"self",
",",
"event_method",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"print",
"(",
"'Ignoring exception in {}'",
".",
"format",
"(",
"event_method",
")",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"tracebac... | |coro|
The default error handler provided by the client.
By default this prints to :data:`sys.stderr` however it could be
overridden to have a different implementation.
Check :func:`discord.on_error` for more details. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L300-L310 | train |
Rapptz/discord.py | discord/client.py | Client.request_offline_members | 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 ... | python | 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 ... | [
"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-... | 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 con... | [
"r",
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L312-L338 | train |
Rapptz/discord.py | discord/client.py | Client.login | async def login(self, token, *, bot=True):
"""|coro|
Logs in the client with the specified credentials.
This function can be used in two different ways.
.. warning::
Logging on with a user token is against the Discord
`Terms of Service <https://support.discord... | python | async def login(self, token, *, bot=True):
"""|coro|
Logs in the client with the specified credentials.
This function can be used in two different ways.
.. warning::
Logging on with a user token is against the Discord
`Terms of Service <https://support.discord... | [
"async",
"def",
"login",
"(",
"self",
",",
"token",
",",
"*",
",",
"bot",
"=",
"True",
")",
":",
"log",
".",
"info",
"(",
"'logging in using static token'",
")",
"await",
"self",
".",
"http",
".",
"static_login",
"(",
"token",
",",
"bot",
"=",
"bot",
... | |coro|
Logs in the client with the specified credentials.
This function can be used in two different ways.
.. warning::
Logging on with a user token is against the Discord
`Terms of Service <https://support.discordapp.com/hc/en-us/articles/115002192352>`_
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L342-L377 | train |
Rapptz/discord.py | discord/client.py | Client.connect | async def connect(self, *, reconnect=True):
"""|coro|
Creates a websocket connection and lets the websocket listen
to messages from discord. This is a loop that runs the entire
event system and miscellaneous aspects of the library. Control
is not resumed until the WebSocket conn... | python | async def connect(self, *, reconnect=True):
"""|coro|
Creates a websocket connection and lets the websocket listen
to messages from discord. This is a loop that runs the entire
event system and miscellaneous aspects of the library. Control
is not resumed until the WebSocket conn... | [
"async",
"def",
"connect",
"(",
"self",
",",
"*",
",",
"reconnect",
"=",
"True",
")",
":",
"backoff",
"=",
"ExponentialBackoff",
"(",
")",
"while",
"not",
"self",
".",
"is_closed",
"(",
")",
":",
"try",
":",
"await",
"self",
".",
"_connect",
"(",
")"... | |coro|
Creates a websocket connection and lets the websocket listen
to messages from discord. This is a loop that runs the entire
event system and miscellaneous aspects of the library. Control
is not resumed until the WebSocket connection is terminated.
Parameters
-----... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L405-L465 | train |
Rapptz/discord.py | discord/client.py | Client.close | async def close(self):
"""|coro|
Closes the connection to discord.
"""
if self._closed:
return
await self.http.close()
self._closed = True
for voice in self.voice_clients:
try:
await voice.disconnect()
except ... | python | async def close(self):
"""|coro|
Closes the connection to discord.
"""
if self._closed:
return
await self.http.close()
self._closed = True
for voice in self.voice_clients:
try:
await voice.disconnect()
except ... | [
"async",
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"return",
"await",
"self",
".",
"http",
".",
"close",
"(",
")",
"self",
".",
"_closed",
"=",
"True",
"for",
"voice",
"in",
"self",
".",
"voice_clients",
":",
"try",
... | |coro|
Closes the connection to discord. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L467-L488 | train |
Rapptz/discord.py | discord/client.py | Client.clear | def clear(self):
"""Clears the internal state of the bot.
After this, the bot can be considered "re-opened", i.e. :meth:`.is_closed`
and :meth:`.is_ready` both return ``False`` along with the bot's internal
cache cleared.
"""
self._closed = False
self._ready.clea... | python | def clear(self):
"""Clears the internal state of the bot.
After this, the bot can be considered "re-opened", i.e. :meth:`.is_closed`
and :meth:`.is_ready` both return ``False`` along with the bot's internal
cache cleared.
"""
self._closed = False
self._ready.clea... | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_closed",
"=",
"False",
"self",
".",
"_ready",
".",
"clear",
"(",
")",
"self",
".",
"_connection",
".",
"clear",
"(",
")",
"self",
".",
"http",
".",
"recreate",
"(",
")"
] | Clears the internal state of the bot.
After this, the bot can be considered "re-opened", i.e. :meth:`.is_closed`
and :meth:`.is_ready` both return ``False`` along with the bot's internal
cache cleared. | [
"Clears",
"the",
"internal",
"state",
"of",
"the",
"bot",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L490-L500 | train |
Rapptz/discord.py | discord/client.py | Client.start | async def start(self, *args, **kwargs):
"""|coro|
A shorthand coroutine for :meth:`login` + :meth:`connect`.
"""
bot = kwargs.pop('bot', True)
reconnect = kwargs.pop('reconnect', True)
await self.login(*args, bot=bot)
await self.connect(reconnect=reconnect) | python | async def start(self, *args, **kwargs):
"""|coro|
A shorthand coroutine for :meth:`login` + :meth:`connect`.
"""
bot = kwargs.pop('bot', True)
reconnect = kwargs.pop('reconnect', True)
await self.login(*args, bot=bot)
await self.connect(reconnect=reconnect) | [
"async",
"def",
"start",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"bot",
"=",
"kwargs",
".",
"pop",
"(",
"'bot'",
",",
"True",
")",
"reconnect",
"=",
"kwargs",
".",
"pop",
"(",
"'reconnect'",
",",
"True",
")",
"await",
"s... | |coro|
A shorthand coroutine for :meth:`login` + :meth:`connect`. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L502-L511 | train |
Rapptz/discord.py | discord/client.py | Client.run | def run(self, *args, **kwargs):
"""A blocking call that abstracts away the event loop
initialisation from you.
If you want more control over the event loop then this
function should not be used. Use :meth:`start` coroutine
or :meth:`connect` + :meth:`login`.
Roughly Equ... | python | def run(self, *args, **kwargs):
"""A blocking call that abstracts away the event loop
initialisation from you.
If you want more control over the event loop then this
function should not be used. Use :meth:`start` coroutine
or :meth:`connect` + :meth:`login`.
Roughly Equ... | [
"def",
"run",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"async",
"def",
"runner",
"(",
")",
":",
"try",
":",
"await",
"self",
".",
"start",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"finally",
":",
"await",
"self",... | A blocking call that abstracts away the event loop
initialisation from you.
If you want more control over the event loop then this
function should not be used. Use :meth:`start` coroutine
or :meth:`connect` + :meth:`login`.
Roughly Equivalent to: ::
try:
... | [
"A",
"blocking",
"call",
"that",
"abstracts",
"away",
"the",
"event",
"loop",
"initialisation",
"from",
"you",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L513-L549 | train |
Rapptz/discord.py | discord/client.py | Client.wait_for | def wait_for(self, event, *, check=None, timeout=None):
"""|coro|
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way.
The ``timeout`` paramete... | python | def wait_for(self, event, *, check=None, timeout=None):
"""|coro|
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way.
The ``timeout`` paramete... | [
"def",
"wait_for",
"(",
"self",
",",
"event",
",",
"*",
",",
"check",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"future",
"=",
"self",
".",
"loop",
".",
"create_future",
"(",
")",
"if",
"check",
"is",
"None",
":",
"def",
"_check",
"(",
... | |coro|
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way.
The ``timeout`` parameter is passed onto :func:`asyncio.wait_for`. By default,
it d... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L640-L736 | train |
Rapptz/discord.py | discord/client.py | Client.event | def event(self, coro):
"""A decorator that registers an event to listen to.
You can find more info about the events on the :ref:`documentation below <discord-api-events>`.
The events must be a |corourl|_, if not, :exc:`TypeError` is raised.
Example
---------
.. code-b... | python | def event(self, coro):
"""A decorator that registers an event to listen to.
You can find more info about the events on the :ref:`documentation below <discord-api-events>`.
The events must be a |corourl|_, if not, :exc:`TypeError` is raised.
Example
---------
.. code-b... | [
"def",
"event",
"(",
"self",
",",
"coro",
")",
":",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"'event registered must be a coroutine function'",
")",
"setattr",
"(",
"self",
",",
"coro",
".",
"__name_... | A decorator that registers an event to listen to.
You can find more info about the events on the :ref:`documentation below <discord-api-events>`.
The events must be a |corourl|_, if not, :exc:`TypeError` is raised.
Example
---------
.. code-block:: python3
@clien... | [
"A",
"decorator",
"that",
"registers",
"an",
"event",
"to",
"listen",
"to",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L740-L767 | train |
Rapptz/discord.py | discord/client.py | Client.change_presence | async def change_presence(self, *, activity=None, status=None, afk=False):
"""|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,
... | python | async def change_presence(self, *, activity=None, status=None, afk=False):
"""|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,
... | [
"async",
"def",
"change_presence",
"(",
"self",
",",
"*",
",",
"activity",
"=",
"None",
",",
"status",
"=",
"None",
",",
"afk",
"=",
"False",
")",
":",
"if",
"status",
"is",
"None",
":",
"status",
"=",
"'online'",
"status_enum",
"=",
"Status",
".",
"... | |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
---------
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L769-L822 | train |
Rapptz/discord.py | discord/client.py | Client.fetch_guilds | def fetch_guilds(self, *, limit=100, before=None, after=None):
"""|coro|
Retrieves an :class:`.AsyncIterator` that enables receiving your guilds.
.. note::
Using this, you will only receive :attr:`.Guild.owner`, :attr:`.Guild.icon`,
:attr:`.Guild.id`, and :attr:`.Guild... | python | def fetch_guilds(self, *, limit=100, before=None, after=None):
"""|coro|
Retrieves an :class:`.AsyncIterator` that enables receiving your guilds.
.. note::
Using this, you will only receive :attr:`.Guild.owner`, :attr:`.Guild.icon`,
:attr:`.Guild.id`, and :attr:`.Guild... | [
"def",
"fetch_guilds",
"(",
"self",
",",
"*",
",",
"limit",
"=",
"100",
",",
"before",
"=",
"None",
",",
"after",
"=",
"None",
")",
":",
"return",
"GuildIterator",
"(",
"self",
",",
"limit",
"=",
"limit",
",",
"before",
"=",
"before",
",",
"after",
... | |coro|
Retrieves an :class:`.AsyncIterator` that enables receiving your guilds.
.. note::
Using this, you will only receive :attr:`.Guild.owner`, :attr:`.Guild.icon`,
:attr:`.Guild.id`, and :attr:`.Guild.name` per :class:`.Guild`.
.. note::
This method is... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L826-L879 | train |
Rapptz/discord.py | discord/client.py | Client.fetch_guild | async def fetch_guild(self, guild_id):
"""|coro|
Retrieves a :class:`.Guild` from an ID.
.. note::
Using this, you will not receive :attr:`.Guild.channels`, :class:`.Guild.members`,
:attr:`.Member.activity` and :attr:`.Member.voice` per :class:`.Member`.
.. no... | python | async def fetch_guild(self, guild_id):
"""|coro|
Retrieves a :class:`.Guild` from an ID.
.. note::
Using this, you will not receive :attr:`.Guild.channels`, :class:`.Guild.members`,
:attr:`.Member.activity` and :attr:`.Member.voice` per :class:`.Member`.
.. no... | [
"async",
"def",
"fetch_guild",
"(",
"self",
",",
"guild_id",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_guild",
"(",
"guild_id",
")",
"return",
"Guild",
"(",
"data",
"=",
"data",
",",
"state",
"=",
"self",
".",
"_connection",
")"
] | |coro|
Retrieves a :class:`.Guild` from an ID.
.. note::
Using this, you will not receive :attr:`.Guild.channels`, :class:`.Guild.members`,
:attr:`.Member.activity` and :attr:`.Member.voice` per :class:`.Member`.
.. note::
This method is an API call. For ... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L881-L913 | train |
Rapptz/discord.py | discord/client.py | Client.create_guild | async def create_guild(self, name, region=None, icon=None):
"""|coro|
Creates a :class:`.Guild`.
Bot accounts in more than 10 guilds are not allowed to create guilds.
Parameters
----------
name: :class:`str`
The name of the guild.
region: :class:`Vo... | python | async def create_guild(self, name, region=None, icon=None):
"""|coro|
Creates a :class:`.Guild`.
Bot accounts in more than 10 guilds are not allowed to create guilds.
Parameters
----------
name: :class:`str`
The name of the guild.
region: :class:`Vo... | [
"async",
"def",
"create_guild",
"(",
"self",
",",
"name",
",",
"region",
"=",
"None",
",",
"icon",
"=",
"None",
")",
":",
"if",
"icon",
"is",
"not",
"None",
":",
"icon",
"=",
"utils",
".",
"_bytes_to_base64_data",
"(",
"icon",
")",
"if",
"region",
"i... | |coro|
Creates a :class:`.Guild`.
Bot accounts in more than 10 guilds are not allowed to create guilds.
Parameters
----------
name: :class:`str`
The name of the guild.
region: :class:`VoiceRegion`
The region for the voice communication server.
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L915-L955 | train |
Rapptz/discord.py | discord/client.py | Client.fetch_invite | async def fetch_invite(self, url, *, with_counts=True):
"""|coro|
Gets an :class:`.Invite` from a discord.gg URL or ID.
.. note::
If the invite is for a guild you have not joined, the guild and channel
attributes of the returned :class:`.Invite` will be :class:`.Partia... | python | async def fetch_invite(self, url, *, with_counts=True):
"""|coro|
Gets an :class:`.Invite` from a discord.gg URL or ID.
.. note::
If the invite is for a guild you have not joined, the guild and channel
attributes of the returned :class:`.Invite` will be :class:`.Partia... | [
"async",
"def",
"fetch_invite",
"(",
"self",
",",
"url",
",",
"*",
",",
"with_counts",
"=",
"True",
")",
":",
"invite_id",
"=",
"utils",
".",
"resolve_invite",
"(",
"url",
")",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_invite",
"(",
"invite_... | |coro|
Gets an :class:`.Invite` from a discord.gg URL or ID.
.. note::
If the invite is for a guild you have not joined, the guild and channel
attributes of the returned :class:`.Invite` will be :class:`.PartialInviteGuild` and
:class:`PartialInviteChannel` respect... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L959-L994 | train |
Rapptz/discord.py | discord/client.py | Client.delete_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`, :... | python | 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",
")",
":",
"invite_id",
"=",
"utils",
".",
"resolve_invite",
"(",
"invite",
")",
"await",
"self",
".",
"http",
".",
"delete_invite",
"(",
"invite_id",
")"
] | |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.
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L996-L1020 | train |
Rapptz/discord.py | discord/client.py | Client.fetch_widget | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_widget",
"(",
"guild_id",
")",
"return",
"Widget",
"(",
"state",
"=",
"self",
".",
"_connection",
",",
"data",
"=",
"data",
")"... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1024-L1052 | train |
Rapptz/discord.py | discord/client.py | Client.application_info | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"application_info",
"(",
")",
"if",
"'rpc_origins'",
"not",
"in",
"data",
":",
"data",
"[",
"'rpc_origins'",
"]",
"=",
"None",
"return",
"AppInfo",
... | |coro|
Retrieve's the bot's application information.
Raises
-------
HTTPException
Retrieving the information failed somehow.
Returns
--------
:class:`.AppInfo`
A namedtuple representing the application info. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1054-L1072 | train |
Rapptz/discord.py | discord/client.py | Client.fetch_user | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_user",
"(",
"user_id",
")",
"return",
"User",
"(",
"state",
"=",
"self",
".",
"_connection",
",",
"data",
"=",
"data",
")"
] | |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 ... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1074-L1104 | train |
Rapptz/discord.py | discord/client.py | Client.fetch_user_profile | 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... | python | 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",
")",
":",
"state",
"=",
"self",
".",
"_connection",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_user_profile",
"(",
"user_id",
")",
"def",
"transform",
"(",
"d",
")",
":",
"retur... | |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.
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1106-L1142 | train |
Rapptz/discord.py | discord/client.py | Client.fetch_webhook | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_webhook",
"(",
"webhook_id",
")",
"return",
"Webhook",
".",
"from_state",
"(",
"data",
",",
"state",
"=",
"self",
".",
"_conne... | |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
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L1144-L1164 | train |
Rapptz/discord.py | discord/invite.py | PartialInviteGuild.icon_url_as | 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) | python | 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",
")",
":",
"return",
"Asset",
".",
"_from_guild_image",
"(",
"self",
".",
"_state",
",",
"self",
".",
"id",
",",
"self",
".",
"icon",
",",
"'icons'",
... | :class:`Asset`: The same operation as :meth:`Guild.icon_url_as`. | [
":",
"class",
":",
"Asset",
":",
"The",
"same",
"operation",
"as",
":",
"meth",
":",
"Guild",
".",
"icon_url_as",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/invite.py#L153-L155 | train |
Rapptz/discord.py | discord/invite.py | PartialInviteGuild.banner_url_as | 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) | python | 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",
")",
":",
"return",
"Asset",
".",
"_from_guild_image",
"(",
"self",
".",
"_state",
",",
"self",
".",
"id",
",",
"self",
".",
"banner",
",",
"'banne... | :class:`Asset`: The same operation as :meth:`Guild.banner_url_as`. | [
":",
"class",
":",
"Asset",
":",
"The",
"same",
"operation",
"as",
":",
"meth",
":",
"Guild",
".",
"banner_url_as",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/invite.py#L162-L164 | train |
Rapptz/discord.py | discord/invite.py | PartialInviteGuild.splash_url_as | 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) | python | 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",
")",
":",
"return",
"Asset",
".",
"_from_guild_image",
"(",
"self",
".",
"_state",
",",
"self",
".",
"id",
",",
"self",
".",
"splash",
",",
"'splas... | :class:`Asset`: The same operation as :meth:`Guild.splash_url_as`. | [
":",
"class",
":",
"Asset",
":",
"The",
"same",
"operation",
"as",
":",
"meth",
":",
"Guild",
".",
"splash_url_as",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/invite.py#L171-L173 | train |
Rapptz/discord.py | discord/invite.py | Invite.delete | 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... | python | 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",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"delete_invite",
"(",
"self",
".",
"code",
",",
"reason",
"=",
"reason",
")"
] | |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
-------
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/invite.py#L286-L308 | train |
Rapptz/discord.py | discord/message.py | Attachment.save | 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... | python | 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",
")",
":",
"url",
"=",
"self",
".",
"proxy_url",
"if",
"use_cached",
"else",
"self",
".",
"url",
"data",
"=",
"await",
"self",
... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L81-L124 | train |
Rapptz/discord.py | discord/message.py | Message.raw_mentions | 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'<@... | python | 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",
")",
":",
"return",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"re",
".",
"findall",
"(",
"r'<@!?([0-9]+)>'",
",",
"self",
".",
"content",
")",
"]"
] | 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. | [
"A",
"property",
"that",
"returns",
"an",
"array",
"of",
"user",
"IDs",
"matched",
"with",
"the",
"syntax",
"of",
"<@user_id",
">",
"in",
"the",
"message",
"content",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L370-L377 | train |
Rapptz/discord.py | discord/message.py | Message.raw_channel_mentions | 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)] | python | 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",
")",
":",
"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. | [
"A",
"property",
"that",
"returns",
"an",
"array",
"of",
"channel",
"IDs",
"matched",
"with",
"the",
"syntax",
"of",
"<#channel_id",
">",
"in",
"the",
"message",
"content",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L380-L384 | train |
Rapptz/discord.py | discord/message.py | Message.raw_role_mentions | 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)] | python | 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",
")",
":",
"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 <@&role_id> in the message content. | [
"A",
"property",
"that",
"returns",
"an",
"array",
"of",
"role",
"IDs",
"matched",
"with",
"the",
"syntax",
"of",
"<"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L387-L391 | train |
Rapptz/discord.py | discord/message.py | Message.clean_content | 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... | python | 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",
")",
":",
"transformations",
"=",
"{",
"re",
".",
"escape",
"(",
"'<#%s>'",
"%",
"channel",
".",
"id",
")",
":",
"'#'",
"+",
"channel",
".",
"name",
"for",
"channel",
"in",
"self",
".",
"channel_mentions",
"}",
"men... | 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... | [
"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"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L401-L458 | train |
Rapptz/discord.py | discord/message.py | Message.system_content | 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... | python | 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",
")",
":",
"if",
"self",
".",
"type",
"is",
"MessageType",
".",
"default",
":",
"return",
"self",
".",
"content",
"if",
"self",
".",
"type",
"is",
"MessageType",
".",
"pins_add",
":",
"return",
"'{0.name} pinned a message... | 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. | [
"r",
"A",
"property",
"that",
"returns",
"the",
"content",
"that",
"is",
"rendered",
"regardless",
"of",
"the",
":",
"attr",
":",
"Message",
".",
"type",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L477-L564 | train |
Rapptz/discord.py | discord/message.py | Message.delete | 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
... | python | 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",
")",
":",
"if",
"delay",
"is",
"not",
"None",
":",
"async",
"def",
"delete",
"(",
")",
":",
"await",
"asyncio",
".",
"sleep",
"(",
"delay",
",",
"loop",
"=",
"self",
".",... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L566-L601 | train |
Rapptz/discord.py | discord/message.py | Message.edit | 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... | python | 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",
")",
":",
"try",
":",
"content",
"=",
"fields",
"[",
"'content'",
"]",
"except",
"KeyError",
":",
"pass",
"else",
":",
"if",
"content",
"is",
"not",
"None",
":",
"fields",
"[",
"'content'"... | |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.
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L603-L654 | train |
Rapptz/discord.py | discord/message.py | Message.pin | 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... | python | 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",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"pin_message",
"(",
"self",
".",
"channel",
".",
"id",
",",
"self",
".",
"id",
")",
"self",
".",
"pinned",
"=",
"True"
] | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L656-L676 | train |
Rapptz/discord.py | discord/message.py | Message.unpin | 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... | python | 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",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"unpin_message",
"(",
"self",
".",
"channel",
".",
"id",
",",
"self",
".",
"id",
")",
"self",
".",
"pinned",
"=",
"False"
] | |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 ... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L678-L697 | train |
Rapptz/discord.py | discord/message.py | Message.add_reaction | 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 ... | python | 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",
")",
":",
"emoji",
"=",
"self",
".",
"_emoji_reaction",
"(",
"emoji",
")",
"await",
"self",
".",
"_state",
".",
"http",
".",
"add_reaction",
"(",
"self",
".",
"channel",
".",
"id",
",",
"self",... | |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_... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L699-L728 | train |
Rapptz/discord.py | discord/message.py | Message.remove_reaction | 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... | python | 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",
")",
":",
"emoji",
"=",
"self",
".",
"_emoji_reaction",
"(",
"emoji",
")",
"if",
"member",
".",
"id",
"==",
"self",
".",
"_state",
".",
"self_id",
":",
"await",
"self",
".",
... | |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`... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L730-L767 | train |
Rapptz/discord.py | discord/message.py | Message.clear_reactions | 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... | python | 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",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"clear_reactions",
"(",
"self",
".",
"channel",
".",
"id",
",",
"self",
".",
"id",
")"
] | |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 ... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L785-L799 | train |
Rapptz/discord.py | discord/message.py | Message.ack | 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... | python | 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",
")",
":",
"state",
"=",
"self",
".",
"_state",
"if",
"state",
".",
"is_bot",
":",
"raise",
"ClientException",
"(",
"'Must not be a bot account to ack messages.'",
")",
"return",
"await",
"state",
".",
"http",
".",
"ack_messa... | |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. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/message.py#L801-L819 | train |
Rapptz/discord.py | discord/activity.py | Activity.large_image_url | 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 ... | python | 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",
")",
":",
"if",
"self",
".",
"application_id",
"is",
"None",
":",
"return",
"None",
"try",
":",
"large_image",
"=",
"self",
".",
"assets",
"[",
"'large_image'",
"]",
"except",
"KeyError",
":",
"return",
"None",
"else"... | Optional[:class:`str`]: Returns a URL pointing to the large image asset of this activity if applicable. | [
"Optional",
"[",
":",
"class",
":",
"str",
"]",
":",
"Returns",
"a",
"URL",
"pointing",
"to",
"the",
"large",
"image",
"asset",
"of",
"this",
"activity",
"if",
"applicable",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/activity.py#L186-L196 | train |
Rapptz/discord.py | discord/activity.py | Activity.small_image_url | 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 ... | python | 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",
")",
":",
"if",
"self",
".",
"application_id",
"is",
"None",
":",
"return",
"None",
"try",
":",
"small_image",
"=",
"self",
".",
"assets",
"[",
"'small_image'",
"]",
"except",
"KeyError",
":",
"return",
"None",
"else"... | Optional[:class:`str`]: Returns a URL pointing to the small image asset of this activity if applicable. | [
"Optional",
"[",
":",
"class",
":",
"str",
"]",
":",
"Returns",
"a",
"URL",
"pointing",
"to",
"the",
"small",
"image",
"asset",
"of",
"this",
"activity",
"if",
"applicable",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/activity.py#L199-L209 | train |
Rapptz/discord.py | discord/activity.py | Spotify.album_cover_url | 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_... | python | 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",
")",
":",
"large_image",
"=",
"self",
".",
"_assets",
".",
"get",
"(",
"'large_image'",
",",
"''",
")",
"if",
"large_image",
"[",
":",
"8",
"]",
"!=",
"'spotify:'",
":",
"return",
"''",
"album_image_id",
"=",
"large... | :class:`str`: The album cover image URL from Spotify's CDN. | [
":",
"class",
":",
"str",
":",
"The",
"album",
"cover",
"image",
"URL",
"from",
"Spotify",
"s",
"CDN",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/activity.py#L539-L545 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | 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('!... | python | 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",
")",
":",
"def",
"inner",
"(",
"bot",
",",
"msg",
")",
":",
"r",
"=",
"list",
"(",
"prefixes",
")",
"r",
"=",
"when_mentioned",
"(",
"bot",
",",
"msg",
")",
"+",
"r",
"return",
"r",
"return",
"inner... | 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... | [
"A",
"callable",
"that",
"implements",
"when",
"mentioned",
"or",
"other",
"prefixes",
"provided",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L52-L86 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.on_command_error | 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... | python | 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",
")",
":",
"if",
"self",
".",
"extra_events",
".",
"get",
"(",
"'on_command_error'",
",",
"None",
")",
":",
"return",
"if",
"hasattr",
"(",
"context",
".",
"command",
",",
... | |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. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L146-L168 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.add_check | 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... | python | 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",
")",
":",
"if",
"call_once",
":",
"self",
".",
"_check_once",
".",
"append",
"(",
"func",
")",
"else",
":",
"self",
".",
"_checks",
".",
"append",
"(",
"func",
... | 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... | [
"Adds",
"a",
"global",
"check",
"to",
"the",
"bot",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L200-L218 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.remove_check | 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... | python | 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",
")",
":",
"l",
"=",
"self",
".",
"_check_once",
"if",
"call_once",
"else",
"self",
".",
"_checks",
"try",
":",
"l",
".",
"remove",
"(",
"func",
")",
"except",
... | 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... | [
"Removes",
"a",
"global",
"check",
"from",
"the",
"bot",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L220-L239 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.is_owner | 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... | python | 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",
")",
":",
"if",
"self",
".",
"owner_id",
"is",
"None",
":",
"app",
"=",
"await",
"self",
".",
"application_info",
"(",
")",
"self",
".",
"owner_id",
"=",
"owner_id",
"=",
"app",
".",
"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... | [
"Checks",
"if",
"a",
":",
"class",
":",
"~discord",
".",
"User",
"or",
":",
"class",
":",
"~discord",
".",
"Member",
"is",
"the",
"owner",
"of",
"this",
"bot",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L281-L298 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.add_listener | 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... | python | 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",
")",
":",
"name",
"=",
"func",
".",
"__name__",
"if",
"name",
"is",
"None",
"else",
"name",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"func",
")",
":",
"raise",
... | 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
--------
... | [
"The",
"non",
"decorator",
"alternative",
"to",
":",
"meth",
":",
".",
"listen",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L367-L397 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.remove_listener | 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
... | python | 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",
")",
":",
"name",
"=",
"func",
".",
"__name__",
"if",
"name",
"is",
"None",
"else",
"name",
"if",
"name",
"in",
"self",
".",
"extra_events",
":",
"try",
":",
"self",
".",
... | 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__``. | [
"Removes",
"a",
"listener",
"from",
"the",
"pool",
"of",
"listeners",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L399-L417 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.listen | 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
... | python | 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",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"self",
".",
"add_listener",
"(",
"func",
",",
"name",
")",
"return",
"func",
"return",
"decorator"
] | 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:: ... | [
"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",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L419-L453 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.add_cog | 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... | python | 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",
")",
":",
"if",
"not",
"isinstance",
"(",
"cog",
",",
"Cog",
")",
":",
"raise",
"TypeError",
"(",
"'cogs must derive from Cog'",
")",
"cog",
"=",
"cog",
".",
"_inject",
"(",
"self",
")",
"self",
".",
"__cogs",... | 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`.
... | [
"Adds",
"a",
"cog",
"to",
"the",
"bot",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L457-L479 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.remove_cog | 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`
... | python | 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",
")",
":",
"cog",
"=",
"self",
".",
"__cogs",
".",
"pop",
"(",
"name",
",",
"None",
")",
"if",
"cog",
"is",
"None",
":",
"return",
"help_command",
"=",
"self",
".",
"_help_command",
"if",
"help_command",
... | 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. | [
"Removes",
"a",
"cog",
"from",
"the",
"bot",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L495-L516 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.load_extension | 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... | python | 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",
")",
":",
"if",
"name",
"in",
"self",
".",
"__extensions",
":",
"raise",
"errors",
".",
"ExtensionAlreadyLoaded",
"(",
"name",
")",
"try",
":",
"lib",
"=",
"importlib",
".",
"import_module",
"(",
"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 must have a single argument, the ``bot``.
... | [
"Loads",
"an",
"extension",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L584-L621 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.unload_extension | 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... | python | 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",
")",
":",
"lib",
"=",
"self",
".",
"__extensions",
".",
"get",
"(",
"name",
")",
"if",
"lib",
"is",
"None",
":",
"raise",
"errors",
".",
"ExtensionNotLoaded",
"(",
"name",
")",
"self",
".",
"_remove_... | 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
... | [
"Unloads",
"an",
"extension",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L623-L652 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.reload_extension | 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... | python | 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",
")",
":",
"lib",
"=",
"self",
".",
"__extensions",
".",
"get",
"(",
"name",
")",
"if",
"lib",
"is",
"None",
":",
"raise",
"errors",
".",
"ExtensionNotLoaded",
"(",
"name",
")",
"# get the previous module... | 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... | [
"Atomically",
"reloads",
"an",
"extension",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L654-L705 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.get_prefix | 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
--------
... | python | 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",
")",
":",
"prefix",
"=",
"ret",
"=",
"self",
".",
"command_prefix",
"if",
"callable",
"(",
"prefix",
")",
":",
"ret",
"=",
"await",
"discord",
".",
"utils",
".",
"maybe_coroutine",
"(",
"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`]
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L735-L771 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.get_context | 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... | python | 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",
")",
":",
"view",
"=",
"StringView",
"(",
"message",
".",
"content",
")",
"ctx",
"=",
"cls",
"(",
"prefix",
"=",
"None",
",",
"view",
"=",
"view",
","... | 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... | [
"r",
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L773-L842 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.invoke | 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... | python | 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",
")",
":",
"if",
"ctx",
".",
"command",
"is",
"not",
"None",
":",
"self",
".",
"dispatch",
"(",
"'command'",
",",
"ctx",
")",
"try",
":",
"if",
"await",
"self",
".",
"can_run",
"(",
"ctx",
",",
"c... | |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. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L844-L866 | train |
Rapptz/discord.py | discord/ext/commands/bot.py | BotBase.process_commands | 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`
... | python | 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",
")",
":",
"if",
"message",
".",
"author",
".",
"bot",
":",
"return",
"ctx",
"=",
"await",
"self",
".",
"get_context",
"(",
"message",
")",
"await",
"self",
".",
"invoke",
"(",
"ctx",
")"
... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/bot.py#L868-L894 | train |
Rapptz/discord.py | discord/guild.py | Guild.large | 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 ... | python | 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",
")",
":",
"if",
"self",
".",
"_large",
"is",
"None",
":",
"try",
":",
"return",
"self",
".",
"_member_count",
">=",
"250",
"except",
"AttributeError",
":",
"return",
"len",
"(",
"self",
".",
"_members",
")",
">=",
"250",
... | :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. | [
":",
"class",
":",
"bool",
":",
"Indicates",
"if",
"the",
"guild",
"is",
"a",
"large",
"guild",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L287-L298 | train |
Rapptz/discord.py | discord/guild.py | Guild.voice_channels | 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 ... | python | 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",
")",
":",
"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.
This is sorted by the position and are in UI order from top to bottom. | [
"List",
"[",
":",
"class",
":",
"VoiceChannel",
"]",
":",
"A",
"list",
"of",
"voice",
"channels",
"that",
"belongs",
"to",
"this",
"guild",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L301-L308 | train |
Rapptz/discord.py | discord/guild.py | Guild.me | 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) | python | 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",
")",
":",
"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. | [
"Similar",
"to",
":",
"attr",
":",
"Client",
".",
"user",
"except",
"an",
"instance",
"of",
":",
"class",
":",
"Member",
".",
"This",
"is",
"essentially",
"used",
"to",
"get",
"the",
"member",
"version",
"of",
"yourself",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L311-L316 | train |
Rapptz/discord.py | discord/guild.py | Guild.text_channels | 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: (... | python | 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",
")",
":",
"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.
This is sorted by the position and are in UI order from top to bottom. | [
"List",
"[",
":",
"class",
":",
"TextChannel",
"]",
":",
"A",
"list",
"of",
"text",
"channels",
"that",
"belongs",
"to",
"this",
"guild",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L324-L331 | train |
Rapptz/discord.py | discord/guild.py | Guild.categories | 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:... | python | 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",
")",
":",
"r",
"=",
"[",
"ch",
"for",
"ch",
"in",
"self",
".",
"_channels",
".",
"values",
"(",
")",
"if",
"isinstance",
"(",
"ch",
",",
"CategoryChannel",
")",
"]",
"r",
".",
"sort",
"(",
"key",
"=",
"lambda",
"... | 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. | [
"List",
"[",
":",
"class",
":",
"CategoryChannel",
"]",
":",
"A",
"list",
"of",
"categories",
"that",
"belongs",
"to",
"this",
"guild",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L334-L341 | train |
Rapptz/discord.py | discord/guild.py | Guild.by_category | 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
-... | python | 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",
")",
":",
"grouped",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"channel",
"in",
"self",
".",
"_channels",
".",
"values",
"(",
")",
":",
"if",
"isinstance",
"(",
"channel",
",",
"CategoryChannel",
")",
":",
"continue"... | 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... | [
"Returns",
"every",
":",
"class",
":",
"CategoryChannel",
"and",
"their",
"associated",
"channels",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L343-L372 | train |
Rapptz/discord.py | discord/guild.py | Guild.system_channel | 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._... | python | 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",
")",
":",
"channel_id",
"=",
"self",
".",
"_system_channel_id",
"return",
"channel_id",
"and",
"self",
".",
"_channels",
".",
"get",
"(",
"channel_id",
")"
] | 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``. | [
"Optional",
"[",
":",
"class",
":",
"TextChannel",
"]",
":",
"Returns",
"the",
"guild",
"s",
"channel",
"used",
"for",
"system",
"messages",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L379-L385 | train |
Rapptz/discord.py | discord/guild.py | Guild.default_role | 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()) | python | 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",
")",
":",
"return",
"utils",
".",
"find",
"(",
"lambda",
"r",
":",
"r",
".",
"is_default",
"(",
")",
",",
"self",
".",
"_roles",
".",
"values",
"(",
")",
")"
] | Gets the @everyone role that all members have by default. | [
"Gets",
"the"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L410-L412 | train |
Rapptz/discord.py | discord/guild.py | Guild.chunked | 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... | python | 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",
")",
":",
"count",
"=",
"getattr",
"(",
"self",
",",
"'_member_count'",
",",
"None",
")",
"if",
"count",
"is",
"None",
":",
"return",
"False",
"return",
"count",
"==",
"len",
"(",
"self",
".",
"_members",
")"
] | 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. | [
"Returns",
"a",
"boolean",
"indicating",
"if",
"the",
"guild",
"is",
"chunked",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L515-L527 | train |
Rapptz/discord.py | discord/guild.py | Guild.shard_id | 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 | python | 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",
")",
":",
"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. | [
"Returns",
"the",
"shard",
"ID",
"for",
"this",
"guild",
"if",
"applicable",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L530-L535 | train |
Rapptz/discord.py | discord/guild.py | Guild.get_member_named | 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... | python | 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",
")",
":",
"result",
"=",
"None",
"members",
"=",
"self",
".",
"members",
"if",
"len",
"(",
"name",
")",
">",
"5",
"and",
"name",
"[",
"-",
"5",
"]",
"==",
"'#'",
":",
"# The 5 length is checking to s... | 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... | [
"Returns",
"the",
"first",
"member",
"found",
"that",
"matches",
"the",
"name",
"provided",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L542-L586 | train |
Rapptz/discord.py | discord/guild.py | Guild.create_text_channel | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_create_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
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L622-L705 | train |
Rapptz/discord.py | discord/guild.py | Guild.create_voice_channel | 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
---------... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_create_channe... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L707-L725 | train |
Rapptz/discord.py | discord/guild.py | Guild.create_category | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_create_channel",
"(",
"name",
",",
"overwrites",
",",
"ChannelType",
".",
... | |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. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L727-L742 | train |
Rapptz/discord.py | discord/guild.py | Guild.edit | 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... | python | 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",
")",
":",
"http",
"=",
"self",
".",
"_state",
".",
"http",
"try",
":",
"icon_bytes",
"=",
"fields",
"[",
"'icon'",
"]",
"except",
"KeyError",
":",
... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L779-L928 | train |
Rapptz/discord.py | discord/guild.py | Guild.fetch_member | 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`
... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_member",
"(",
"self",
".",
"id",
",",
"member_id",
")",
"return",
"Member",
"(",
"data",
"=",
"data",
",",
"s... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L930-L957 | train |
Rapptz/discord.py | discord/guild.py | Guild.fetch_ban | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_ban",
"(",
"user",
".",
"id",
",",
"self",
".",
"id",
")",
"return",
"BanEntry",
"(",
"user",
"=",
"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 information.
Parameters
-----------
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L959-L992 | train |
Rapptz/discord.py | discord/guild.py | Guild.bans | 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
... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_bans",
"(",
"self",
".",
"id",
")",
"return",
"[",
"BanEntry",
"(",
"user",
"=",
"User",
"(",
"state",
"=",
"self",
".",
"_state",
... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L994-L1023 | train |
Rapptz/discord.py | discord/guild.py | Guild.prune_members | 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... | python | 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",
")",
":",
"if",
"not",
"isinstance",
"(",
"days",
",",
"int",
")",
":",
"raise",
"InvalidArgument",
"(",
"'Expected ... | 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 ... | [
"r",
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1025-L1071 | train |
Rapptz/discord.py | discord/guild.py | Guild.estimate_pruned_members | 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`
... | python | 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",
")",
":",
"if",
"not",
"isinstance",
"(",
"days",
",",
"int",
")",
":",
"raise",
"InvalidArgument",
"(",
"'Expected int for ``days``, received {0.__class__.__name__} instead.'",
".",
"for... | |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.
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1094-L1125 | train |
Rapptz/discord.py | discord/guild.py | Guild.invites | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"invites_from",
"(",
"self",
".",
"id",
")",
"result",
"=",
"[",
"]",
"for",
"invite",
"in",
"data",
":",
"channel",
"=",
"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 get the information.
HTTPExcep... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1127-L1156 | train |
Rapptz/discord.py | discord/guild.py | Guild.fetch_emojis | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_all_custom_emojis",
"(",
"self",
".",
"id",
")",
"return",
"[",
"Emoji",
"(",
"guild",
"=",
"self",
",",
"state",
"=",
"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 the emojis.
Returns
--... | [
"r",
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1158-L1178 | train |
Rapptz/discord.py | discord/guild.py | Guild.fetch_emoji | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_custom_emoji",
"(",
"self",
".",
"id",
",",
"emoji_id",
")",
"return",
"Emoji",
"(",
"guild",
"=",
"self",
",",
... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1180-L1208 | train |
Rapptz/discord.py | discord/guild.py | Guild.create_custom_emoji | 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 ... | python | 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",
")",
":",
"img",
"=",
"utils",
".",
"_bytes_to_base64_data",
"(",
"image",
")",
"if",
"roles",
":",
"roles",... | 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... | [
"r",
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1210-L1250 | train |
Rapptz/discord.py | discord/guild.py | Guild.create_role | 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`
... | python | 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",
")",
":",
"try",
":",
"perms",
"=",
"fields",
".",
"pop",
"(",
"'permissions'",
")",
"except",
"KeyError",
":",
"fields",
"[",
"'permissions'",
... | |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: ... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1252-L1318 | train |
Rapptz/discord.py | discord/guild.py | Guild.kick | 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... | python | 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",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"kick",
"(",
"user",
".",
"id",
",",
"self",
".",
"id",
",",
"reason",
"=",
"reason",
")"
] | |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.... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1320-L1344 | train |
Rapptz/discord.py | discord/guild.py | Guild.ban | 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
-----------
... | python | 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",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"ban",
"(",
"user",
".",
"id",
",",
"self",
".",
"id",
",",
... | |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.
... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1346-L1373 | train |
Rapptz/discord.py | discord/guild.py | Guild.unban | 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... | python | 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",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"unban",
"(",
"user",
".",
"id",
",",
"self",
".",
"id",
",",
"reason",
"=",
"reason",
")"
] | |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:... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1375-L1399 | train |
Rapptz/discord.py | discord/guild.py | Guild.vanity_invite | 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
... | python | 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",
")",
":",
"# 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",
"# ... | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1401-L1438 | train |
Rapptz/discord.py | discord/guild.py | Guild.ack | 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
... | python | 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",
")",
":",
"state",
"=",
"self",
".",
"_state",
"if",
"state",
".",
"is_bot",
":",
"raise",
"ClientException",
"(",
"'Must not be a bot account to ack messages.'",
")",
"return",
"state",
".",
"http",
".",
"ack_guild",
"(",
"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. | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1440-L1458 | train |
Rapptz/discord.py | discord/guild.py | Guild.audit_logs | 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
----------
... | python | 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",
")",
":",
"if",
"user",
":",
"use... | 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):
... | [
"Return",
"an",
":",
"class",
":",
"AsyncIterator",
"that",
"enables",
"receiving",
"the",
"guild",
"s",
"audit",
"logs",
"."
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1460-L1520 | train |
Rapptz/discord.py | discord/guild.py | Guild.widget | 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... | python | 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",
")",
":",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_widget",
"(",
"self",
".",
"id",
")",
"return",
"Widget",
"(",
"state",
"=",
"self",
".",
"_state",
",",
"data",
"=",
"data",
")"
] | |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... | [
"|coro|"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/guild.py#L1522-L1545 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.