Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 50 additions & 5 deletions docs/cog_guides/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2958,25 +2958,70 @@ set bot custominfo

.. code-block:: none

[p]set bot custominfo [text]
[p]set bot custominfo

**Description**

Customizes a section of ``[p]info``.
Customizes sections of ``[p]info``.

.. _core-command-set-bot-custominfo-text:

"""""""""""""""""""""""
set bot custominfo text
"""""""""""""""""""""""

**Syntax**

.. code-block:: none

[p]set bot custominfo text [text]

**Description**

Customizes a section of optional text in ``[p]info``.

The maximum amount of allowed characters is 1024.
Supports markdown, links and "mentions".

Link example: ``[My link](https://example.com)``

**Examples:**
- ``[p]set bot custominfo >>> I can use **markdown** such as quotes, ||spoilers|| and multiple lines.``
- ``[p]set bot custominfo Join my [support server](discord.gg/discord)!``
- ``[p]set bot custominfo`` - Removes custom info text.
- ``[p]set bot custominfo text >>> I can use **markdown** such as quotes, ||spoilers|| and multiple lines.``
- ``[p]set bot custominfo text Join my [support server](discord.gg/discord)!``
- ``[p]set bot custominfo text`` - Removes custom info text.

**Arguments:**
- ``[text]`` - The custom info text.

.. _core-command-set-bot-custominfo-image:

""""""""""""""""""""""""
set bot custominfo image
""""""""""""""""""""""""

**Syntax**

.. code-block:: none

[p]set bot custominfo text [text]

**Description**

Customizes an optional image sent inside the ``[p]info`` embed.

You may provide an image URL or send an attachment.
Sending neither will remove the image from the embed.

Images are not sent if embeds are disabled.

**Examples:**
- ``[p]set bot custominfo image https://imgur.com/pY1WUFX.png``
- ``[p]set bot custominfo image <image attachment>``
- ``[p]set bot custominfo image`` - Removes custom image.

**Arguments:**
- ``[url]`` - The URL of the image.

.. _core-command-set-bot-description:

"""""""""""""""""""
Expand Down
1 change: 1 addition & 0 deletions redbot/core/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def __init__(self, *args, cli_flags=None, bot_dir: Path = Path.cwd(), **kwargs):
color=15158332,
fuzzy=False,
custom_info=None,
info_image=None,
help__page_char_limit=1000,
help__max_pages_in_guild=2,
help__delete_delay=0,
Expand Down
48 changes: 42 additions & 6 deletions redbot/core/core_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ async def info(self, ctx: commands.Context):
embed.set_footer(
text=_("Bringing joy since 02 Jan 2016 (over {} days ago!)").format(days_since)
)
image = await self.bot._config.info_image()
embed.set_image(url=image)
await ctx.send(embed=embed)
else:
python_version = "{}.{}.{}".format(*sys.version_info[:3])
Expand Down Expand Up @@ -3088,20 +3090,24 @@ async def _set_bot_nickname(self, ctx: commands.Context, *, nickname: str = None
else:
await ctx.send(_("Done."))

@_set_bot.command(name="custominfo")
@_set_bot.group(name="custominfo")
@commands.is_owner()
async def _set_bot_custominfo(self, ctx: commands.Context, *, text: str = None):
"""Customizes a section of `[p]info`.
async def _set_bot_custominfo(self, ctx: commands.Context):
"""Customizes sections of `[p]info`."""

@_set_bot_custominfo.command(name="text")
async def _set_bot_custominfo_text(self, ctx: commands.Context, *, text: str = None):
"""Customizes a section of optional text in `[p]info`.

The maximum amount of allowed characters is 1024.
Supports markdown, links and "mentions".

Link example: `[My link](https://example.com)`

**Examples:**
- `[p]set bot custominfo >>> I can use **markdown** such as quotes, ||spoilers|| and multiple lines.`
- `[p]set bot custominfo Join my [support server](discord.gg/discord)!`
- `[p]set bot custominfo` - Removes custom info text.
- `[p]set bot custominfo text >>> I can use **markdown** such as quotes, ||spoilers|| and multiple lines.`
- `[p]set bot custominfo text Join my [support server](discord.gg/discord)!`
- `[p]set bot custominfo text` - Removes custom info text.

**Arguments:**
- `[text]` - The custom info text.
Expand All @@ -3117,6 +3123,36 @@ async def _set_bot_custominfo(self, ctx: commands.Context, *, text: str = None):
else:
await ctx.send(_("Text must be fewer than 1024 characters long."))

@_set_bot_custominfo.command(name="image")
async def _set_bot_custominfo_image(self, ctx: commands.Context, *, url: str = None):
"""Customizes an optional image sent inside the `[p]info` embed.

You may provide an image URL or send an attachment.
Sending neither will remove the image from the embed.

Images are not sent if embeds are disabled.

**Examples:**
- `[p]set bot custominfo image https://imgur.com/pY1WUFX.png`
- `[p]set bot custominfo image <image attachment>`
- `[p]set bot custominfo image` - Removes custom image.

**Arguments:**
- `[url]` - The URL of the image.
"""
if attachments := ctx.message.attachments:
if not attachments[0].content_type.startswith("image"):
await ctx.send(_("Attachment must be an image or GIF file."))
return
url = attachments[0].url
elif not url:
await ctx.bot._config.info_image.clear()
await ctx.send(_("The custom image has been cleared."))
return
await ctx.bot._config.info_image.set(url)
await ctx.send(_("The custom image has been set."))
await ctx.invoke(self.info)

# -- End Bot Metadata Commands -- ###
# -- Bot Status Commands -- ###

Expand Down
Loading