Skip to content

Commit

Permalink
Merge branch 'Cog-Creators:V3/develop' into repo-list-update
Browse files Browse the repository at this point in the history
  • Loading branch information
cswimr authored Mar 6, 2024
2 parents 8943e02 + edfb9ff commit 168a8a1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/cog_guides/modlog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ find detailed docs about usage and commands.
Usage
-----

Browse and manage modlog cases.
Browse and manage modlog cases. To manage modlog settings, use ``[p]modlogset``.


.. _modlog-commands:
Expand Down
4 changes: 3 additions & 1 deletion redbot/cogs/general/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ async def stopwatch(self, ctx):
async def lmgtfy(self, ctx, *, search_terms: str):
"""Create a lmgtfy link."""
search_terms = escape(urllib.parse.quote_plus(search_terms), mass_mentions=True)
await ctx.send(f"https://lmgtfy2.com/query/?q={search_terms}")
await ctx.send(
f"https://cog-creators.github.io/lmgtfy/search?q={search_terms}&btnK=Google+Search"
)

@commands.command(hidden=True)
@commands.guild_only()
Expand Down
2 changes: 1 addition & 1 deletion redbot/cogs/modlog/modlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@cog_i18n(_)
class ModLog(commands.Cog):
"""Browse and manage modlog cases."""
"""Browse and manage modlog cases. To manage modlog settings, use `[p]modlogset`."""

def __init__(self, bot: Red):
super().__init__()
Expand Down
6 changes: 3 additions & 3 deletions redbot/cogs/streams/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,10 @@ async def streamalert_list(self, ctx: commands.Context):
return

for channel_id, stream_platform in streams_list.items():
msg += f"** - #{ctx.guild.get_channel(channel_id)}**\n"
msg += f"- {ctx.guild.get_channel(channel_id).mention}\n"
for platform, streams in stream_platform.items():
msg += f"\t** - {platform}**\n"
msg += f"\t\t{humanize_list(streams)}\n"
msg += f" - **{platform}**\n"
msg += f" {humanize_list(streams)}\n"

for page in pagify(msg):
await ctx.send(page)
Expand Down
8 changes: 7 additions & 1 deletion redbot/core/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def interactive_config(red, token_set, prefix_set, *, print_header=True):
print(
"\nPick a prefix. A prefix is what you type before a "
"command. Example:\n"
"!help\n^ The exclamation mark is the prefix in this case.\n"
"!help\n^ The exclamation mark (!) is the prefix in this case.\n"
"The prefix can be multiple characters. You will be able to change it "
"later and add more of them.\nChoose your prefix:\n"
)
Expand All @@ -94,6 +94,12 @@ async def interactive_config(red, token_set, prefix_set, *, print_header=True):
"Prefixes cannot start with '/', as it conflicts with Discord's slash commands."
)
prefix = ""
if prefix and not confirm(
f'You chose "{prefix}" as your prefix. To run the help command,'
f" you will have to send:\n{prefix}help\n\n"
"Do you want to continue with this prefix?"
):
prefix = ""
if prefix:
await red._config.prefix.set([prefix])

Expand Down
1 change: 1 addition & 0 deletions redbot/core/commands/requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ def decorator(func: "_CommandOrCoro") -> "_CommandOrCoro":
if user_perms is None:
func.__requires_user_perms__ = None
else:
_validate_perms_dict(user_perms)
if getattr(func, "__requires_user_perms__", None) is None:
func.__requires_user_perms__ = discord.Permissions.none()
func.__requires_user_perms__.update(**user_perms)
Expand Down
22 changes: 22 additions & 0 deletions redbot/core/core_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def entity_transformer(statement: str) -> str:
TokenConverter = commands.get_dict_converter(delims=[" ", ",", ";"])

MAX_PREFIX_LENGTH = 25
MINIMUM_PREFIX_LENGTH = 1


class CoreLogic:
Expand Down Expand Up @@ -4052,6 +4053,24 @@ async def _set_prefix(self, ctx: commands.Context, *prefixes: str):
_("Prefixes cannot start with '/', as it conflicts with Discord's slash commands.")
)
return
if any(len(x) < MINIMUM_PREFIX_LENGTH for x in prefixes):
await ctx.send(
_(
"Warning: A prefix is below the recommended length (1 character).\n"
"Do you want to continue?"
)
+ " (yes/no)"
)
pred = MessagePredicate.yes_or_no(ctx)
try:
await self.bot.wait_for("message", check=pred, timeout=30)
except asyncio.TimeoutError:
await ctx.send(_("Response timed out."))
return
else:
if pred.result is False:
await ctx.send(_("Cancelled."))
return
if any(len(x) > MAX_PREFIX_LENGTH for x in prefixes):
await ctx.send(
_(
Expand Down Expand Up @@ -4111,6 +4130,9 @@ async def _set_serverprefix(
_("Prefixes cannot start with '/', as it conflicts with Discord's slash commands.")
)
return
if any(len(x) < MINIMUM_PREFIX_LENGTH for x in prefixes):
await ctx.send(_("You cannot have a prefix shorter than 1 character."))
return
if any(len(x) > MAX_PREFIX_LENGTH for x in prefixes):
await ctx.send(_("You cannot have a prefix longer than 25 characters."))
return
Expand Down

0 comments on commit 168a8a1

Please sign in to comment.