INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
|coro|
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|
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 ...
Return an: class:. AsyncIterator that enables receiving the destination s message history.
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 --------- ...
|coro|
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...
: class: Asset: Returns an asset of the emoji if it is custom.
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...
List [: class: Role ]: A: class: list of roles that is allowed to use this emoji.
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...
|coro|
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...
r |coro|
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[...
A decorator that schedules a task in the background for you with optional reconnect logic.
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...
r Starts the internal task in the event loop.
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 Adds an exception type to be handled during the reconnect logic.
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...
Removes an exception type from being handled during the reconnect logic.
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...
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.
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 after the loop finished running.
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 ...
r |coro|
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. ...
|coro|
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...
Similar to: attr:. Guild. me except it may return the: class:. ClientUser in private message contexts.
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
send_help ( entity = <bot > )
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 ...
Compute the next delay
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. ...
Returns True if self has the same or fewer permissions as 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.__...
r Bulk updates this permission object.
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 ------------ ...
: class: AuditLogChanges: The list of changes this entry has.
def changes(self): """:class:`AuditLogChanges`: The list of changes this entry has.""" obj = AuditLogChanges(self, self._changes) del self._changes return obj
A decorator that transforms a function into a: class:. Command or if called with: func:. group: class:. Group.
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:. Group.
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...
r A decorator that adds a check to the: class:. Command or its subclasses. These checks could be accessed via: attr:. Command. checks.
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...
A: func:. check that is added that checks if the member invoking the command has the role specified via the name or ID specified.
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...
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.
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...
Similar to: func:. has_role except checks if the bot itself has the role.
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_any_role except checks if the bot itself has any of the roles listed.
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. ...
A: func:. check that is added that checks if the member has all of the permissions necessary.
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`...
Similar to: func:. has_permissions except checks if the bot itself has the permissions listed.
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...
A: func:. check that checks if the person invoking this command is the owner of the bot.
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 channel is a NSFW channel.
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 decorator that adds a cooldown to a: class:. Command or its subclasses.
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,...
Updates: class: Command instance with updated attribute.
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. """ ...
Creates a copy of this: class: Command.
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)
Retrieves the parameter OrderedDict without the context or self parameters.
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 fully qualified parent command name.
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 parents of this command.
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 fully qualified command name.
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: ...
Checks whether the command is currently on cooldown.
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` ...
Resets the cooldown on this command.
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) ...
A decorator that registers a coroutine as a local error handler.
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 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 post - invoke hook.
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 ...
Gets the short documentation of a command.
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...
Returns a POSIX - like signature useful for help command output.
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(): ...
|coro|
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 ...
Adds a: class:. Command or its subclasses into the internal list of commands.
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 --------...
Remove a: class:. Command or subclasses from the internal list of commands.
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 ...
An iterator that recursively walks through all commands and subcommands.
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()
Get a: class:. Command or subclasses from the internal list of commands.
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 ...
A shortcut decorator that invokes: func:. command and adds it to the internal command list via: meth: ~. GroupMixin. add_command.
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...
Creates a copy of this: class: Group.
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
|coro|
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|
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...
Creates a main websocket for Discord from a: class: Client.
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...
Waits for a DISPATCH d event that meets the predicate.
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...
Sends the IDENTIFY packet.
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 RESUME packet.
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) ...
Polls for a DISPATCH event and handles the general gateway loop.
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...
Creates a voice websocket for the: class: VoiceClient.
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...
Clears the paginator to have no 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 = [...
Adds a line to the current page.
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...
Prematurely terminate a page.
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 =...
Retrieves the bot mapping passed to: meth: send_bot_help.
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] ...
The cleaned up invoke prefix. i. e. mentions are
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...
Similar to: attr: Context. invoked_with except properly handles the case where: meth: Context. send_help is used.
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...
Retrieves the signature portion of the help page.
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...
Removes mentions from the string to prevent abuse.
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') ...
|maybecoro|
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.'`` ...
|coro|
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: ...
Returns the largest name length of the specified command list.
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` ...
|coro|
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` - :...
Shortens text to fit into the: attr: width.
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
Indents a list of commands after the specified heading.
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...
A helper utility to send the page output from: attr: paginator to the destination.
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)
Adds the minified bot heading with commands to the output.
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 formatting information on a subcommand.
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 the formatting information on a command s aliases.
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...
A utility function to format commands and groups.
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...
|coro|
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|
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() ...
Plays an: class: AudioSource.
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...
Sends an audio packet composed of the data.
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 ...
|coro|
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. ...
r |coro|
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 ...
|coro|
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|
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|
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 ...
Clears the internal state of the bot.
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...
|coro|
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)
A blocking call that abstracts away the event loop initialisation from you.
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...
|coro|
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...
A decorator that registers an event to listen to.
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...
|coro|
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|
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|
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|
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|
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...