Skip to content

Commit

Permalink
Merge branch 'V3/develop' into click-copy-command-help
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreusada authored Feb 27, 2024
2 parents ec6e43e + 9dc7462 commit 142982e
Show file tree
Hide file tree
Showing 103 changed files with 6,912 additions and 2,256 deletions.
33 changes: 33 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
.. Red changelogs
Redbot 3.5.5 (2023-09-14)
=========================

| Thanks to all these amazing people that contributed to this release:
| :ghuser:`Flame442`, :ghuser:`Jackenmen`, :ghuser:`karlsbjorn`, :ghuser:`Kreusada`, :ghuser:`ltzmax`, :ghuser:`palmtree5`
End-user changelog
------------------

Changes
*******

- **Core - Dependencies** - Red's dependencies have been bumped (:issue:`6248`)
- **Cogs - Downloader** - Cogs in the ``[p]cog list`` command are now listed alphabetically (:issue:`6214`, :issue:`6215`)

Fixes
*****

- **Core - Bot Commands** - Fixed handling of an edge case in the ``[p]diagnoseissues`` command that involved commands without a cog (:issue:`6237`)
- **Core - Bot Commands** - Fixed the formatting of nested result lists in the ``[p]diagnoseissues`` command (:issue:`6238`)
- **Cogs - Mod** - Fixed the formatting of the help description for the ``[p]ban``, ``[p]kick``, and ``[p]tempban`` commands (:issue:`6245`)
- |cool| **Cogs - Streams** - Updated the implementation of Twitch streams to no longer use the "Get Users Follows" endpoint that was deprecated in February 2023 (:issue:`6246`, :issue:`6247`)

Documentation changes
---------------------

Changes
*******

- Updated Python version in ``pyenv`` instructions (:issue:`6241`)

----

Redbot 3.5.4 (2023-08-12)
=========================

Expand Down
8 changes: 4 additions & 4 deletions docs/cog_guides/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1475,9 +1475,6 @@ helpset maxpages

Set the maximum number of help pages sent in a server channel.

.. Note:: This setting does not apply to menu help.


If a help message contains more pages than this value, the help message will
be sent to the command author via DM. This is to help reduce spam in server
text channels.
Expand Down Expand Up @@ -1683,8 +1680,11 @@ Set the tagline to be used.
The maximum tagline length is 2048 characters.
This setting only applies to embedded help. If no tagline is specified, the default will be used instead.

You can use ``[p]`` in your tagline, which will be replaced by the bot's prefix.

**Examples:**
- ``[p]helpset tagline Thanks for using the bot!``
- ``[p]helpset tagline Use [p]invite to add me to your server.``
- ``[p]helpset tagline`` - Resets the tagline to the default.

**Arguments:**
Expand Down Expand Up @@ -4375,4 +4375,4 @@ uptime
**Description**

Shows Red's uptime.
Shows Red's uptime.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"display_github": True,
"github_user": "Cog-Creators",
"github_repo": "Red-DiscordBot",
"github_version": "V3/develop/docs/",
"github_version": "V3/develop",
}

# Add any paths that contain custom static files (such as style sheets) here,
Expand Down Expand Up @@ -274,7 +274,7 @@ class IgnoreCoroSubstitution(SphinxTransform):
def apply(self, **kwargs) -> None:
for ref in self.document.traverse(nodes.substitution_reference):
if ref["refname"] == "coro":
ref.replace_self(nodes.Text("", ""))
ref.replace_self(nodes.Text(""))


