Compare commits

..

No commits in common. "6603cd1a861230d36810b3889fe58c6dd48f9115" and "8d8918b3c601813ff4a0e8143c0a11421456f2a9" have entirely different histories.

4 changed files with 17 additions and 44 deletions

View File

@ -155,22 +155,6 @@ Here is an example of the :code:`async with` syntax:
blah.append(new_blah) blah.append(new_blah)
await ctx.send("The new blah value has been added!") await ctx.send("The new blah value has been added!")
There is also a :py:meth:`Group.all` method. This will return all the stored data associated
with a specific config group as a :py:class:`dict`. By negating the need to excessively call config,
this method can be particularly useful when multiple values are to be retrieved from the same group.
Here is an example of :py:meth:`Group.all` usage:
.. code-block:: python
@commands.command()
async def getall(self, ctx):
all_global_data = await self.config.all()
await ctx.send("Foobar is {foobar}, foo baz is {foo_baz}".format(
foobar=str(all_global_data["foobar"]),
foo_baz=str(all_global_data["foo"]["baz"])
))
.. important:: .. important::
@ -414,7 +398,7 @@ We're responsible pet owners here, so we've also got to have a way to feed our p
# We could accomplish the same thing a slightly different way # We could accomplish the same thing a slightly different way
await self.config.user(ctx.author).pets.get_attr(pet_name).hunger.set(new_hunger) await self.config.user(ctx.author).pets.get_attr(pet_name).hunger.set(new_hunger)
await ctx.send("Your pet is now at {}/100 hunger!".format(new_hunger)) await ctx.send("Your pet is now at {}/100 hunger!".format(new_hunger)
Of course, if we're less than responsible pet owners, there are consequences:: Of course, if we're less than responsible pet owners, there are consequences::
@ -497,7 +481,7 @@ Config prioritizes being a safe data store without developers needing to
know how end users have configured their bot. know how end users have configured their bot.
This does come with some performance costs, so keep the following in mind when choosing to This does come with some performance costs, so keep the following in mind when choosing to
develop using config. develop using config
* Config use in events should be kept minimal and should only occur * Config use in events should be kept minimal and should only occur
after confirming the event needs to interact with config after confirming the event needs to interact with config

View File

@ -47,7 +47,7 @@ Keys common to both repo and cog info.json (case sensitive)
is installed or a repo is added is installed or a repo is added
.. tip:: You can use the ``[p]`` key in your string to use the prefix .. tip:: You can use the ``[p]`` key in your string to use the prefix
used for installing, and ``[botname]`` to show the bot's username. used for installing.
- ``short`` (string) - A short description of the cog or repo. For cogs, this info - ``short`` (string) - A short description of the cog or repo. For cogs, this info
is displayed when a user executes ``[p]cog list`` is displayed when a user executes ``[p]cog list``

View File

@ -309,9 +309,9 @@ class ModInfo(MixinMeta):
usernames, display_names, nicks = await self.get_names(member) usernames, display_names, nicks = await self.get_names(member)
parts = [] parts = []
for header, names in ( for header, names in (
(_("Past 20 usernames: "), usernames), (_("Past 20 usernames:"), usernames),
(_("Past 20 global display names: "), display_names), (_("Past 20 global display names:"), display_names),
(_("Past 20 server nicknames: "), nicks), (_("Past 20 server nicknames:"), nicks),
): ):
if names: if names:
parts.append(bold(header) + ", ".join(names)) parts.append(bold(header) + ", ".join(names))

View File

@ -2477,34 +2477,23 @@ class Red(
msg = await channel.send(box(page, lang=box_lang)) msg = await channel.send(box(page, lang=box_lang))
ret.append(msg) ret.append(msg)
n_remaining = len(messages) - idx n_remaining = len(messages) - idx
files_perm = (
not channel.guild or channel.permissions_for(channel.guild.me).attach_files
)
options = ("more", "file") if files_perm else ("more",)
if n_remaining > 0: if n_remaining > 0:
if n_remaining == 1: if n_remaining == 1:
if files_perm: prompt_text = _(
prompt_text = _( "There is still one message remaining. Type {command_1} to continue"
"There is still one message remaining. Type {command_1} to continue or {command_2} to upload all contents as a file." " or {command_2} to upload all contents as a file."
) )
else:
prompt_text = _(
"There is still one message remaining. Type {command_1} to continue."
)
else: else:
if files_perm: prompt_text = _(
prompt_text = _( "There are still {count} messages remaining. Type {command_1} to continue"
"There are still {count} messages remaining. Type {command_1} to continue or {command_2} to upload all contents as a file." " or {command_2} to upload all contents as a file."
) )
else:
prompt_text = _(
"There are still {count} messages remaining. Type {command_1} to continue."
)
query = await channel.send( query = await channel.send(
prompt_text.format(count=n_remaining, command_1="`more`", command_2="`file`") prompt_text.format(count=n_remaining, command_1="`more`", command_2="`file`")
) )
pred = MessagePredicate.lower_contained_in(options, channel=channel, user=user) pred = MessagePredicate.lower_contained_in(
("more", "file"), channel=channel, user=user
)
try: try:
resp = await self.wait_for( resp = await self.wait_for(
"message", "message",