partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | Messageable.fetch_message | |coro|
Retrieves a single :class:`.Message` from the destination.
This can only be used by bot accounts.
Parameters
------------
id: :class:`int`
The message ID to look for.
Raises
--------
:exc:`.NotFound`
The specified message... | discord/abc.py | async def fetch_message(self, id):
"""|coro|
Retrieves a single :class:`.Message` from the destination.
This can only be used by bot accounts.
Parameters
------------
id: :class:`int`
The message ID to look for.
Raises
--------
:exc... | async def fetch_message(self, id):
"""|coro|
Retrieves a single :class:`.Message` from the destination.
This can only be used by bot accounts.
Parameters
------------
id: :class:`int`
The message ID to look for.
Raises
--------
:exc... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L860-L889 | [
"async",
"def",
"fetch_message",
"(",
"self",
",",
"id",
")",
":",
"channel",
"=",
"await",
"self",
".",
"_get_channel",
"(",
")",
"data",
"=",
"await",
"self",
".",
"_state",
".",
"http",
".",
"get_message",
"(",
"channel",
".",
"id",
",",
"id",
")"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Messageable.pins | |coro|
Returns a :class:`list` of :class:`.Message` that are currently pinned.
Raises
-------
:exc:`.HTTPException`
Retrieving the pinned messages failed. | discord/abc.py | async def pins(self):
"""|coro|
Returns a :class:`list` of :class:`.Message` that are currently pinned.
Raises
-------
:exc:`.HTTPException`
Retrieving the pinned messages failed.
"""
channel = await self._get_channel()
state = self._state
... | async def pins(self):
"""|coro|
Returns a :class:`list` of :class:`.Message` that are currently pinned.
Raises
-------
:exc:`.HTTPException`
Retrieving the pinned messages failed.
"""
channel = await self._get_channel()
state = self._state
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L891-L905 | [
"async",
"def",
"pins",
"(",
"self",
")",
":",
"channel",
"=",
"await",
"self",
".",
"_get_channel",
"(",
")",
"state",
"=",
"self",
".",
"_state",
"data",
"=",
"await",
"state",
".",
"http",
".",
"pins_from",
"(",
"channel",
".",
"id",
")",
"return"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Messageable.history | Return an :class:`.AsyncIterator` that enables receiving the destination's message history.
You must have :attr:`~.Permissions.read_message_history` permissions to use this.
Examples
---------
Usage ::
counter = 0
async for message in channel.history(limit=200... | discord/abc.py | def history(self, *, limit=100, before=None, after=None, around=None, oldest_first=None):
"""Return an :class:`.AsyncIterator` that enables receiving the destination's message history.
You must have :attr:`~.Permissions.read_message_history` permissions to use this.
Examples
---------
... | def history(self, *, limit=100, before=None, after=None, around=None, oldest_first=None):
"""Return an :class:`.AsyncIterator` that enables receiving the destination's message history.
You must have :attr:`~.Permissions.read_message_history` permissions to use this.
Examples
---------
... | [
"Return",
"an",
":",
"class",
":",
".",
"AsyncIterator",
"that",
"enables",
"receiving",
"the",
"destination",
"s",
"message",
"history",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L907-L962 | [
"def",
"history",
"(",
"self",
",",
"*",
",",
"limit",
"=",
"100",
",",
"before",
"=",
"None",
",",
"after",
"=",
"None",
",",
"around",
"=",
"None",
",",
"oldest_first",
"=",
"None",
")",
":",
"return",
"HistoryIterator",
"(",
"self",
",",
"limit",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Connectable.connect | |coro|
Connects to voice and creates a :class:`VoiceClient` to establish
your connection to the voice server.
Parameters
-----------
timeout: :class:`float`
The timeout in seconds to wait for the voice endpoint.
reconnect: :class:`bool`
Whether t... | discord/abc.py | async def connect(self, *, timeout=60.0, reconnect=True):
"""|coro|
Connects to voice and creates a :class:`VoiceClient` to establish
your connection to the voice server.
Parameters
-----------
timeout: :class:`float`
The timeout in seconds to wait for the v... | async def connect(self, *, timeout=60.0, reconnect=True):
"""|coro|
Connects to voice and creates a :class:`VoiceClient` to establish
your connection to the voice server.
Parameters
-----------
timeout: :class:`float`
The timeout in seconds to wait for the v... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/abc.py#L983-L1031 | [
"async",
"def",
"connect",
"(",
"self",
",",
"*",
",",
"timeout",
"=",
"60.0",
",",
"reconnect",
"=",
"True",
")",
":",
"key_id",
",",
"_",
"=",
"self",
".",
"_get_voice_client_key",
"(",
")",
"state",
"=",
"self",
".",
"_state",
"if",
"state",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | PartialEmoji.url | :class:`Asset`:Returns an asset of the emoji, if it is custom. | discord/emoji.py | def url(self):
""":class:`Asset`:Returns an asset of the emoji, if it is custom."""
if self.is_unicode_emoji():
return Asset(self._state)
_format = 'gif' if self.animated else 'png'
url = "https://cdn.discordapp.com/emojis/{0.id}.{1}".format(self, _format)
return Ass... | def url(self):
""":class:`Asset`:Returns an asset of the emoji, if it is custom."""
if self.is_unicode_emoji():
return Asset(self._state)
_format = 'gif' if self.animated else 'png'
url = "https://cdn.discordapp.com/emojis/{0.id}.{1}".format(self, _format)
return Ass... | [
":",
"class",
":",
"Asset",
":",
"Returns",
"an",
"asset",
"of",
"the",
"emoji",
"if",
"it",
"is",
"custom",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/emoji.py#L116-L123 | [
"def",
"url",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_unicode_emoji",
"(",
")",
":",
"return",
"Asset",
"(",
"self",
".",
"_state",
")",
"_format",
"=",
"'gif'",
"if",
"self",
".",
"animated",
"else",
"'png'",
"url",
"=",
"\"https://cdn.discordapp.... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Emoji.roles | List[:class:`Role`]: A :class:`list` of roles that is allowed to use this emoji.
If roles is empty, the emoji is unrestricted. | discord/emoji.py | def roles(self):
"""List[:class:`Role`]: A :class:`list` of roles that is allowed to use this emoji.
If roles is empty, the emoji is unrestricted.
"""
guild = self.guild
if guild is None:
return []
return [role for role in guild.roles if self._roles.has(role... | def roles(self):
"""List[:class:`Role`]: A :class:`list` of roles that is allowed to use this emoji.
If roles is empty, the emoji is unrestricted.
"""
guild = self.guild
if guild is None:
return []
return [role for role in guild.roles if self._roles.has(role... | [
"List",
"[",
":",
"class",
":",
"Role",
"]",
":",
"A",
":",
"class",
":",
"list",
"of",
"roles",
"that",
"is",
"allowed",
"to",
"use",
"this",
"emoji",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/emoji.py#L229-L238 | [
"def",
"roles",
"(",
"self",
")",
":",
"guild",
"=",
"self",
".",
"guild",
"if",
"guild",
"is",
"None",
":",
"return",
"[",
"]",
"return",
"[",
"role",
"for",
"role",
"in",
"guild",
".",
"roles",
"if",
"self",
".",
"_roles",
".",
"has",
"(",
"rol... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Emoji.delete | |coro|
Deletes the custom emoji.
You must have :attr:`~Permissions.manage_emojis` permission to
do this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this emoji. Shows up on the audit log.
Raises
-------
... | discord/emoji.py | async def delete(self, *, reason=None):
"""|coro|
Deletes the custom emoji.
You must have :attr:`~Permissions.manage_emojis` permission to
do this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this emoji. Shows up on... | async def delete(self, *, reason=None):
"""|coro|
Deletes the custom emoji.
You must have :attr:`~Permissions.manage_emojis` permission to
do this.
Parameters
-----------
reason: Optional[:class:`str`]
The reason for deleting this emoji. Shows up on... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/emoji.py#L245-L266 | [
"async",
"def",
"delete",
"(",
"self",
",",
"*",
",",
"reason",
"=",
"None",
")",
":",
"await",
"self",
".",
"_state",
".",
"http",
".",
"delete_custom_emoji",
"(",
"self",
".",
"guild",
".",
"id",
",",
"self",
".",
"id",
",",
"reason",
"=",
"reaso... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Emoji.edit | r"""|coro|
Edits the custom emoji.
You must have :attr:`~Permissions.manage_emojis` permission to
do this.
Parameters
-----------
name: :class:`str`
The new emoji name.
roles: Optional[list[:class:`Role`]]
A :class:`list` of :class:`Role... | discord/emoji.py | async def edit(self, *, name, roles=None, reason=None):
r"""|coro|
Edits the custom emoji.
You must have :attr:`~Permissions.manage_emojis` permission to
do this.
Parameters
-----------
name: :class:`str`
The new emoji name.
roles: Optional[... | async def edit(self, *, name, roles=None, reason=None):
r"""|coro|
Edits the custom emoji.
You must have :attr:`~Permissions.manage_emojis` permission to
do this.
Parameters
-----------
name: :class:`str`
The new emoji name.
roles: Optional[... | [
"r",
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/emoji.py#L268-L295 | [
"async",
"def",
"edit",
"(",
"self",
",",
"*",
",",
"name",
",",
"roles",
"=",
"None",
",",
"reason",
"=",
"None",
")",
":",
"if",
"roles",
":",
"roles",
"=",
"[",
"role",
".",
"id",
"for",
"role",
"in",
"roles",
"]",
"await",
"self",
".",
"_st... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | loop | A decorator that schedules a task in the background for you with
optional reconnect logic.
Parameters
------------
seconds: :class:`float`
The number of seconds between every iteration.
minutes: :class:`float`
The number of minutes between every iteration.
hours: :class:`float`
... | discord/ext/tasks/__init__.py | def loop(*, seconds=0, minutes=0, hours=0, count=None, reconnect=True, loop=None):
"""A decorator that schedules a task in the background for you with
optional reconnect logic.
Parameters
------------
seconds: :class:`float`
The number of seconds between every iteration.
minutes: :class... | def loop(*, seconds=0, minutes=0, hours=0, count=None, reconnect=True, loop=None):
"""A decorator that schedules a task in the background for you with
optional reconnect logic.
Parameters
------------
seconds: :class:`float`
The number of seconds between every iteration.
minutes: :class... | [
"A",
"decorator",
"that",
"schedules",
"a",
"task",
"in",
"the",
"background",
"for",
"you",
"with",
"optional",
"reconnect",
"logic",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/tasks/__init__.py#L238-L276 | [
"def",
"loop",
"(",
"*",
",",
"seconds",
"=",
"0",
",",
"minutes",
"=",
"0",
",",
"hours",
"=",
"0",
",",
"count",
"=",
"None",
",",
"reconnect",
"=",
"True",
",",
"loop",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"retur... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Loop.start | r"""Starts the internal task in the event loop.
Parameters
------------
\*args
The arguments to to use.
\*\*kwargs
The keyword arguments to use.
Raises
--------
RuntimeError
A task has already been launched.
Returns
... | discord/ext/tasks/__init__.py | def start(self, *args, **kwargs):
r"""Starts the internal task in the event loop.
Parameters
------------
\*args
The arguments to to use.
\*\*kwargs
The keyword arguments to use.
Raises
--------
RuntimeError
A task has... | def start(self, *args, **kwargs):
r"""Starts the internal task in the event loop.
Parameters
------------
\*args
The arguments to to use.
\*\*kwargs
The keyword arguments to use.
Raises
--------
RuntimeError
A task has... | [
"r",
"Starts",
"the",
"internal",
"task",
"in",
"the",
"event",
"loop",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/tasks/__init__.py#L101-L129 | [
"def",
"start",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_task",
"is",
"not",
"None",
":",
"raise",
"RuntimeError",
"(",
"'Task is already launched.'",
")",
"if",
"self",
".",
"_injected",
"is",
"not",
"None... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Loop.add_exception_type | r"""Adds an exception type to be handled during the reconnect logic.
By default the exception types handled are those handled by
:meth:`discord.Client.connect`\, which includes a lot of internet disconnection
errors.
This function is useful if you're interacting with a 3rd party librar... | discord/ext/tasks/__init__.py | def add_exception_type(self, exc):
r"""Adds an exception type to be handled during the reconnect logic.
By default the exception types handled are those handled by
:meth:`discord.Client.connect`\, which includes a lot of internet disconnection
errors.
This function is useful if... | def add_exception_type(self, exc):
r"""Adds an exception type to be handled during the reconnect logic.
By default the exception types handled are those handled by
:meth:`discord.Client.connect`\, which includes a lot of internet disconnection
errors.
This function is useful if... | [
"r",
"Adds",
"an",
"exception",
"type",
"to",
"be",
"handled",
"during",
"the",
"reconnect",
"logic",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/tasks/__init__.py#L137-L163 | [
"def",
"add_exception_type",
"(",
"self",
",",
"exc",
")",
":",
"if",
"not",
"inspect",
".",
"isclass",
"(",
"exc",
")",
":",
"raise",
"TypeError",
"(",
"'{0!r} must be a class.'",
".",
"format",
"(",
"exc",
")",
")",
"if",
"not",
"issubclass",
"(",
"exc... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Loop.remove_exception_type | Removes an exception type from being handled during the reconnect logic.
Parameters
------------
exc: Type[:class:`BaseException`]
The exception class to handle.
Returns
---------
:class:`bool`
Whether it was successfully removed. | discord/ext/tasks/__init__.py | def remove_exception_type(self, exc):
"""Removes an exception type from being handled during the reconnect logic.
Parameters
------------
exc: Type[:class:`BaseException`]
The exception class to handle.
Returns
---------
:class:`bool`
Whe... | def remove_exception_type(self, exc):
"""Removes an exception type from being handled during the reconnect logic.
Parameters
------------
exc: Type[:class:`BaseException`]
The exception class to handle.
Returns
---------
:class:`bool`
Whe... | [
"Removes",
"an",
"exception",
"type",
"from",
"being",
"handled",
"during",
"the",
"reconnect",
"logic",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/tasks/__init__.py#L174-L189 | [
"def",
"remove_exception_type",
"(",
"self",
",",
"exc",
")",
":",
"old_length",
"=",
"len",
"(",
"self",
".",
"_valid_exception",
")",
"self",
".",
"_valid_exception",
"=",
"tuple",
"(",
"x",
"for",
"x",
"in",
"self",
".",
"_valid_exception",
"if",
"x",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Loop.before_loop | A function that also acts as a decorator to register a coroutine to be
called before the loop starts running. This is useful if you want to wait
for some bot state before the loop starts,
such as :meth:`discord.Client.wait_until_ready`.
Parameters
------------
coro: :ter... | discord/ext/tasks/__init__.py | def before_loop(self, coro):
"""A function that also acts as a decorator to register a coroutine to be
called before the loop starts running. This is useful if you want to wait
for some bot state before the loop starts,
such as :meth:`discord.Client.wait_until_ready`.
Parameters... | def before_loop(self, coro):
"""A function that also acts as a decorator to register a coroutine to be
called before the loop starts running. This is useful if you want to wait
for some bot state before the loop starts,
such as :meth:`discord.Client.wait_until_ready`.
Parameters... | [
"A",
"function",
"that",
"also",
"acts",
"as",
"a",
"decorator",
"to",
"register",
"a",
"coroutine",
"to",
"be",
"called",
"before",
"the",
"loop",
"starts",
"running",
".",
"This",
"is",
"useful",
"if",
"you",
"want",
"to",
"wait",
"for",
"some",
"bot",... | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/tasks/__init__.py#L195-L215 | [
"def",
"before_loop",
"(",
"self",
",",
"coro",
")",
":",
"if",
"not",
"(",
"inspect",
".",
"iscoroutinefunction",
"(",
"coro",
")",
"or",
"inspect",
".",
"isawaitable",
"(",
"coro",
")",
")",
":",
"raise",
"TypeError",
"(",
"'Expected coroutine or awaitable... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Loop.after_loop | A function that also acts as a decorator to register a coroutine to be
called after the loop finished running.
Parameters
------------
coro: :term:`py:awaitable`
The coroutine to register after the loop finishes.
Raises
-------
TypeError
... | discord/ext/tasks/__init__.py | def after_loop(self, coro):
"""A function that also acts as a decorator to register a coroutine to be
called after the loop finished running.
Parameters
------------
coro: :term:`py:awaitable`
The coroutine to register after the loop finishes.
Raises
... | def after_loop(self, coro):
"""A function that also acts as a decorator to register a coroutine to be
called after the loop finished running.
Parameters
------------
coro: :term:`py:awaitable`
The coroutine to register after the loop finishes.
Raises
... | [
"A",
"function",
"that",
"also",
"acts",
"as",
"a",
"decorator",
"to",
"register",
"a",
"coroutine",
"to",
"be",
"called",
"after",
"the",
"loop",
"finished",
"running",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/tasks/__init__.py#L218-L236 | [
"def",
"after_loop",
"(",
"self",
",",
"coro",
")",
":",
"if",
"not",
"(",
"inspect",
".",
"iscoroutinefunction",
"(",
"coro",
")",
"or",
"inspect",
".",
"isawaitable",
"(",
"coro",
")",
")",
":",
"raise",
"TypeError",
"(",
"'Expected coroutine or awaitable,... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Context.invoke | r"""|coro|
Calls a command with the arguments given.
This is useful if you want to just call the callback that a
:class:`.Command` holds internally.
Note
------
You do not pass in the context as it is done for you.
Warning
---------
The first p... | discord/ext/commands/context.py | async def invoke(self, *args, **kwargs):
r"""|coro|
Calls a command with the arguments given.
This is useful if you want to just call the callback that a
:class:`.Command` holds internally.
Note
------
You do not pass in the context as it is done for you.
... | async def invoke(self, *args, **kwargs):
r"""|coro|
Calls a command with the arguments given.
This is useful if you want to just call the callback that a
:class:`.Command` holds internally.
Note
------
You do not pass in the context as it is done for you.
... | [
"r",
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/context.py#L89-L128 | [
"async",
"def",
"invoke",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"command",
"=",
"args",
"[",
"0",
"]",
"except",
"IndexError",
":",
"raise",
"TypeError",
"(",
"'Missing command to invoke.'",
")",
"from",
"None",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Context.reinvoke | |coro|
Calls the command again.
This is similar to :meth:`~.Context.invoke` except that it bypasses
checks, cooldowns, and error handlers.
.. note::
If you want to bypass :exc:`.UserInputError` derived exceptions,
it is recommended to use the regular :meth:`~.... | discord/ext/commands/context.py | async def reinvoke(self, *, call_hooks=False, restart=True):
"""|coro|
Calls the command again.
This is similar to :meth:`~.Context.invoke` except that it bypasses
checks, cooldowns, and error handlers.
.. note::
If you want to bypass :exc:`.UserInputError` derive... | async def reinvoke(self, *, call_hooks=False, restart=True):
"""|coro|
Calls the command again.
This is similar to :meth:`~.Context.invoke` except that it bypasses
checks, cooldowns, and error handlers.
.. note::
If you want to bypass :exc:`.UserInputError` derive... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/context.py#L130-L182 | [
"async",
"def",
"reinvoke",
"(",
"self",
",",
"*",
",",
"call_hooks",
"=",
"False",
",",
"restart",
"=",
"True",
")",
":",
"cmd",
"=",
"self",
".",
"command",
"view",
"=",
"self",
".",
"view",
"if",
"cmd",
"is",
"None",
":",
"raise",
"ValueError",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Context.me | Similar to :attr:`.Guild.me` except it may return the :class:`.ClientUser` in private message contexts. | discord/ext/commands/context.py | def me(self):
"""Similar to :attr:`.Guild.me` except it may return the :class:`.ClientUser` in private message contexts."""
return self.guild.me if self.guild is not None else self.bot.user | def me(self):
"""Similar to :attr:`.Guild.me` except it may return the :class:`.ClientUser` in private message contexts."""
return self.guild.me if self.guild is not None else self.bot.user | [
"Similar",
"to",
":",
"attr",
":",
".",
"Guild",
".",
"me",
"except",
"it",
"may",
"return",
"the",
":",
"class",
":",
".",
"ClientUser",
"in",
"private",
"message",
"contexts",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/context.py#L216-L218 | [
"def",
"me",
"(",
"self",
")",
":",
"return",
"self",
".",
"guild",
".",
"me",
"if",
"self",
".",
"guild",
"is",
"not",
"None",
"else",
"self",
".",
"bot",
".",
"user"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Context.send_help | send_help(entity=<bot>)
|coro|
Shows the help command for the specified entity if given.
The entity can be a command or a cog.
If no entity is given, then it'll show help for the
entire bot.
If the entity is a string, then it looks up whether it's a
:class:`Co... | discord/ext/commands/context.py | async def send_help(self, *args):
"""send_help(entity=<bot>)
|coro|
Shows the help command for the specified entity if given.
The entity can be a command or a cog.
If no entity is given, then it'll show help for the
entire bot.
If the entity is a string, then ... | async def send_help(self, *args):
"""send_help(entity=<bot>)
|coro|
Shows the help command for the specified entity if given.
The entity can be a command or a cog.
If no entity is given, then it'll show help for the
entire bot.
If the entity is a string, then ... | [
"send_help",
"(",
"entity",
"=",
"<bot",
">",
")"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/context.py#L226-L293 | [
"async",
"def",
"send_help",
"(",
"self",
",",
"*",
"args",
")",
":",
"from",
".",
"core",
"import",
"Group",
",",
"Command",
"bot",
"=",
"self",
".",
"bot",
"cmd",
"=",
"bot",
".",
"help_command",
"if",
"cmd",
"is",
"None",
":",
"return",
"None",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | ExponentialBackoff.delay | Compute the next delay
Returns the next delay to wait according to the exponential
backoff algorithm. This is a value between 0 and base * 2^exp
where exponent starts off at 1 and is incremented at every
invocation of this method up to a maximum of 10.
If a period of more than... | discord/backoff.py | def delay(self):
"""Compute the next delay
Returns the next delay to wait according to the exponential
backoff algorithm. This is a value between 0 and base * 2^exp
where exponent starts off at 1 and is incremented at every
invocation of this method up to a maximum of 10.
... | def delay(self):
"""Compute the next delay
Returns the next delay to wait according to the exponential
backoff algorithm. This is a value between 0 and base * 2^exp
where exponent starts off at 1 and is incremented at every
invocation of this method up to a maximum of 10.
... | [
"Compute",
"the",
"next",
"delay"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/backoff.py#L66-L85 | [
"def",
"delay",
"(",
"self",
")",
":",
"invocation",
"=",
"time",
".",
"monotonic",
"(",
")",
"interval",
"=",
"invocation",
"-",
"self",
".",
"_last_invocation",
"self",
".",
"_last_invocation",
"=",
"invocation",
"if",
"interval",
">",
"self",
".",
"_res... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Permissions.is_subset | Returns True if self has the same or fewer permissions as other. | discord/permissions.py | def is_subset(self, other):
"""Returns True if self has the same or fewer permissions as other."""
if isinstance(other, Permissions):
return (self.value & other.value) == self.value
else:
raise TypeError("cannot compare {} with {}".format(self.__class__.__name__, other.__... | def is_subset(self, other):
"""Returns True if self has the same or fewer permissions as other."""
if isinstance(other, Permissions):
return (self.value & other.value) == self.value
else:
raise TypeError("cannot compare {} with {}".format(self.__class__.__name__, other.__... | [
"Returns",
"True",
"if",
"self",
"has",
"the",
"same",
"or",
"fewer",
"permissions",
"as",
"other",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/permissions.py#L99-L104 | [
"def",
"is_subset",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"Permissions",
")",
":",
"return",
"(",
"self",
".",
"value",
"&",
"other",
".",
"value",
")",
"==",
"self",
".",
"value",
"else",
":",
"raise",
"TypeErro... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Permissions.update | r"""Bulk updates this permission object.
Allows you to set multiple attributes by using keyword
arguments. The names must be equivalent to the properties
listed. Extraneous key/value pairs will be silently ignored.
Parameters
------------
\*\*kwargs
A list o... | discord/permissions.py | def update(self, **kwargs):
r"""Bulk updates this permission object.
Allows you to set multiple attributes by using keyword
arguments. The names must be equivalent to the properties
listed. Extraneous key/value pairs will be silently ignored.
Parameters
------------
... | def update(self, **kwargs):
r"""Bulk updates this permission object.
Allows you to set multiple attributes by using keyword
arguments. The names must be equivalent to the properties
listed. Extraneous key/value pairs will be silently ignored.
Parameters
------------
... | [
"r",
"Bulk",
"updates",
"this",
"permission",
"object",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/permissions.py#L171-L190 | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"try",
":",
"is_property",
"=",
"isinstance",
"(",
"getattr",
"(",
"self",
".",
"__class__",
",",
"key",
")",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | AuditLogEntry.changes | :class:`AuditLogChanges`: The list of changes this entry has. | discord/audit_logs.py | def changes(self):
""":class:`AuditLogChanges`: The list of changes this entry has."""
obj = AuditLogChanges(self, self._changes)
del self._changes
return obj | def changes(self):
""":class:`AuditLogChanges`: The list of changes this entry has."""
obj = AuditLogChanges(self, self._changes)
del self._changes
return obj | [
":",
"class",
":",
"AuditLogChanges",
":",
"The",
"list",
"of",
"changes",
"this",
"entry",
"has",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/audit_logs.py#L286-L290 | [
"def",
"changes",
"(",
"self",
")",
":",
"obj",
"=",
"AuditLogChanges",
"(",
"self",
",",
"self",
".",
"_changes",
")",
"del",
"self",
".",
"_changes",
"return",
"obj"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | command | A decorator that transforms a function into a :class:`.Command`
or if called with :func:`.group`, :class:`.Group`.
By default the ``help`` attribute is received automatically from the
docstring of the function and is cleaned up with the use of
``inspect.cleandoc``. If the docstring is ``bytes``, then i... | discord/ext/commands/core.py | def command(name=None, cls=None, **attrs):
"""A decorator that transforms a function into a :class:`.Command`
or if called with :func:`.group`, :class:`.Group`.
By default the ``help`` attribute is received automatically from the
docstring of the function and is cleaned up with the use of
``inspect... | def command(name=None, cls=None, **attrs):
"""A decorator that transforms a function into a :class:`.Command`
or if called with :func:`.group`, :class:`.Group`.
By default the ``help`` attribute is received automatically from the
docstring of the function and is cleaned up with the use of
``inspect... | [
"A",
"decorator",
"that",
"transforms",
"a",
"function",
"into",
"a",
":",
"class",
":",
".",
"Command",
"or",
"if",
"called",
"with",
":",
"func",
":",
".",
"group",
":",
"class",
":",
".",
"Group",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1200-L1238 | [
"def",
"command",
"(",
"name",
"=",
"None",
",",
"cls",
"=",
"None",
",",
"*",
"*",
"attrs",
")",
":",
"if",
"cls",
"is",
"None",
":",
"cls",
"=",
"Command",
"def",
"decorator",
"(",
"func",
")",
":",
"if",
"isinstance",
"(",
"func",
",",
"Comman... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | group | A decorator that transforms a function into a :class:`.Group`.
This is similar to the :func:`.command` decorator but the ``cls``
parameter is set to :class:`Group` by default.
.. versionchanged:: 1.1.0
The ``cls`` parameter can now be passed. | discord/ext/commands/core.py | def group(name=None, **attrs):
"""A decorator that transforms a function into a :class:`.Group`.
This is similar to the :func:`.command` decorator but the ``cls``
parameter is set to :class:`Group` by default.
.. versionchanged:: 1.1.0
The ``cls`` parameter can now be passed.
"""
attr... | def group(name=None, **attrs):
"""A decorator that transforms a function into a :class:`.Group`.
This is similar to the :func:`.command` decorator but the ``cls``
parameter is set to :class:`Group` by default.
.. versionchanged:: 1.1.0
The ``cls`` parameter can now be passed.
"""
attr... | [
"A",
"decorator",
"that",
"transforms",
"a",
"function",
"into",
"a",
":",
"class",
":",
".",
"Group",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1240-L1251 | [
"def",
"group",
"(",
"name",
"=",
"None",
",",
"*",
"*",
"attrs",
")",
":",
"attrs",
".",
"setdefault",
"(",
"'cls'",
",",
"Group",
")",
"return",
"command",
"(",
"name",
"=",
"name",
",",
"*",
"*",
"attrs",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | check | r"""A decorator that adds a check to the :class:`.Command` or its
subclasses. These checks could be accessed via :attr:`.Command.checks`.
These checks should be predicates that take in a single parameter taking
a :class:`.Context`. If the check returns a ``False``\-like value then
during invocation a :... | discord/ext/commands/core.py | def check(predicate):
r"""A decorator that adds a check to the :class:`.Command` or its
subclasses. These checks could be accessed via :attr:`.Command.checks`.
These checks should be predicates that take in a single parameter taking
a :class:`.Context`. If the check returns a ``False``\-like value then... | def check(predicate):
r"""A decorator that adds a check to the :class:`.Command` or its
subclasses. These checks could be accessed via :attr:`.Command.checks`.
These checks should be predicates that take in a single parameter taking
a :class:`.Context`. If the check returns a ``False``\-like value then... | [
"r",
"A",
"decorator",
"that",
"adds",
"a",
"check",
"to",
"the",
":",
"class",
":",
".",
"Command",
"or",
"its",
"subclasses",
".",
"These",
"checks",
"could",
"be",
"accessed",
"via",
":",
"attr",
":",
".",
"Command",
".",
"checks",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1253-L1316 | [
"def",
"check",
"(",
"predicate",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"if",
"isinstance",
"(",
"func",
",",
"Command",
")",
":",
"func",
".",
"checks",
".",
"append",
"(",
"predicate",
")",
"else",
":",
"if",
"not",
"hasattr",
"(",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | has_role | A :func:`.check` that is added that checks if the member invoking the
command has the role specified via the name or ID specified.
If a string is specified, you must give the exact name of the role, including
caps and spelling.
If an integer is specified, you must give the exact snowflake ID of the ro... | discord/ext/commands/core.py | def has_role(item):
"""A :func:`.check` that is added that checks if the member invoking the
command has the role specified via the name or ID specified.
If a string is specified, you must give the exact name of the role, including
caps and spelling.
If an integer is specified, you must give the e... | def has_role(item):
"""A :func:`.check` that is added that checks if the member invoking the
command has the role specified via the name or ID specified.
If a string is specified, you must give the exact name of the role, including
caps and spelling.
If an integer is specified, you must give the e... | [
"A",
":",
"func",
":",
".",
"check",
"that",
"is",
"added",
"that",
"checks",
"if",
"the",
"member",
"invoking",
"the",
"command",
"has",
"the",
"role",
"specified",
"via",
"the",
"name",
"or",
"ID",
"specified",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1318-L1357 | [
"def",
"has_role",
"(",
"item",
")",
":",
"def",
"predicate",
"(",
"ctx",
")",
":",
"if",
"not",
"isinstance",
"(",
"ctx",
".",
"channel",
",",
"discord",
".",
"abc",
".",
"GuildChannel",
")",
":",
"raise",
"NoPrivateMessage",
"(",
")",
"if",
"isinstan... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | has_any_role | r"""A :func:`.check` that is added that checks if the member invoking the
command has **any** of the roles specified. This means that if they have
one out of the three roles specified, then this check will return `True`.
Similar to :func:`.has_role`\, the names or IDs passed in must be exact.
This che... | discord/ext/commands/core.py | def has_any_role(*items):
r"""A :func:`.check` that is added that checks if the member invoking the
command has **any** of the roles specified. This means that if they have
one out of the three roles specified, then this check will return `True`.
Similar to :func:`.has_role`\, the names or IDs passed i... | def has_any_role(*items):
r"""A :func:`.check` that is added that checks if the member invoking the
command has **any** of the roles specified. This means that if they have
one out of the three roles specified, then this check will return `True`.
Similar to :func:`.has_role`\, the names or IDs passed i... | [
"r",
"A",
":",
"func",
":",
".",
"check",
"that",
"is",
"added",
"that",
"checks",
"if",
"the",
"member",
"invoking",
"the",
"command",
"has",
"**",
"any",
"**",
"of",
"the",
"roles",
"specified",
".",
"This",
"means",
"that",
"if",
"they",
"have",
"... | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1359-L1399 | [
"def",
"has_any_role",
"(",
"*",
"items",
")",
":",
"def",
"predicate",
"(",
"ctx",
")",
":",
"if",
"not",
"isinstance",
"(",
"ctx",
".",
"channel",
",",
"discord",
".",
"abc",
".",
"GuildChannel",
")",
":",
"raise",
"NoPrivateMessage",
"(",
")",
"gett... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | bot_has_role | Similar to :func:`.has_role` except checks if the bot itself has the
role.
This check raises one of two special exceptions, :exc:`.BotMissingRole` if the bot
is missing the role, or :exc:`.NoPrivateMessage` if it is used in a private message.
Both inherit from :exc:`.CheckFailure`.
.. versionchang... | discord/ext/commands/core.py | def bot_has_role(item):
"""Similar to :func:`.has_role` except checks if the bot itself has the
role.
This check raises one of two special exceptions, :exc:`.BotMissingRole` if the bot
is missing the role, or :exc:`.NoPrivateMessage` if it is used in a private message.
Both inherit from :exc:`.Chec... | def bot_has_role(item):
"""Similar to :func:`.has_role` except checks if the bot itself has the
role.
This check raises one of two special exceptions, :exc:`.BotMissingRole` if the bot
is missing the role, or :exc:`.NoPrivateMessage` if it is used in a private message.
Both inherit from :exc:`.Chec... | [
"Similar",
"to",
":",
"func",
":",
".",
"has_role",
"except",
"checks",
"if",
"the",
"bot",
"itself",
"has",
"the",
"role",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1401-L1428 | [
"def",
"bot_has_role",
"(",
"item",
")",
":",
"def",
"predicate",
"(",
"ctx",
")",
":",
"ch",
"=",
"ctx",
".",
"channel",
"if",
"not",
"isinstance",
"(",
"ch",
",",
"discord",
".",
"abc",
".",
"GuildChannel",
")",
":",
"raise",
"NoPrivateMessage",
"(",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | bot_has_any_role | Similar to :func:`.has_any_role` except checks if the bot itself has
any of the roles listed.
This check raises one of two special exceptions, :exc:`.BotMissingAnyRole` if the bot
is missing all roles, or :exc:`.NoPrivateMessage` if it is used in a private message.
Both inherit from :exc:`.CheckFailure... | discord/ext/commands/core.py | def bot_has_any_role(*items):
"""Similar to :func:`.has_any_role` except checks if the bot itself has
any of the roles listed.
This check raises one of two special exceptions, :exc:`.BotMissingAnyRole` if the bot
is missing all roles, or :exc:`.NoPrivateMessage` if it is used in a private message.
... | def bot_has_any_role(*items):
"""Similar to :func:`.has_any_role` except checks if the bot itself has
any of the roles listed.
This check raises one of two special exceptions, :exc:`.BotMissingAnyRole` if the bot
is missing all roles, or :exc:`.NoPrivateMessage` if it is used in a private message.
... | [
"Similar",
"to",
":",
"func",
":",
".",
"has_any_role",
"except",
"checks",
"if",
"the",
"bot",
"itself",
"has",
"any",
"of",
"the",
"roles",
"listed",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1430-L1453 | [
"def",
"bot_has_any_role",
"(",
"*",
"items",
")",
":",
"def",
"predicate",
"(",
"ctx",
")",
":",
"ch",
"=",
"ctx",
".",
"channel",
"if",
"not",
"isinstance",
"(",
"ch",
",",
"discord",
".",
"abc",
".",
"GuildChannel",
")",
":",
"raise",
"NoPrivateMess... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | has_permissions | A :func:`.check` that is added that checks if the member has all of
the permissions necessary.
The permissions passed in must be exactly like the properties shown under
:class:`.discord.Permissions`.
This check raises a special exception, :exc:`.MissingPermissions`
that is inherited from :exc:`.Ch... | discord/ext/commands/core.py | def has_permissions(**perms):
"""A :func:`.check` that is added that checks if the member has all of
the permissions necessary.
The permissions passed in must be exactly like the properties shown under
:class:`.discord.Permissions`.
This check raises a special exception, :exc:`.MissingPermissions`... | def has_permissions(**perms):
"""A :func:`.check` that is added that checks if the member has all of
the permissions necessary.
The permissions passed in must be exactly like the properties shown under
:class:`.discord.Permissions`.
This check raises a special exception, :exc:`.MissingPermissions`... | [
"A",
":",
"func",
":",
".",
"check",
"that",
"is",
"added",
"that",
"checks",
"if",
"the",
"member",
"has",
"all",
"of",
"the",
"permissions",
"necessary",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1455-L1492 | [
"def",
"has_permissions",
"(",
"*",
"*",
"perms",
")",
":",
"def",
"predicate",
"(",
"ctx",
")",
":",
"ch",
"=",
"ctx",
".",
"channel",
"permissions",
"=",
"ch",
".",
"permissions_for",
"(",
"ctx",
".",
"author",
")",
"missing",
"=",
"[",
"perm",
"fo... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | bot_has_permissions | Similar to :func:`.has_permissions` except checks if the bot itself has
the permissions listed.
This check raises a special exception, :exc:`.BotMissingPermissions`
that is inherited from :exc:`.CheckFailure`. | discord/ext/commands/core.py | def bot_has_permissions(**perms):
"""Similar to :func:`.has_permissions` except checks if the bot itself has
the permissions listed.
This check raises a special exception, :exc:`.BotMissingPermissions`
that is inherited from :exc:`.CheckFailure`.
"""
def predicate(ctx):
guild = ctx.guil... | def bot_has_permissions(**perms):
"""Similar to :func:`.has_permissions` except checks if the bot itself has
the permissions listed.
This check raises a special exception, :exc:`.BotMissingPermissions`
that is inherited from :exc:`.CheckFailure`.
"""
def predicate(ctx):
guild = ctx.guil... | [
"Similar",
"to",
":",
"func",
":",
".",
"has_permissions",
"except",
"checks",
"if",
"the",
"bot",
"itself",
"has",
"the",
"permissions",
"listed",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1494-L1513 | [
"def",
"bot_has_permissions",
"(",
"*",
"*",
"perms",
")",
":",
"def",
"predicate",
"(",
"ctx",
")",
":",
"guild",
"=",
"ctx",
".",
"guild",
"me",
"=",
"guild",
".",
"me",
"if",
"guild",
"is",
"not",
"None",
"else",
"ctx",
".",
"bot",
".",
"user",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | is_owner | A :func:`.check` that checks if the person invoking this command is the
owner of the bot.
This is powered by :meth:`.Bot.is_owner`.
This check raises a special exception, :exc:`.NotOwner` that is derived
from :exc:`.CheckFailure`. | discord/ext/commands/core.py | def is_owner():
"""A :func:`.check` that checks if the person invoking this command is the
owner of the bot.
This is powered by :meth:`.Bot.is_owner`.
This check raises a special exception, :exc:`.NotOwner` that is derived
from :exc:`.CheckFailure`.
"""
async def predicate(ctx):
i... | def is_owner():
"""A :func:`.check` that checks if the person invoking this command is the
owner of the bot.
This is powered by :meth:`.Bot.is_owner`.
This check raises a special exception, :exc:`.NotOwner` that is derived
from :exc:`.CheckFailure`.
"""
async def predicate(ctx):
i... | [
"A",
":",
"func",
":",
".",
"check",
"that",
"checks",
"if",
"the",
"person",
"invoking",
"this",
"command",
"is",
"the",
"owner",
"of",
"the",
"bot",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1549-L1564 | [
"def",
"is_owner",
"(",
")",
":",
"async",
"def",
"predicate",
"(",
"ctx",
")",
":",
"if",
"not",
"await",
"ctx",
".",
"bot",
".",
"is_owner",
"(",
"ctx",
".",
"author",
")",
":",
"raise",
"NotOwner",
"(",
"'You do not own this bot.'",
")",
"return",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | is_nsfw | A :func:`.check` that checks if the channel is a NSFW channel.
This check raises a special exception, :exc:`.NSFWChannelRequired`
that is derived from :exc:`.CheckFailure`.
.. versionchanged:: 1.1.0
Raise :exc:`.NSFWChannelRequired instead of generic :exc:`.CheckFailure`.
DM channels will... | discord/ext/commands/core.py | def is_nsfw():
"""A :func:`.check` that checks if the channel is a NSFW channel.
This check raises a special exception, :exc:`.NSFWChannelRequired`
that is derived from :exc:`.CheckFailure`.
.. versionchanged:: 1.1.0
Raise :exc:`.NSFWChannelRequired instead of generic :exc:`.CheckFailure`.
... | def is_nsfw():
"""A :func:`.check` that checks if the channel is a NSFW channel.
This check raises a special exception, :exc:`.NSFWChannelRequired`
that is derived from :exc:`.CheckFailure`.
.. versionchanged:: 1.1.0
Raise :exc:`.NSFWChannelRequired instead of generic :exc:`.CheckFailure`.
... | [
"A",
":",
"func",
":",
".",
"check",
"that",
"checks",
"if",
"the",
"channel",
"is",
"a",
"NSFW",
"channel",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1566-L1582 | [
"def",
"is_nsfw",
"(",
")",
":",
"def",
"pred",
"(",
"ctx",
")",
":",
"ch",
"=",
"ctx",
".",
"channel",
"if",
"ctx",
".",
"guild",
"is",
"None",
"or",
"(",
"isinstance",
"(",
"ch",
",",
"discord",
".",
"TextChannel",
")",
"and",
"ch",
".",
"is_ns... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | cooldown | A decorator that adds a cooldown to a :class:`.Command`
or its subclasses.
A cooldown allows a command to only be used a specific amount
of times in a specific time frame. These cooldowns can be based
either on a per-guild, per-channel, per-user, or global basis.
Denoted by the third argument of ``... | discord/ext/commands/core.py | def cooldown(rate, per, type=BucketType.default):
"""A decorator that adds a cooldown to a :class:`.Command`
or its subclasses.
A cooldown allows a command to only be used a specific amount
of times in a specific time frame. These cooldowns can be based
either on a per-guild, per-channel, per-user,... | def cooldown(rate, per, type=BucketType.default):
"""A decorator that adds a cooldown to a :class:`.Command`
or its subclasses.
A cooldown allows a command to only be used a specific amount
of times in a specific time frame. These cooldowns can be based
either on a per-guild, per-channel, per-user,... | [
"A",
"decorator",
"that",
"adds",
"a",
"cooldown",
"to",
"a",
":",
"class",
":",
".",
"Command",
"or",
"its",
"subclasses",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1584-L1622 | [
"def",
"cooldown",
"(",
"rate",
",",
"per",
",",
"type",
"=",
"BucketType",
".",
"default",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"if",
"isinstance",
"(",
"func",
",",
"Command",
")",
":",
"func",
".",
"_buckets",
"=",
"CooldownMapping",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.update | Updates :class:`Command` instance with updated attribute.
This works similarly to the :func:`.command` decorator in terms
of parameters in that they are passed to the :class:`Command` or
subclass constructors, sans the name and callback. | discord/ext/commands/core.py | def update(self, **kwargs):
"""Updates :class:`Command` instance with updated attribute.
This works similarly to the :func:`.command` decorator in terms
of parameters in that they are passed to the :class:`Command` or
subclass constructors, sans the name and callback.
"""
... | def update(self, **kwargs):
"""Updates :class:`Command` instance with updated attribute.
This works similarly to the :func:`.command` decorator in terms
of parameters in that they are passed to the :class:`Command` or
subclass constructors, sans the name and callback.
"""
... | [
"Updates",
":",
"class",
":",
"Command",
"instance",
"with",
"updated",
"attribute",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L277-L284 | [
"def",
"update",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"__init__",
"(",
"self",
".",
"callback",
",",
"*",
"*",
"dict",
"(",
"self",
".",
"__original_kwargs__",
",",
"*",
"*",
"kwargs",
")",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.copy | Creates a copy of this :class:`Command`. | discord/ext/commands/core.py | def copy(self):
"""Creates a copy of this :class:`Command`."""
ret = self.__class__(self.callback, **self.__original_kwargs__)
return self._ensure_assignment_on_copy(ret) | def copy(self):
"""Creates a copy of this :class:`Command`."""
ret = self.__class__(self.callback, **self.__original_kwargs__)
return self._ensure_assignment_on_copy(ret) | [
"Creates",
"a",
"copy",
"of",
"this",
":",
"class",
":",
"Command",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L299-L302 | [
"def",
"copy",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"__class__",
"(",
"self",
".",
"callback",
",",
"*",
"*",
"self",
".",
"__original_kwargs__",
")",
"return",
"self",
".",
"_ensure_assignment_on_copy",
"(",
"ret",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.clean_params | Retrieves the parameter OrderedDict without the context or self parameters.
Useful for inspecting signature. | discord/ext/commands/core.py | def clean_params(self):
"""Retrieves the parameter OrderedDict without the context or self parameters.
Useful for inspecting signature.
"""
result = self.params.copy()
if self.cog is not None:
# first parameter is self
result.popitem(last=False)
... | def clean_params(self):
"""Retrieves the parameter OrderedDict without the context or self parameters.
Useful for inspecting signature.
"""
result = self.params.copy()
if self.cog is not None:
# first parameter is self
result.popitem(last=False)
... | [
"Retrieves",
"the",
"parameter",
"OrderedDict",
"without",
"the",
"context",
"or",
"self",
"parameters",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L488-L504 | [
"def",
"clean_params",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"params",
".",
"copy",
"(",
")",
"if",
"self",
".",
"cog",
"is",
"not",
"None",
":",
"# first parameter is self",
"result",
".",
"popitem",
"(",
"last",
"=",
"False",
")",
"try",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.full_parent_name | Retrieves the fully qualified parent command name.
This the base command name required to execute it. For example,
in ``?one two three`` the parent name would be ``one two``. | discord/ext/commands/core.py | def full_parent_name(self):
"""Retrieves the fully qualified parent command name.
This the base command name required to execute it. For example,
in ``?one two three`` the parent name would be ``one two``.
"""
entries = []
command = self
while command.parent is n... | def full_parent_name(self):
"""Retrieves the fully qualified parent command name.
This the base command name required to execute it. For example,
in ``?one two three`` the parent name would be ``one two``.
"""
entries = []
command = self
while command.parent is n... | [
"Retrieves",
"the",
"fully",
"qualified",
"parent",
"command",
"name",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L507-L519 | [
"def",
"full_parent_name",
"(",
"self",
")",
":",
"entries",
"=",
"[",
"]",
"command",
"=",
"self",
"while",
"command",
".",
"parent",
"is",
"not",
"None",
":",
"command",
"=",
"command",
".",
"parent",
"entries",
".",
"append",
"(",
"command",
".",
"n... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.parents | Retrieves the parents of this command.
If the command has no parents then it returns an empty :class:`list`.
For example in commands ``?a b c test``, the parents are ``[c, b, a]``.
.. versionadded:: 1.1.0 | discord/ext/commands/core.py | def parents(self):
"""Retrieves the parents of this command.
If the command has no parents then it returns an empty :class:`list`.
For example in commands ``?a b c test``, the parents are ``[c, b, a]``.
.. versionadded:: 1.1.0
"""
entries = []
command = self
... | def parents(self):
"""Retrieves the parents of this command.
If the command has no parents then it returns an empty :class:`list`.
For example in commands ``?a b c test``, the parents are ``[c, b, a]``.
.. versionadded:: 1.1.0
"""
entries = []
command = self
... | [
"Retrieves",
"the",
"parents",
"of",
"this",
"command",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L522-L537 | [
"def",
"parents",
"(",
"self",
")",
":",
"entries",
"=",
"[",
"]",
"command",
"=",
"self",
"while",
"command",
".",
"parent",
"is",
"not",
"None",
":",
"command",
"=",
"command",
".",
"parent",
"entries",
".",
"append",
"(",
"command",
")",
"return",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.qualified_name | Retrieves the fully qualified command name.
This is the full parent name with the command name as well.
For example, in ``?one two three`` the qualified name would be
``one two three``. | discord/ext/commands/core.py | def qualified_name(self):
"""Retrieves the fully qualified command name.
This is the full parent name with the command name as well.
For example, in ``?one two three`` the qualified name would be
``one two three``.
"""
parent = self.full_parent_name
if parent:
... | def qualified_name(self):
"""Retrieves the fully qualified command name.
This is the full parent name with the command name as well.
For example, in ``?one two three`` the qualified name would be
``one two three``.
"""
parent = self.full_parent_name
if parent:
... | [
"Retrieves",
"the",
"fully",
"qualified",
"command",
"name",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L552-L564 | [
"def",
"qualified_name",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"full_parent_name",
"if",
"parent",
":",
"return",
"parent",
"+",
"' '",
"+",
"self",
".",
"name",
"else",
":",
"return",
"self",
".",
"name"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.is_on_cooldown | Checks whether the command is currently on cooldown.
Parameters
-----------
ctx: :class:`.Context.`
The invocation context to use when checking the commands cooldown status.
Returns
--------
:class:`bool`
A boolean indicating if the command is on... | discord/ext/commands/core.py | def is_on_cooldown(self, ctx):
"""Checks whether the command is currently on cooldown.
Parameters
-----------
ctx: :class:`.Context.`
The invocation context to use when checking the commands cooldown status.
Returns
--------
:class:`bool`
... | def is_on_cooldown(self, ctx):
"""Checks whether the command is currently on cooldown.
Parameters
-----------
ctx: :class:`.Context.`
The invocation context to use when checking the commands cooldown status.
Returns
--------
:class:`bool`
... | [
"Checks",
"whether",
"the",
"command",
"is",
"currently",
"on",
"cooldown",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L686-L703 | [
"def",
"is_on_cooldown",
"(",
"self",
",",
"ctx",
")",
":",
"if",
"not",
"self",
".",
"_buckets",
".",
"valid",
":",
"return",
"False",
"bucket",
"=",
"self",
".",
"_buckets",
".",
"get_bucket",
"(",
"ctx",
".",
"message",
")",
"return",
"bucket",
".",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.reset_cooldown | Resets the cooldown on this command.
Parameters
-----------
ctx: :class:`.Context`
The invocation context to reset the cooldown under. | discord/ext/commands/core.py | def reset_cooldown(self, ctx):
"""Resets the cooldown on this command.
Parameters
-----------
ctx: :class:`.Context`
The invocation context to reset the cooldown under.
"""
if self._buckets.valid:
bucket = self._buckets.get_bucket(ctx.message)
... | def reset_cooldown(self, ctx):
"""Resets the cooldown on this command.
Parameters
-----------
ctx: :class:`.Context`
The invocation context to reset the cooldown under.
"""
if self._buckets.valid:
bucket = self._buckets.get_bucket(ctx.message)
... | [
"Resets",
"the",
"cooldown",
"on",
"this",
"command",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L705-L715 | [
"def",
"reset_cooldown",
"(",
"self",
",",
"ctx",
")",
":",
"if",
"self",
".",
"_buckets",
".",
"valid",
":",
"bucket",
"=",
"self",
".",
"_buckets",
".",
"get_bucket",
"(",
"ctx",
".",
"message",
")",
"bucket",
".",
"reset",
"(",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.error | A decorator that registers a coroutine as a local error handler.
A local error handler is an :func:`.on_command_error` event limited to
a single command. However, the :func:`.on_command_error` is still
invoked afterwards as the catch-all.
Parameters
-----------
coro: :r... | discord/ext/commands/core.py | def error(self, coro):
"""A decorator that registers a coroutine as a local error handler.
A local error handler is an :func:`.on_command_error` event limited to
a single command. However, the :func:`.on_command_error` is still
invoked afterwards as the catch-all.
Parameters
... | def error(self, coro):
"""A decorator that registers a coroutine as a local error handler.
A local error handler is an :func:`.on_command_error` event limited to
a single command. However, the :func:`.on_command_error` is still
invoked afterwards as the catch-all.
Parameters
... | [
"A",
"decorator",
"that",
"registers",
"a",
"coroutine",
"as",
"a",
"local",
"error",
"handler",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L744-L766 | [
"def",
"error",
"(",
"self",
",",
"coro",
")",
":",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"'The error handler must be a coroutine.'",
")",
"self",
".",
"on_error",
"=",
"coro",
"return",
"coro"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.before_invoke | A decorator that registers a coroutine as a pre-invoke hook.
A pre-invoke hook is called directly before the command is
called. This makes it a useful function to set up database
connections or any type of set up required.
This pre-invoke hook takes a sole parameter, a :class:`.Context... | discord/ext/commands/core.py | def before_invoke(self, coro):
"""A decorator that registers a coroutine as a pre-invoke hook.
A pre-invoke hook is called directly before the command is
called. This makes it a useful function to set up database
connections or any type of set up required.
This pre-invoke hook ... | def before_invoke(self, coro):
"""A decorator that registers a coroutine as a pre-invoke hook.
A pre-invoke hook is called directly before the command is
called. This makes it a useful function to set up database
connections or any type of set up required.
This pre-invoke hook ... | [
"A",
"decorator",
"that",
"registers",
"a",
"coroutine",
"as",
"a",
"pre",
"-",
"invoke",
"hook",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L768-L793 | [
"def",
"before_invoke",
"(",
"self",
",",
"coro",
")",
":",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"'The pre-invoke hook must be a coroutine.'",
")",
"self",
".",
"_before_invoke",
"=",
"coro",
"retu... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.after_invoke | A decorator that registers a coroutine as a post-invoke hook.
A post-invoke hook is called directly after the command is
called. This makes it a useful function to clean-up database
connections or any type of clean up required.
This post-invoke hook takes a sole parameter, a :class:`.C... | discord/ext/commands/core.py | def after_invoke(self, coro):
"""A decorator that registers a coroutine as a post-invoke hook.
A post-invoke hook is called directly after the command is
called. This makes it a useful function to clean-up database
connections or any type of clean up required.
This post-invoke ... | def after_invoke(self, coro):
"""A decorator that registers a coroutine as a post-invoke hook.
A post-invoke hook is called directly after the command is
called. This makes it a useful function to clean-up database
connections or any type of clean up required.
This post-invoke ... | [
"A",
"decorator",
"that",
"registers",
"a",
"coroutine",
"as",
"a",
"post",
"-",
"invoke",
"hook",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L795-L820 | [
"def",
"after_invoke",
"(",
"self",
",",
"coro",
")",
":",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"'The post-invoke hook must be a coroutine.'",
")",
"self",
".",
"_after_invoke",
"=",
"coro",
"retur... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.short_doc | Gets the "short" documentation of a command.
By default, this is the :attr:`brief` attribute.
If that lookup leads to an empty string then the first line of the
:attr:`help` attribute is used instead. | discord/ext/commands/core.py | def short_doc(self):
"""Gets the "short" documentation of a command.
By default, this is the :attr:`brief` attribute.
If that lookup leads to an empty string then the first line of the
:attr:`help` attribute is used instead.
"""
if self.brief is not None:
ret... | def short_doc(self):
"""Gets the "short" documentation of a command.
By default, this is the :attr:`brief` attribute.
If that lookup leads to an empty string then the first line of the
:attr:`help` attribute is used instead.
"""
if self.brief is not None:
ret... | [
"Gets",
"the",
"short",
"documentation",
"of",
"a",
"command",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L828-L839 | [
"def",
"short_doc",
"(",
"self",
")",
":",
"if",
"self",
".",
"brief",
"is",
"not",
"None",
":",
"return",
"self",
".",
"brief",
"if",
"self",
".",
"help",
"is",
"not",
"None",
":",
"return",
"self",
".",
"help",
".",
"split",
"(",
"'\\n'",
",",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.signature | Returns a POSIX-like signature useful for help command output. | discord/ext/commands/core.py | def signature(self):
"""Returns a POSIX-like signature useful for help command output."""
if self.usage is not None:
return self.usage
params = self.clean_params
if not params:
return ''
result = []
for name, param in params.items():
... | def signature(self):
"""Returns a POSIX-like signature useful for help command output."""
if self.usage is not None:
return self.usage
params = self.clean_params
if not params:
return ''
result = []
for name, param in params.items():
... | [
"Returns",
"a",
"POSIX",
"-",
"like",
"signature",
"useful",
"for",
"help",
"command",
"output",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L853-L887 | [
"def",
"signature",
"(",
"self",
")",
":",
"if",
"self",
".",
"usage",
"is",
"not",
"None",
":",
"return",
"self",
".",
"usage",
"params",
"=",
"self",
".",
"clean_params",
"if",
"not",
"params",
":",
"return",
"''",
"result",
"=",
"[",
"]",
"for",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Command.can_run | |coro|
Checks if the command can be executed by checking all the predicates
inside the :attr:`.checks` attribute.
Parameters
-----------
ctx: :class:`.Context`
The ctx of the command currently being invoked.
Raises
-------
:class:`CommandErr... | discord/ext/commands/core.py | async def can_run(self, ctx):
"""|coro|
Checks if the command can be executed by checking all the predicates
inside the :attr:`.checks` attribute.
Parameters
-----------
ctx: :class:`.Context`
The ctx of the command currently being invoked.
Raises
... | async def can_run(self, ctx):
"""|coro|
Checks if the command can be executed by checking all the predicates
inside the :attr:`.checks` attribute.
Parameters
-----------
ctx: :class:`.Context`
The ctx of the command currently being invoked.
Raises
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L889-L934 | [
"async",
"def",
"can_run",
"(",
"self",
",",
"ctx",
")",
":",
"original",
"=",
"ctx",
".",
"command",
"ctx",
".",
"command",
"=",
"self",
"try",
":",
"if",
"not",
"await",
"ctx",
".",
"bot",
".",
"can_run",
"(",
"ctx",
")",
":",
"raise",
"CheckFail... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | GroupMixin.add_command | Adds a :class:`.Command` or its subclasses into the internal list
of commands.
This is usually not called, instead the :meth:`~.GroupMixin.command` or
:meth:`~.GroupMixin.group` shortcut decorators are used instead.
Parameters
-----------
command
The command... | discord/ext/commands/core.py | def add_command(self, command):
"""Adds a :class:`.Command` or its subclasses into the internal list
of commands.
This is usually not called, instead the :meth:`~.GroupMixin.command` or
:meth:`~.GroupMixin.group` shortcut decorators are used instead.
Parameters
--------... | def add_command(self, command):
"""Adds a :class:`.Command` or its subclasses into the internal list
of commands.
This is usually not called, instead the :meth:`~.GroupMixin.command` or
:meth:`~.GroupMixin.group` shortcut decorators are used instead.
Parameters
--------... | [
"Adds",
"a",
":",
"class",
":",
".",
"Command",
"or",
"its",
"subclasses",
"into",
"the",
"internal",
"list",
"of",
"commands",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L965-L998 | [
"def",
"add_command",
"(",
"self",
",",
"command",
")",
":",
"if",
"not",
"isinstance",
"(",
"command",
",",
"Command",
")",
":",
"raise",
"TypeError",
"(",
"'The command passed must be a subclass of Command'",
")",
"if",
"isinstance",
"(",
"self",
",",
"Command... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | GroupMixin.remove_command | Remove a :class:`.Command` or subclasses from the internal list
of commands.
This could also be used as a way to remove aliases.
Parameters
-----------
name: :class:`str`
The name of the command to remove.
Returns
--------
:class:`.Command` ... | discord/ext/commands/core.py | def remove_command(self, name):
"""Remove a :class:`.Command` or subclasses from the internal list
of commands.
This could also be used as a way to remove aliases.
Parameters
-----------
name: :class:`str`
The name of the command to remove.
Returns
... | def remove_command(self, name):
"""Remove a :class:`.Command` or subclasses from the internal list
of commands.
This could also be used as a way to remove aliases.
Parameters
-----------
name: :class:`str`
The name of the command to remove.
Returns
... | [
"Remove",
"a",
":",
"class",
":",
".",
"Command",
"or",
"subclasses",
"from",
"the",
"internal",
"list",
"of",
"commands",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1000-L1030 | [
"def",
"remove_command",
"(",
"self",
",",
"name",
")",
":",
"command",
"=",
"self",
".",
"all_commands",
".",
"pop",
"(",
"name",
",",
"None",
")",
"# does not exist",
"if",
"command",
"is",
"None",
":",
"return",
"None",
"if",
"name",
"in",
"command",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | GroupMixin.walk_commands | An iterator that recursively walks through all commands and subcommands. | discord/ext/commands/core.py | def walk_commands(self):
"""An iterator that recursively walks through all commands and subcommands."""
for command in tuple(self.all_commands.values()):
yield command
if isinstance(command, GroupMixin):
yield from command.walk_commands() | def walk_commands(self):
"""An iterator that recursively walks through all commands and subcommands."""
for command in tuple(self.all_commands.values()):
yield command
if isinstance(command, GroupMixin):
yield from command.walk_commands() | [
"An",
"iterator",
"that",
"recursively",
"walks",
"through",
"all",
"commands",
"and",
"subcommands",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1032-L1037 | [
"def",
"walk_commands",
"(",
"self",
")",
":",
"for",
"command",
"in",
"tuple",
"(",
"self",
".",
"all_commands",
".",
"values",
"(",
")",
")",
":",
"yield",
"command",
"if",
"isinstance",
"(",
"command",
",",
"GroupMixin",
")",
":",
"yield",
"from",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | GroupMixin.get_command | Get a :class:`.Command` or subclasses from the internal list
of commands.
This could also be used as a way to get aliases.
The name could be fully qualified (e.g. ``'foo bar'``) will get
the subcommand ``bar`` of the group command ``foo``. If a
subcommand is not found then ``No... | discord/ext/commands/core.py | def get_command(self, name):
"""Get a :class:`.Command` or subclasses from the internal list
of commands.
This could also be used as a way to get aliases.
The name could be fully qualified (e.g. ``'foo bar'``) will get
the subcommand ``bar`` of the group command ``foo``. If a
... | def get_command(self, name):
"""Get a :class:`.Command` or subclasses from the internal list
of commands.
This could also be used as a way to get aliases.
The name could be fully qualified (e.g. ``'foo bar'``) will get
the subcommand ``bar`` of the group command ``foo``. If a
... | [
"Get",
"a",
":",
"class",
":",
".",
"Command",
"or",
"subclasses",
"from",
"the",
"internal",
"list",
"of",
"commands",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1039-L1075 | [
"def",
"get_command",
"(",
"self",
",",
"name",
")",
":",
"# fast path, no space in name.",
"if",
"' '",
"not",
"in",
"name",
":",
"return",
"self",
".",
"all_commands",
".",
"get",
"(",
"name",
")",
"names",
"=",
"name",
".",
"split",
"(",
")",
"obj",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | GroupMixin.command | A shortcut decorator that invokes :func:`.command` and adds it to
the internal command list via :meth:`~.GroupMixin.add_command`. | discord/ext/commands/core.py | def command(self, *args, **kwargs):
"""A shortcut decorator that invokes :func:`.command` and adds it to
the internal command list via :meth:`~.GroupMixin.add_command`.
"""
def decorator(func):
kwargs.setdefault('parent', self)
result = command(*args, **kwargs)(fu... | def command(self, *args, **kwargs):
"""A shortcut decorator that invokes :func:`.command` and adds it to
the internal command list via :meth:`~.GroupMixin.add_command`.
"""
def decorator(func):
kwargs.setdefault('parent', self)
result = command(*args, **kwargs)(fu... | [
"A",
"shortcut",
"decorator",
"that",
"invokes",
":",
"func",
":",
".",
"command",
"and",
"adds",
"it",
"to",
"the",
"internal",
"command",
"list",
"via",
":",
"meth",
":",
"~",
".",
"GroupMixin",
".",
"add_command",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1077-L1087 | [
"def",
"command",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'parent'",
",",
"self",
")",
"result",
"=",
"command",
"(",
"*",
"args",
",",
"*",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Group.copy | Creates a copy of this :class:`Group`. | discord/ext/commands/core.py | def copy(self):
"""Creates a copy of this :class:`Group`."""
ret = super().copy()
for cmd in self.commands:
ret.add_command(cmd.copy())
return ret | def copy(self):
"""Creates a copy of this :class:`Group`."""
ret = super().copy()
for cmd in self.commands:
ret.add_command(cmd.copy())
return ret | [
"Creates",
"a",
"copy",
"of",
"this",
":",
"class",
":",
"Group",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/core.py#L1127-L1132 | [
"def",
"copy",
"(",
"self",
")",
":",
"ret",
"=",
"super",
"(",
")",
".",
"copy",
"(",
")",
"for",
"cmd",
"in",
"self",
".",
"commands",
":",
"ret",
".",
"add_command",
"(",
"cmd",
".",
"copy",
"(",
")",
")",
"return",
"ret"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Asset.read | |coro|
Retrieves the content of this asset as a :class:`bytes` object.
.. warning::
:class:`PartialEmoji` won't have a connection state if user created,
and a URL won't be present if a custom image isn't associated with
the asset, e.g. a guild with no custom icon.
... | discord/asset.py | async def read(self):
"""|coro|
Retrieves the content of this asset as a :class:`bytes` object.
.. warning::
:class:`PartialEmoji` won't have a connection state if user created,
and a URL won't be present if a custom image isn't associated with
the asset, e... | async def read(self):
"""|coro|
Retrieves the content of this asset as a :class:`bytes` object.
.. warning::
:class:`PartialEmoji` won't have a connection state if user created,
and a URL won't be present if a custom image isn't associated with
the asset, e... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/asset.py#L133-L166 | [
"async",
"def",
"read",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_url",
":",
"raise",
"DiscordException",
"(",
"'Invalid asset (no URL provided)'",
")",
"if",
"self",
".",
"_state",
"is",
"None",
":",
"raise",
"DiscordException",
"(",
"'Invalid state ... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Asset.save | |coro|
Saves this asset into a file-like object.
Parameters
----------
fp: Union[BinaryIO, :class:`os.PathLike`]
Same as in :meth:`Attachment.save`.
seek_begin: :class:`bool`
Same as in :meth:`Attachment.save`.
Raises
------
Same... | discord/asset.py | async def save(self, fp, *, seek_begin=True):
"""|coro|
Saves this asset into a file-like object.
Parameters
----------
fp: Union[BinaryIO, :class:`os.PathLike`]
Same as in :meth:`Attachment.save`.
seek_begin: :class:`bool`
Same as in :meth:`Atta... | async def save(self, fp, *, seek_begin=True):
"""|coro|
Saves this asset into a file-like object.
Parameters
----------
fp: Union[BinaryIO, :class:`os.PathLike`]
Same as in :meth:`Attachment.save`.
seek_begin: :class:`bool`
Same as in :meth:`Atta... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/asset.py#L168-L198 | [
"async",
"def",
"save",
"(",
"self",
",",
"fp",
",",
"*",
",",
"seek_begin",
"=",
"True",
")",
":",
"data",
"=",
"await",
"self",
".",
"read",
"(",
")",
"if",
"isinstance",
"(",
"fp",
",",
"io",
".",
"IOBase",
")",
"and",
"fp",
".",
"writable",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DiscordWebSocket.from_client | Creates a main websocket for Discord from a :class:`Client`.
This is for internal use only. | discord/gateway.py | async def from_client(cls, client, *, shard_id=None, session=None, sequence=None, resume=False):
"""Creates a main websocket for Discord from a :class:`Client`.
This is for internal use only.
"""
gateway = await client.http.get_gateway()
ws = await websockets.connect(gateway, lo... | async def from_client(cls, client, *, shard_id=None, session=None, sequence=None, resume=False):
"""Creates a main websocket for Discord from a :class:`Client`.
This is for internal use only.
"""
gateway = await client.http.get_gateway()
ws = await websockets.connect(gateway, lo... | [
"Creates",
"a",
"main",
"websocket",
"for",
"Discord",
"from",
"a",
":",
"class",
":",
"Client",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/gateway.py#L219-L257 | [
"async",
"def",
"from_client",
"(",
"cls",
",",
"client",
",",
"*",
",",
"shard_id",
"=",
"None",
",",
"session",
"=",
"None",
",",
"sequence",
"=",
"None",
",",
"resume",
"=",
"False",
")",
":",
"gateway",
"=",
"await",
"client",
".",
"http",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DiscordWebSocket.wait_for | Waits for a DISPATCH'd event that meets the predicate.
Parameters
-----------
event: :class:`str`
The event name in all upper case to wait for.
predicate
A function that takes a data parameter to check for event
properties. The data parameter is the '... | discord/gateway.py | def wait_for(self, event, predicate, result=None):
"""Waits for a DISPATCH'd event that meets the predicate.
Parameters
-----------
event: :class:`str`
The event name in all upper case to wait for.
predicate
A function that takes a data parameter to check... | def wait_for(self, event, predicate, result=None):
"""Waits for a DISPATCH'd event that meets the predicate.
Parameters
-----------
event: :class:`str`
The event name in all upper case to wait for.
predicate
A function that takes a data parameter to check... | [
"Waits",
"for",
"a",
"DISPATCH",
"d",
"event",
"that",
"meets",
"the",
"predicate",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/gateway.py#L259-L282 | [
"def",
"wait_for",
"(",
"self",
",",
"event",
",",
"predicate",
",",
"result",
"=",
"None",
")",
":",
"future",
"=",
"self",
".",
"loop",
".",
"create_future",
"(",
")",
"entry",
"=",
"EventListener",
"(",
"event",
"=",
"event",
",",
"predicate",
"=",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DiscordWebSocket.identify | Sends the IDENTIFY packet. | discord/gateway.py | async def identify(self):
"""Sends the IDENTIFY packet."""
payload = {
'op': self.IDENTIFY,
'd': {
'token': self.token,
'properties': {
'$os': sys.platform,
'$browser': 'discord.py',
'$dev... | async def identify(self):
"""Sends the IDENTIFY packet."""
payload = {
'op': self.IDENTIFY,
'd': {
'token': self.token,
'properties': {
'$os': sys.platform,
'$browser': 'discord.py',
'$dev... | [
"Sends",
"the",
"IDENTIFY",
"packet",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/gateway.py#L284-L319 | [
"async",
"def",
"identify",
"(",
"self",
")",
":",
"payload",
"=",
"{",
"'op'",
":",
"self",
".",
"IDENTIFY",
",",
"'d'",
":",
"{",
"'token'",
":",
"self",
".",
"token",
",",
"'properties'",
":",
"{",
"'$os'",
":",
"sys",
".",
"platform",
",",
"'$b... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DiscordWebSocket.resume | Sends the RESUME packet. | discord/gateway.py | async def resume(self):
"""Sends the RESUME packet."""
payload = {
'op': self.RESUME,
'd': {
'seq': self.sequence,
'session_id': self.session_id,
'token': self.token
}
}
await self.send_as_json(payload)
... | async def resume(self):
"""Sends the RESUME packet."""
payload = {
'op': self.RESUME,
'd': {
'seq': self.sequence,
'session_id': self.session_id,
'token': self.token
}
}
await self.send_as_json(payload)
... | [
"Sends",
"the",
"RESUME",
"packet",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/gateway.py#L321-L333 | [
"async",
"def",
"resume",
"(",
"self",
")",
":",
"payload",
"=",
"{",
"'op'",
":",
"self",
".",
"RESUME",
",",
"'d'",
":",
"{",
"'seq'",
":",
"self",
".",
"sequence",
",",
"'session_id'",
":",
"self",
".",
"session_id",
",",
"'token'",
":",
"self",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DiscordWebSocket.poll_event | Polls for a DISPATCH event and handles the general gateway loop.
Raises
------
ConnectionClosed
The websocket connection was terminated for unhandled reasons. | discord/gateway.py | async def poll_event(self):
"""Polls for a DISPATCH event and handles the general gateway loop.
Raises
------
ConnectionClosed
The websocket connection was terminated for unhandled reasons.
"""
try:
msg = await self.recv()
await self.r... | async def poll_event(self):
"""Polls for a DISPATCH event and handles the general gateway loop.
Raises
------
ConnectionClosed
The websocket connection was terminated for unhandled reasons.
"""
try:
msg = await self.recv()
await self.r... | [
"Polls",
"for",
"a",
"DISPATCH",
"event",
"and",
"handles",
"the",
"general",
"gateway",
"loop",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/gateway.py#L460-L477 | [
"async",
"def",
"poll_event",
"(",
"self",
")",
":",
"try",
":",
"msg",
"=",
"await",
"self",
".",
"recv",
"(",
")",
"await",
"self",
".",
"received_message",
"(",
"msg",
")",
"except",
"websockets",
".",
"exceptions",
".",
"ConnectionClosed",
"as",
"exc... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DiscordVoiceWebSocket.from_client | Creates a voice websocket for the :class:`VoiceClient`. | discord/gateway.py | async def from_client(cls, client, *, resume=False):
"""Creates a voice websocket for the :class:`VoiceClient`."""
gateway = 'wss://' + client.endpoint + '/?v=4'
ws = await websockets.connect(gateway, loop=client.loop, klass=cls, compression=None)
ws.gateway = gateway
ws._connect... | async def from_client(cls, client, *, resume=False):
"""Creates a voice websocket for the :class:`VoiceClient`."""
gateway = 'wss://' + client.endpoint + '/?v=4'
ws = await websockets.connect(gateway, loop=client.loop, klass=cls, compression=None)
ws.gateway = gateway
ws._connect... | [
"Creates",
"a",
"voice",
"websocket",
"for",
"the",
":",
"class",
":",
"VoiceClient",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/gateway.py#L625-L638 | [
"async",
"def",
"from_client",
"(",
"cls",
",",
"client",
",",
"*",
",",
"resume",
"=",
"False",
")",
":",
"gateway",
"=",
"'wss://'",
"+",
"client",
".",
"endpoint",
"+",
"'/?v=4'",
"ws",
"=",
"await",
"websockets",
".",
"connect",
"(",
"gateway",
","... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Paginator.clear | Clears the paginator to have no pages. | discord/ext/commands/help.py | def clear(self):
"""Clears the paginator to have no pages."""
if self.prefix is not None:
self._current_page = [self.prefix]
self._count = len(self.prefix) + 1 # prefix + newline
else:
self._current_page = []
self._count = 0
self._pages = [... | def clear(self):
"""Clears the paginator to have no pages."""
if self.prefix is not None:
self._current_page = [self.prefix]
self._count = len(self.prefix) + 1 # prefix + newline
else:
self._current_page = []
self._count = 0
self._pages = [... | [
"Clears",
"the",
"paginator",
"to",
"have",
"no",
"pages",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L89-L97 | [
"def",
"clear",
"(",
"self",
")",
":",
"if",
"self",
".",
"prefix",
"is",
"not",
"None",
":",
"self",
".",
"_current_page",
"=",
"[",
"self",
".",
"prefix",
"]",
"self",
".",
"_count",
"=",
"len",
"(",
"self",
".",
"prefix",
")",
"+",
"1",
"# pre... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Paginator.add_line | Adds a line to the current page.
If the line exceeds the :attr:`max_size` then an exception
is raised.
Parameters
-----------
line: :class:`str`
The line to add.
empty: :class:`bool`
Indicates if another empty line should be added.
Raise... | discord/ext/commands/help.py | def add_line(self, line='', *, empty=False):
"""Adds a line to the current page.
If the line exceeds the :attr:`max_size` then an exception
is raised.
Parameters
-----------
line: :class:`str`
The line to add.
empty: :class:`bool`
Indicat... | def add_line(self, line='', *, empty=False):
"""Adds a line to the current page.
If the line exceeds the :attr:`max_size` then an exception
is raised.
Parameters
-----------
line: :class:`str`
The line to add.
empty: :class:`bool`
Indicat... | [
"Adds",
"a",
"line",
"to",
"the",
"current",
"page",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L103-L133 | [
"def",
"add_line",
"(",
"self",
",",
"line",
"=",
"''",
",",
"*",
",",
"empty",
"=",
"False",
")",
":",
"max_page_size",
"=",
"self",
".",
"max_size",
"-",
"self",
".",
"_prefix_len",
"-",
"2",
"if",
"len",
"(",
"line",
")",
">",
"max_page_size",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Paginator.close_page | Prematurely terminate a page. | discord/ext/commands/help.py | def close_page(self):
"""Prematurely terminate a page."""
if self.suffix is not None:
self._current_page.append(self.suffix)
self._pages.append('\n'.join(self._current_page))
if self.prefix is not None:
self._current_page = [self.prefix]
self._count =... | def close_page(self):
"""Prematurely terminate a page."""
if self.suffix is not None:
self._current_page.append(self.suffix)
self._pages.append('\n'.join(self._current_page))
if self.prefix is not None:
self._current_page = [self.prefix]
self._count =... | [
"Prematurely",
"terminate",
"a",
"page",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L135-L146 | [
"def",
"close_page",
"(",
"self",
")",
":",
"if",
"self",
".",
"suffix",
"is",
"not",
"None",
":",
"self",
".",
"_current_page",
".",
"append",
"(",
"self",
".",
"suffix",
")",
"self",
".",
"_pages",
".",
"append",
"(",
"'\\n'",
".",
"join",
"(",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.get_bot_mapping | Retrieves the bot mapping passed to :meth:`send_bot_help`. | discord/ext/commands/help.py | def get_bot_mapping(self):
"""Retrieves the bot mapping passed to :meth:`send_bot_help`."""
bot = self.context.bot
mapping = {
cog: cog.get_commands()
for cog in bot.cogs.values()
}
mapping[None] = [c for c in bot.all_commands.values() if c.cog is None]
... | def get_bot_mapping(self):
"""Retrieves the bot mapping passed to :meth:`send_bot_help`."""
bot = self.context.bot
mapping = {
cog: cog.get_commands()
for cog in bot.cogs.values()
}
mapping[None] = [c for c in bot.all_commands.values() if c.cog is None]
... | [
"Retrieves",
"the",
"bot",
"mapping",
"passed",
"to",
":",
"meth",
":",
"send_bot_help",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L325-L333 | [
"def",
"get_bot_mapping",
"(",
"self",
")",
":",
"bot",
"=",
"self",
".",
"context",
".",
"bot",
"mapping",
"=",
"{",
"cog",
":",
"cog",
".",
"get_commands",
"(",
")",
"for",
"cog",
"in",
"bot",
".",
"cogs",
".",
"values",
"(",
")",
"}",
"mapping",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.clean_prefix | The cleaned up invoke prefix. i.e. mentions are ``@name`` instead of ``<@id>``. | discord/ext/commands/help.py | def clean_prefix(self):
"""The cleaned up invoke prefix. i.e. mentions are ``@name`` instead of ``<@id>``."""
user = self.context.guild.me if self.context.guild else self.context.bot.user
# this breaks if the prefix mention is not the bot itself but I
# consider this to be an *incredibly... | def clean_prefix(self):
"""The cleaned up invoke prefix. i.e. mentions are ``@name`` instead of ``<@id>``."""
user = self.context.guild.me if self.context.guild else self.context.bot.user
# this breaks if the prefix mention is not the bot itself but I
# consider this to be an *incredibly... | [
"The",
"cleaned",
"up",
"invoke",
"prefix",
".",
"i",
".",
"e",
".",
"mentions",
"are"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L336-L343 | [
"def",
"clean_prefix",
"(",
"self",
")",
":",
"user",
"=",
"self",
".",
"context",
".",
"guild",
".",
"me",
"if",
"self",
".",
"context",
".",
"guild",
"else",
"self",
".",
"context",
".",
"bot",
".",
"user",
"# this breaks if the prefix mention is not the b... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.invoked_with | Similar to :attr:`Context.invoked_with` except properly handles
the case where :meth:`Context.send_help` is used.
If the help command was used regularly then this returns
the :attr:`Context.invoked_with` attribute. Otherwise, if
it the help command was called using :meth:`Context.send_h... | discord/ext/commands/help.py | def invoked_with(self):
"""Similar to :attr:`Context.invoked_with` except properly handles
the case where :meth:`Context.send_help` is used.
If the help command was used regularly then this returns
the :attr:`Context.invoked_with` attribute. Otherwise, if
it the help command was... | def invoked_with(self):
"""Similar to :attr:`Context.invoked_with` except properly handles
the case where :meth:`Context.send_help` is used.
If the help command was used regularly then this returns
the :attr:`Context.invoked_with` attribute. Otherwise, if
it the help command was... | [
"Similar",
"to",
":",
"attr",
":",
"Context",
".",
"invoked_with",
"except",
"properly",
"handles",
"the",
"case",
"where",
":",
"meth",
":",
"Context",
".",
"send_help",
"is",
"used",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L346-L364 | [
"def",
"invoked_with",
"(",
"self",
")",
":",
"command_name",
"=",
"self",
".",
"_command_impl",
".",
"name",
"ctx",
"=",
"self",
".",
"context",
"if",
"ctx",
"is",
"None",
"or",
"ctx",
".",
"command",
"is",
"None",
"or",
"ctx",
".",
"command",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.get_command_signature | Retrieves the signature portion of the help page.
Parameters
------------
command: :class:`Command`
The command to get the signature of.
Returns
--------
:class:`str`
The signature for the command. | discord/ext/commands/help.py | def get_command_signature(self, command):
"""Retrieves the signature portion of the help page.
Parameters
------------
command: :class:`Command`
The command to get the signature of.
Returns
--------
:class:`str`
The signature for the comm... | def get_command_signature(self, command):
"""Retrieves the signature portion of the help page.
Parameters
------------
command: :class:`Command`
The command to get the signature of.
Returns
--------
:class:`str`
The signature for the comm... | [
"Retrieves",
"the",
"signature",
"portion",
"of",
"the",
"help",
"page",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L366-L390 | [
"def",
"get_command_signature",
"(",
"self",
",",
"command",
")",
":",
"parent",
"=",
"command",
".",
"full_parent_name",
"if",
"len",
"(",
"command",
".",
"aliases",
")",
">",
"0",
":",
"aliases",
"=",
"'|'",
".",
"join",
"(",
"command",
".",
"aliases",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.remove_mentions | Removes mentions from the string to prevent abuse.
This includes ``@everyone``, ``@here``, member mentions and role mentions. | discord/ext/commands/help.py | def remove_mentions(self, string):
"""Removes mentions from the string to prevent abuse.
This includes ``@everyone``, ``@here``, member mentions and role mentions.
"""
def replace(obj, *, transforms=self.MENTION_TRANSFORMS):
return transforms.get(obj.group(0), '@invalid')
... | def remove_mentions(self, string):
"""Removes mentions from the string to prevent abuse.
This includes ``@everyone``, ``@here``, member mentions and role mentions.
"""
def replace(obj, *, transforms=self.MENTION_TRANSFORMS):
return transforms.get(obj.group(0), '@invalid')
... | [
"Removes",
"mentions",
"from",
"the",
"string",
"to",
"prevent",
"abuse",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L392-L401 | [
"def",
"remove_mentions",
"(",
"self",
",",
"string",
")",
":",
"def",
"replace",
"(",
"obj",
",",
"*",
",",
"transforms",
"=",
"self",
".",
"MENTION_TRANSFORMS",
")",
":",
"return",
"transforms",
".",
"get",
"(",
"obj",
".",
"group",
"(",
"0",
")",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.subcommand_not_found | |maybecoro|
A method called when a command did not have a subcommand requested in the help command.
This is useful to override for i18n.
Defaults to either:
- ``'Command "{command.qualified_name}" has no subcommands.'``
- If there is no subcommand in the ``command`` parame... | discord/ext/commands/help.py | def subcommand_not_found(self, command, string):
"""|maybecoro|
A method called when a command did not have a subcommand requested in the help command.
This is useful to override for i18n.
Defaults to either:
- ``'Command "{command.qualified_name}" has no subcommands.'``
... | def subcommand_not_found(self, command, string):
"""|maybecoro|
A method called when a command did not have a subcommand requested in the help command.
This is useful to override for i18n.
Defaults to either:
- ``'Command "{command.qualified_name}" has no subcommands.'``
... | [
"|maybecoro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L450-L478 | [
"def",
"subcommand_not_found",
"(",
"self",
",",
"command",
",",
"string",
")",
":",
"if",
"isinstance",
"(",
"command",
",",
"Group",
")",
"and",
"len",
"(",
"command",
".",
"all_commands",
")",
">",
"0",
":",
"return",
"'Command \"{0.qualified_name}\" has no... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.filter_commands | |coro|
Returns a filtered list of commands and optionally sorts them.
This takes into account the :attr:`verify_checks` and :attr:`show_hidden`
attributes.
Parameters
------------
commands: Iterable[:class:`Command`]
An iterable of commands that are getting... | discord/ext/commands/help.py | async def filter_commands(self, commands, *, sort=False, key=None):
"""|coro|
Returns a filtered list of commands and optionally sorts them.
This takes into account the :attr:`verify_checks` and :attr:`show_hidden`
attributes.
Parameters
------------
commands: ... | async def filter_commands(self, commands, *, sort=False, key=None):
"""|coro|
Returns a filtered list of commands and optionally sorts them.
This takes into account the :attr:`verify_checks` and :attr:`show_hidden`
attributes.
Parameters
------------
commands: ... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L480-L530 | [
"async",
"def",
"filter_commands",
"(",
"self",
",",
"commands",
",",
"*",
",",
"sort",
"=",
"False",
",",
"key",
"=",
"None",
")",
":",
"if",
"sort",
"and",
"key",
"is",
"None",
":",
"key",
"=",
"lambda",
"c",
":",
"c",
".",
"name",
"iterator",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.get_max_size | Returns the largest name length of the specified command list.
Parameters
------------
commands: Sequence[:class:`Command`]
A sequence of commands to check for the largest size.
Returns
--------
:class:`int`
The maximum width of the commands. | discord/ext/commands/help.py | def get_max_size(self, commands):
"""Returns the largest name length of the specified command list.
Parameters
------------
commands: Sequence[:class:`Command`]
A sequence of commands to check for the largest size.
Returns
--------
:class:`int`
... | def get_max_size(self, commands):
"""Returns the largest name length of the specified command list.
Parameters
------------
commands: Sequence[:class:`Command`]
A sequence of commands to check for the largest size.
Returns
--------
:class:`int`
... | [
"Returns",
"the",
"largest",
"name",
"length",
"of",
"the",
"specified",
"command",
"list",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L532-L550 | [
"def",
"get_max_size",
"(",
"self",
",",
"commands",
")",
":",
"as_lengths",
"=",
"(",
"discord",
".",
"utils",
".",
"_string_width",
"(",
"c",
".",
"name",
")",
"for",
"c",
"in",
"commands",
")",
"return",
"max",
"(",
"as_lengths",
",",
"default",
"="... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | HelpCommand.command_callback | |coro|
The actual implementation of the help command.
It is not recommended to override this method and instead change
the behaviour through the methods that actually get dispatched.
- :meth:`send_bot_help`
- :meth:`send_cog_help`
- :meth:`send_group_help`
- :m... | discord/ext/commands/help.py | async def command_callback(self, ctx, *, command=None):
"""|coro|
The actual implementation of the help command.
It is not recommended to override this method and instead change
the behaviour through the methods that actually get dispatched.
- :meth:`send_bot_help`
- :... | async def command_callback(self, ctx, *, command=None):
"""|coro|
The actual implementation of the help command.
It is not recommended to override this method and instead change
the behaviour through the methods that actually get dispatched.
- :meth:`send_bot_help`
- :... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L754-L812 | [
"async",
"def",
"command_callback",
"(",
"self",
",",
"ctx",
",",
"*",
",",
"command",
"=",
"None",
")",
":",
"await",
"self",
".",
"prepare_help_command",
"(",
"ctx",
",",
"command",
")",
"bot",
"=",
"ctx",
".",
"bot",
"if",
"command",
"is",
"None",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DefaultHelpCommand.shorten_text | Shortens text to fit into the :attr:`width`. | discord/ext/commands/help.py | def shorten_text(self, text):
"""Shortens text to fit into the :attr:`width`."""
if len(text) > self.width:
return text[:self.width - 3] + '...'
return text | def shorten_text(self, text):
"""Shortens text to fit into the :attr:`width`."""
if len(text) > self.width:
return text[:self.width - 3] + '...'
return text | [
"Shortens",
"text",
"to",
"fit",
"into",
"the",
":",
"attr",
":",
"width",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L865-L869 | [
"def",
"shorten_text",
"(",
"self",
",",
"text",
")",
":",
"if",
"len",
"(",
"text",
")",
">",
"self",
".",
"width",
":",
"return",
"text",
"[",
":",
"self",
".",
"width",
"-",
"3",
"]",
"+",
"'...'",
"return",
"text"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DefaultHelpCommand.add_indented_commands | Indents a list of commands after the specified heading.
The formatting is added to the :attr:`paginator`.
The default implementation is the command name indented by
:attr:`indent` spaces, padded to ``max_size`` followed by
the command's :attr:`Command.short_doc` and then shortened
... | discord/ext/commands/help.py | def add_indented_commands(self, commands, *, heading, max_size=None):
"""Indents a list of commands after the specified heading.
The formatting is added to the :attr:`paginator`.
The default implementation is the command name indented by
:attr:`indent` spaces, padded to ``max_size`` fo... | def add_indented_commands(self, commands, *, heading, max_size=None):
"""Indents a list of commands after the specified heading.
The formatting is added to the :attr:`paginator`.
The default implementation is the command name indented by
:attr:`indent` spaces, padded to ``max_size`` fo... | [
"Indents",
"a",
"list",
"of",
"commands",
"after",
"the",
"specified",
"heading",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L877-L911 | [
"def",
"add_indented_commands",
"(",
"self",
",",
"commands",
",",
"*",
",",
"heading",
",",
"max_size",
"=",
"None",
")",
":",
"if",
"not",
"commands",
":",
"return",
"self",
".",
"paginator",
".",
"add_line",
"(",
"heading",
")",
"max_size",
"=",
"max_... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | DefaultHelpCommand.send_pages | A helper utility to send the page output from :attr:`paginator` to the destination. | discord/ext/commands/help.py | 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):
"""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) | [
"A",
"helper",
"utility",
"to",
"send",
"the",
"page",
"output",
"from",
":",
"attr",
":",
"paginator",
"to",
"the",
"destination",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L913-L917 | [
"async",
"def",
"send_pages",
"(",
"self",
")",
":",
"destination",
"=",
"self",
".",
"get_destination",
"(",
")",
"for",
"page",
"in",
"self",
".",
"paginator",
".",
"pages",
":",
"await",
"destination",
".",
"send",
"(",
"page",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | MinimalHelpCommand.add_bot_commands_formatting | 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... | discord/ext/commands/help.py | 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):
"""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)... | [
"Adds",
"the",
"minified",
"bot",
"heading",
"with",
"commands",
"to",
"the",
"output",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L1092-L1111 | [
"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... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | MinimalHelpCommand.add_subcommand_formatting | 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
-----... | discord/ext/commands/help.py | 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):
"""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... | [
"Adds",
"formatting",
"information",
"on",
"a",
"subcommand",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L1113-L1127 | [
"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",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | MinimalHelpCommand.add_aliases_formatting | 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.
... | discord/ext/commands/help.py | 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):
"""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... | [
"Adds",
"the",
"formatting",
"information",
"on",
"a",
"command",
"s",
"aliases",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L1129-L1144 | [
"def",
"add_aliases_formatting",
"(",
"self",
",",
"aliases",
")",
":",
"self",
".",
"paginator",
".",
"add_line",
"(",
"'**%s** %s'",
"%",
"(",
"self",
".",
"aliases_heading",
",",
"', '",
".",
"join",
"(",
"aliases",
")",
")",
",",
"empty",
"=",
"True"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | MinimalHelpCommand.add_command_formatting | A utility function to format commands and groups.
Parameters
------------
command: :class:`Command`
The command to format. | discord/ext/commands/help.py | 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):
"""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... | [
"A",
"utility",
"function",
"to",
"format",
"commands",
"and",
"groups",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/ext/commands/help.py#L1146-L1171 | [
"def",
"add_command_formatting",
"(",
"self",
",",
"command",
")",
":",
"if",
"command",
".",
"description",
":",
"self",
".",
"paginator",
".",
"add_line",
"(",
"command",
".",
"description",
",",
"empty",
"=",
"True",
")",
"signature",
"=",
"self",
".",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | VoiceClient.disconnect | |coro|
Disconnects this voice client from voice. | discord/voice_client.py | 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):
"""|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... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/voice_client.py#L269-L287 | [
"async",
"def",
"disconnect",
"(",
"self",
",",
"*",
",",
"force",
"=",
"False",
")",
":",
"if",
"not",
"force",
"and",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"return",
"self",
".",
"stop",
"(",
")",
"self",
".",
"_connected",
".",
"cle... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | VoiceClient.move_to | |coro|
Moves you to a different voice channel.
Parameters
-----------
channel: :class:`abc.Snowflake`
The channel to move to. Must be a voice channel. | discord/voice_client.py | 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):
"""|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()
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/voice_client.py#L289-L300 | [
"async",
"def",
"move_to",
"(",
"self",
",",
"channel",
")",
":",
"guild_id",
",",
"_",
"=",
"self",
".",
"channel",
".",
"_get_voice_state_pair",
"(",
")",
"await",
"self",
".",
"main_ws",
".",
"voice_state",
"(",
"guild_id",
",",
"channel",
".",
"id",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | VoiceClient.play | 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
-----------
... | discord/voice_client.py | 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):
"""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... | [
"Plays",
"an",
":",
"class",
":",
"AudioSource",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/voice_client.py#L334-L371 | [
"def",
"play",
"(",
"self",
",",
"source",
",",
"*",
",",
"after",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"is_connected",
"(",
")",
":",
"raise",
"ClientException",
"(",
"'Not connected to voice.'",
")",
"if",
"self",
".",
"is_playing",
"(",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | VoiceClient.send_audio_packet | 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.
... | discord/voice_client.py | 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):
"""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
... | [
"Sends",
"an",
"audio",
"packet",
"composed",
"of",
"the",
"data",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/voice_client.py#L415-L446 | [
"def",
"send_audio_packet",
"(",
"self",
",",
"data",
",",
"*",
",",
"encode",
"=",
"True",
")",
":",
"self",
".",
"checked_add",
"(",
"'sequence'",
",",
"1",
",",
"65535",
")",
"if",
"encode",
":",
"encoded_data",
"=",
"self",
".",
"encoder",
".",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.on_error | |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. | discord/client.py | 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):
"""|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|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L300-L310 | [
"async",
"def",
"on_error",
"(",
"self",
",",
"event_method",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"print",
"(",
"'Ignoring exception in {}'",
".",
"format",
"(",
"event_method",
")",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"tracebac... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.request_offline_members | r"""|coro|
Requests previously offline members from the guild to be filled up
into the :attr:`.Guild.members` cache. This function is usually not
called. It should only be used if you have the ``fetch_offline_members``
parameter set to ``False``.
When the client logs on and con... | discord/client.py | async def request_offline_members(self, *guilds):
r"""|coro|
Requests previously offline members from the guild to be filled up
into the :attr:`.Guild.members` cache. This function is usually not
called. It should only be used if you have the ``fetch_offline_members``
parameter ... | 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 ... | [
"r",
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L312-L338 | [
"async",
"def",
"request_offline_members",
"(",
"self",
",",
"*",
"guilds",
")",
":",
"if",
"any",
"(",
"not",
"g",
".",
"large",
"or",
"g",
".",
"unavailable",
"for",
"g",
"in",
"guilds",
")",
":",
"raise",
"InvalidArgument",
"(",
"'An unavailable or non-... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.login | |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>`_
... | discord/client.py | 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):
"""|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... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L342-L377 | [
"async",
"def",
"login",
"(",
"self",
",",
"token",
",",
"*",
",",
"bot",
"=",
"True",
")",
":",
"log",
".",
"info",
"(",
"'logging in using static token'",
")",
"await",
"self",
".",
"http",
".",
"static_login",
"(",
"token",
",",
"bot",
"=",
"bot",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.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
-----... | discord/client.py | 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):
"""|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... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L405-L465 | [
"async",
"def",
"connect",
"(",
"self",
",",
"*",
",",
"reconnect",
"=",
"True",
")",
":",
"backoff",
"=",
"ExponentialBackoff",
"(",
")",
"while",
"not",
"self",
".",
"is_closed",
"(",
")",
":",
"try",
":",
"await",
"self",
".",
"_connect",
"(",
")"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.close | |coro|
Closes the connection to discord. | discord/client.py | 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):
"""|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 ... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L467-L488 | [
"async",
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"return",
"await",
"self",
".",
"http",
".",
"close",
"(",
")",
"self",
".",
"_closed",
"=",
"True",
"for",
"voice",
"in",
"self",
".",
"voice_clients",
":",
"try",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.clear | 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. | discord/client.py | 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):
"""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... | [
"Clears",
"the",
"internal",
"state",
"of",
"the",
"bot",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L490-L500 | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_closed",
"=",
"False",
"self",
".",
"_ready",
".",
"clear",
"(",
")",
"self",
".",
"_connection",
".",
"clear",
"(",
")",
"self",
".",
"http",
".",
"recreate",
"(",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.start | |coro|
A shorthand coroutine for :meth:`login` + :meth:`connect`. | discord/client.py | 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):
"""|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) | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L502-L511 | [
"async",
"def",
"start",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"bot",
"=",
"kwargs",
".",
"pop",
"(",
"'bot'",
",",
"True",
")",
"reconnect",
"=",
"kwargs",
".",
"pop",
"(",
"'reconnect'",
",",
"True",
")",
"await",
"s... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.run | 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:
... | discord/client.py | 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):
"""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... | [
"A",
"blocking",
"call",
"that",
"abstracts",
"away",
"the",
"event",
"loop",
"initialisation",
"from",
"you",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L513-L549 | [
"def",
"run",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"async",
"def",
"runner",
"(",
")",
":",
"try",
":",
"await",
"self",
".",
"start",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"finally",
":",
"await",
"self",... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.wait_for | |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... | discord/client.py | 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):
"""|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... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L640-L736 | [
"def",
"wait_for",
"(",
"self",
",",
"event",
",",
"*",
",",
"check",
"=",
"None",
",",
"timeout",
"=",
"None",
")",
":",
"future",
"=",
"self",
".",
"loop",
".",
"create_future",
"(",
")",
"if",
"check",
"is",
"None",
":",
"def",
"_check",
"(",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.event | 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... | discord/client.py | 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):
"""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... | [
"A",
"decorator",
"that",
"registers",
"an",
"event",
"to",
"listen",
"to",
"."
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L740-L767 | [
"def",
"event",
"(",
"self",
",",
"coro",
")",
":",
"if",
"not",
"asyncio",
".",
"iscoroutinefunction",
"(",
"coro",
")",
":",
"raise",
"TypeError",
"(",
"'event registered must be a coroutine function'",
")",
"setattr",
"(",
"self",
",",
"coro",
".",
"__name_... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.change_presence | |coro|
Changes the client's presence.
The activity parameter is a :class:`.Activity` object (not a string) that represents
the activity being done currently. This could also be the slimmed down versions,
:class:`.Game` and :class:`.Streaming`.
Example
---------
... | discord/client.py | 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):
"""|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,
... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L769-L822 | [
"async",
"def",
"change_presence",
"(",
"self",
",",
"*",
",",
"activity",
"=",
"None",
",",
"status",
"=",
"None",
",",
"afk",
"=",
"False",
")",
":",
"if",
"status",
"is",
"None",
":",
"status",
"=",
"'online'",
"status_enum",
"=",
"Status",
".",
"... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.fetch_guilds | |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... | discord/client.py | 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):
"""|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... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L826-L879 | [
"def",
"fetch_guilds",
"(",
"self",
",",
"*",
",",
"limit",
"=",
"100",
",",
"before",
"=",
"None",
",",
"after",
"=",
"None",
")",
":",
"return",
"GuildIterator",
"(",
"self",
",",
"limit",
"=",
"limit",
",",
"before",
"=",
"before",
",",
"after",
... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.fetch_guild | |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 ... | discord/client.py | 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):
"""|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... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L881-L913 | [
"async",
"def",
"fetch_guild",
"(",
"self",
",",
"guild_id",
")",
":",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_guild",
"(",
"guild_id",
")",
"return",
"Guild",
"(",
"data",
"=",
"data",
",",
"state",
"=",
"self",
".",
"_connection",
")"
] | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.create_guild | |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.
... | discord/client.py | 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):
"""|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... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L915-L955 | [
"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... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
train | Client.fetch_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... | discord/client.py | 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):
"""|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... | [
"|coro|"
] | Rapptz/discord.py | python | https://github.com/Rapptz/discord.py/blob/05d4f7f9620ef33635d6ac965b26528e09cdaf5b/discord/client.py#L959-L994 | [
"async",
"def",
"fetch_invite",
"(",
"self",
",",
"url",
",",
"*",
",",
"with_counts",
"=",
"True",
")",
":",
"invite_id",
"=",
"utils",
".",
"resolve_invite",
"(",
"url",
")",
"data",
"=",
"await",
"self",
".",
"http",
".",
"get_invite",
"(",
"invite_... | 05d4f7f9620ef33635d6ac965b26528e09cdaf5b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.