Example #1
0
     for p in prefixes
     if (pf := f"`{p}`")
     and len(pf) < 1800
     and ((counter + len(pf)) < 1800)
     and (counter := counter + len(pf))
 ]
 if not prefix_list:
     return
 prefixes_string = humanize_list(prefix_list)
 single_prefix = prefix_list[0][1:-1]
 destination = channel if guild else author
 help_command = self.bot.get_command("help")
 verb = _("my prefix here is") if len(prefix_list) == 1 else _("my prefixes here are")
 if help_command:
     view = StringView(message.content)
     ctx: Context = Context(prefix=None, view=view, bot=self.bot, message=message)
     if not await help_command.can_run(ctx):
         return await destination.send(
             _("Hey there, {verb} the following:\n{p_list}").format(
                 p_list=prefixes_string, verb=verb
             )
         )
     else:
         return await destination.send(
             _(
                 "Hey there, {verb} the following:\n{p_list}\n"
                 "Why don't you try `{p}{command}` to see everything I can do."
             ).format(
                 p_list=prefixes_string,
                 p=single_prefix,
                 command=help_command.qualified_name,
Example #2
0
def red_context(discord_message, red_bot):
    from redbot.core.commands import Context

    return Context(prefix="!", message=discord_message, bot=red_bot)