def setup(app):
Expand Down
26 changes: 15 additions & 11 deletions docs/framework_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Basic Usage
class MyCog(commands.Cog):
def __init__(self):
self.config = Config.get_conf(self, identifier=1234567890)
self.config = Config.get_conf(self, identifier=1234567890, force_registration=True)
self.config.register_global(
foo=True
Expand Down Expand Up @@ -55,23 +55,27 @@ Then, in the class's :code:`__init__` function, you need to get a config instanc
class MyCog(commands.Cog):
def __init__(self):
self.config = Config.get_conf(self, identifier=1234567890)
self.config = Config.get_conf(self, identifier=1234567890, force_registration=True)
The ``identifier`` in :py:meth:`Config.get_conf` is used to keep your cog's data separate
from that of another cog, and thus should be unique to your cog. For example: if we
have two cogs named :code:`MyCog` and their identifier is different, each will have
its own data without overwriting the other's data. Note that it is also possible
to force registration of a data key before allowing you to get and set data for
that key by adding :code:`force_registration=True` after identifier (that defaults
to :code:`False` though)
its own data without overwriting the other's data.

Note that, as shown by most of the examples in this document, it is also possible to
force registration of a data key before allowing you to get and set data for that key
by adding :code:`force_registration=True` after identifier.
When this is set to :code:`False` (the default), the default value for any key that isn't registered
will be :code:`None`. When this is set to :code:`True` (as shown in this document), attempting
to read from or write to any key that isn't registered will raise an :exc:`AttributeError`.

After we've gotten that, we need to register default values:

.. code-block:: python
class MyCog(commands.Cog):
def __init__(self):
self.config = Config.get_conf(self, identifier=1234567890)
self.config = Config.get_conf(self, identifier=1234567890, force_registration=True)
default_global = {
"foobar": True,
"foo": {
Expand Down Expand Up @@ -213,7 +217,7 @@ Tutorial example.
class MyCog(commands.Cog):
def __init__(self):
self.config = Config.get_conf(self, identifier=1234567890)
self.config = Config.get_conf(self, identifier=1234567890, force_registration=True)
default_guild = {
"blah": [],
"baz": 1234567890
Expand Down Expand Up @@ -264,7 +268,7 @@ Now let's see an example that uses multiple identifiers:
class ChannelAccess(commands.Cog):
def __init__(self):
self.config = Config.get_conf(self, identifier=1234567890)
self.config = Config.get_conf(self, identifier=1234567890, force_registration=True)
default_access = {
"allowed": False
}
Expand Down Expand Up @@ -304,7 +308,7 @@ the built-in Economy credits::

class Pets(commands.Cog):
def __init__(self):
self.config = Config.get_conf(self, 1234567890)
self.config = Config.get_conf(self, 1234567890, force_registration=True)

# Here we'll assign some default costs for the pets
self.config.register_global(
Expand Down Expand Up @@ -509,7 +513,7 @@ API Reference
includes keys within a `dict` when one is being set, as well as keys in nested dictionaries
within that `dict`. For example::

>>> config = Config.get_conf(self, identifier=999)
>>> config = Config.get_conf(self, identifier=999, force_registration=True)
>>> config.register_global(foo={})
>>> await config.foo.set_raw(123, value=True)
>>> await config.foo()
Expand Down
2 changes: 1 addition & 1 deletion redbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def _early_init():


# This is bumped automatically by release workflow (`.github/workflows/scripts/bump_version.py`)
_VERSION = "3.5.5.dev1"
_VERSION = "3.5.6.dev1"

__version__, version_info = VersionInfo._get_version()

Expand Down
12 changes: 11 additions & 1 deletion redbot/cogs/alias/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ async def get_prefix(self, message: discord.Message) -> str:
raise ValueError("No prefix found.")

async def call_alias(self, message: discord.Message, prefix: str, alias: AliasEntry):
new_message = self.translate_alias_message(message, prefix, alias)
await self.bot.process_commands(new_message)

def translate_alias_message(self, message: discord.Message, prefix: str, alias: AliasEntry):
"""
Translates a discord message using an alias
for a command to a discord message using the
alias' base command.
"""
new_message = copy(message)
try:
args = alias.get_extra_args_from_alias(message, prefix)
Expand All @@ -163,7 +172,8 @@ async def call_alias(self, message: discord.Message, prefix: str, alias: AliasEn
new_message.content = "{}{} {}".format(
prefix, command, " ".join(args[trackform.max + 1 :])
).strip()
await self.bot.process_commands(new_message)

return new_message

async def paginate_alias_list(
self, ctx: commands.Context, alias_list: List[AliasEntry]
Expand Down
3 changes: 1 addition & 2 deletions redbot/cogs/alias/alias_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ def get_extra_args_from_alias(self, message: discord.Message, prefix: str) -> st
word = view.get_quoted_word()
if len(word) < view.index - prev:
word = "".join((view.buffer[prev], word, view.buffer[view.index - 1]))
extra.append(word)
view.skip_ws()
extra.append(word.strip(" "))
return extra

def to_json(self) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion redbot/cogs/alias/locales/fr-FR.po

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions redbot/cogs/audio/core/commands/audioset.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,9 +758,17 @@ async def command_audioset_jukebox(self, ctx: commands.Context, price: int):
"""Set a price for queueing tracks for non-mods, 0 to disable."""
if price < 0:
return await self.send_embed_msg(
ctx, title=_("Invalid Price"), description=_("Price can't be less than zero.")
ctx,
title=_("Invalid Price"),
description=_("Price can't be less than zero."),
)
elif price > 2**63 - 1:
return await self.send_embed_msg(
ctx,
title=_("Invalid Price"),
description=_("Price can't be greater than 2^63 - 1."),
)
if price == 0:
elif price == 0:
jukebox = False
await self.send_embed_msg(
ctx, title=_("Setting Changed"), description=_("Jukebox mode disabled.")
Expand Down
Loading

0 comments on commit 142982e

Please sign in to comment.