Beispiel #1
0
async def help(ctx):
    gold = discord.Colour.gold()
    helper = discord.Embed(
        title='Senko-san',
        description='wh-what would you like to do with me uwu\n',
        colour=gold)
    commands = {}
    #Command help
    commands['s$hello'] = "Returns a greeting and mention"
    commands['s$remind <game> <day> <time>'] = "Sets a reminder for a game"
    commands['s$love <user>'] = "Send some love to another user"
    commands['s$hate <user>'] = "Add a user to the hate list"
    commands['s$hate_remove <user>'] = "Remove a user from the hate list"
    commands['s$pat'] = "Pat Senko"

    #Passive help
    commands['Passive: "Bruh Detector"'] = "Detects bruh moments"
    commands['Passive: "DadBot"'] = "It's our dad"
    commands['Passive: "Censor"'] = "Censors bad words"

    for command, description in commands.items():
        helper.add_field(name=command,
                         value=(description + "\n"),
                         inline=False)
    await ctx.channel.send(embed=helper)
async def commands(ctx):
    if not str(ctx.channel.id) == str(CHANNEL): return

    embed = discord.Embed(title="Bot Commands",
                          description="The commands for le cocktail bot",
                          color=discord.Color.blue())
    embed.set_thumbnail(
        url=
        "https://www.clipartkey.com/mpngs/m/302-3029474_server-icon-download-icons-server-icon-png-white.png"
    )
    commands = {
        "#commands":
        "Lists all the commands currently implimented.",
        "#newdrink":
        "Walks you throught how to add a new drink to the database.",
        "#randomdrink":
        "displays a random drink.",
        "#top":
        "lists the top 3 most voted for drinks.",
        "#whoami":
        "Lists basic public info about whoever runs the command (date joined, username, user id, current roles)",
        "#clear x":
        "(Admin only) clears x amount of above messages, does not remove pins.",
        "#rebuild":
        "(Admin only) will clears likes and re-post all the drinks in the database, make sure the channel is clear before using!",
        "#remove [message id]":
        "(Admin only) will completly remove a drink from the database, please use this and do not just remove the message, the drink will still show up in #random drink if not."
    }
    for x, y in commands.items():
        embed.add_field(name=x, value=y)
    await ctx.send(embed=embed)
Beispiel #3
0
async def usage(ctx, cmd=""):
    commands = {
        "usage":
        "'.u[sage]', displays all commands.",
        "reset":
        "'.r[eset]', resets blacklist of banned words.",
        "kick":
        "'.k[ick] @user [reason]', kicks a user with optional reason.",
        "threshold":
        "'.t[hreshold] (0.0 - 1.0)', changes threshold detection for profanity filtering.",
        "quiet":
        "'.q[uiet]', toggles quiet mode on or off.",
        "addword":
        "'.a[ddword] (word)', adds a word to blacklist.",
        "delete":
        "'.d[elete] @user [# of messages to delete]', select a user's previous message to delete, or delete a number of previous messages.",
        "mute":
        "'.m[ute] @user [reason]', mutes/unmutes a user with optional reason.",
    }
    if cmd == "":
        cmdstr = ""
        for k, v in commands.items():
            cmdstr += (k + ": " + v + "\n\n")
        await ctx.send("```\nCommand: Usage\n\n" + cmdstr + "```")
    else:
        await ctx.send(commands[cmd])
Beispiel #4
0
    def __init__(self, client):
        self.client = client
        default_commands_filepath = os.path.join(
            client.bot_dir, "assets/default_commands.json"
        )
        self.extra_commands_filepath = os.path.join(
            client.bot_dir, "assets/extra_commands.json"
        )
        self.custom_commands = {}

        # Load the default commands
        with open(default_commands_filepath, "r") as f:
            commands = json.loads(f.read())
            for command, metadata in commands.items():
                self._faq_command_add(
                    command, metadata["content"], metadata["description"]
                )

        # Load or initialize the custom commands
        if os.path.exists(self.extra_commands_filepath):
            with open(self.extra_commands_filepath, "r") as f:
                self.custom_commands = json.loads(f.read())
                for command, metadata in self.custom_commands.items():
                    self._faq_command_add(
                        command,
                        metadata["content"],
                        metadata.get("description", metadata["content"]),
                    )
        else:
            self._write_json({}, self.extra_commands_filepath)
Beispiel #5
0
    async def commandstats(self, ctx, all_stats: bool = False):
        data = self.config.get('data', {})
        if all_stats:
            title = "Bot"
            commands = {}
            for d in data:
                server_cmds = data.get(d, {})
                for c in server_cmds.keys():
                    current = commands.get(c, 0)
                    commands[c] = current + server_cmds[c]
        else:
            title = "This Server"
            commands = data.get(ctx.message.server.id, {})
        commands = OrderedDict(
            sorted(commands.items(), key=lambda x: x[1], reverse=True))

        stats = []
        for c in commands.keys():
            stats.append(c + ": " + str(commands[c]))
        try:
            pager = Pages(self.bot, message=ctx.message, entries=stats)
            pager.embed.colour = Colors.get_default(self.bot)
            pager.embed.set_author(name="Command stats for " + title,
                                   icon_url=ctx.message.server.icon_url)
            await pager.paginate()

        except Exception as e:
            await self.bot.say(e)
Beispiel #6
0
 def _get_help_list(self, commands) -> str:
     if len(commands) <= 0:
         return "[There are no commands under this category]"
     i = max(len(x) for x in commands)
     s = ""
     for name, command in commands.items():
         s += f"{name:{i}} : {command.brief}\n"
     return s
Beispiel #7
0
async def help(ctx, command: str = "all", page: int = 1):
    fields = 0
    embed = discord.Embed(title=lang['help.embed.title'], color=0xccab2b)
    embed.set_author(name="Patreon",
                     url="https://patreon.com/join/lonnstyle",
                     icon_url="https://i.imgur.com/CCYuxwH.png")
    if command == "all":
        for command in bot.commands:
            if command.brief != None:
                if (page - 1) * 25 <= fields <= page * 25 - 1:
                    embed.add_field(
                        name=f"{jdata['command_prefix']}{command.name}",
                        value=command.brief,
                        inline=True)
                fields += 1
        embed.set_footer(text=lang['help.embed.footer'].format(
            command_prefix=jdata['command_prefix'],
            page=page,
            total=int((fields - fields % 25) / 25 + 1)))
        await ctx.send(embed=embed)
    elif command in commands.values():
        for botcommand in bot.commands:
            if command == "common" and botcommand.cog_name == None:
                if (page - 1) * 25 < fields <= page * 25 - 1:
                    embed.add_field(
                        name=f"{jdata['command_prefix']}{botcommand.name}",
                        value=botcommand.brief)
                fields += 1
            for ext, tag in commands.items():
                if tag == command and ext == botcommand.cog_name:
                    if (page - 1) * 25 < fields <= page * 25 - 1:
                        embed.add_field(
                            name=f"{jdata['command_prefix']}{botcommand.name}",
                            value=botcommand.brief)
                    fields += 1
        embed.set_footer(text=lang['help.embed.footer'].format(
            command_prefix=jdata['command_prefix'],
            page=page,
            total=int((fields - fields % 25) / 25 + 1)))
        await ctx.send(embed=embed)
    else:
        for botcommand in bot.commands:
            if botcommand.name == command:
                aliases = botcommand.name
                params = ""
                for param in botcommand.clean_params:
                    params += f" <{param}>"
                for alias in botcommand.aliases:
                    aliases += f"|{alias}"
                embed.add_field(
                    name=f"{jdata['command_prefix']}[{aliases}]{params}",
                    value=botcommand.description)
                await ctx.send(embed=embed)
                return
        await ctx.send(lang['help.not_found'].format(user=jdata['user']))
  def help(self, message, state):
    """Shows this help message"""
    response = f'In game help for {state.game}:\n\n'
    
    commands = self.__help_commands()
    width = max([len(c) for c in commands.keys()]) +2
    fmt = "{{cmd:{width}}}{{help}}\n".format(width=width)
    for cmd, func in commands.items():
      response += fmt.format(cmd=cmd,help=getattr(self,func).__doc__)

    response = "```" + response + "```"
    return response
Beispiel #9
0
 async def get_commands(self, cursor, search):
     """Returns ordered dict of commands from cursor
     and search string in DB"""
     commands = {}
     async for stat in cursor:
         if stat[search] in commands:
             commands[stat[search]] += 1
         else:
             commands[stat[search]] = 1
     ordered_commands = collections.OrderedDict(
         sorted(commands.items(), key=lambda x: x[1], reverse=True))
     return ordered_commands
Beispiel #10
0
def VoiceCog(bot: commands.bot.BotBase) -> BaseVoiceCog:
    with open("jsons/sounds.json") as f:
        sounds_json = json.load(f)

    commands = {}
    for name, data in sounds_json.items():
        commands[name] = SoundPlayerCommand(name, data)

    pdict = {"sound_" + name: cmd for name, cmd in commands.items()}
    pdict["soundcommands"] = commands

    VoiceCogT = type("VoiceCog", (BaseVoiceCog, ), pdict)

    return VoiceCogT(bot)
Beispiel #11
0
 def _gen_alias_dict(self, commands):
     """ Reverses the direction of a dict of commans→aliases to be alias→command. """
     inverted = {}
     subcommands = {}
     for cmd, properties in commands.items():
         if isinstance(properties, list):
             for alias in properties:
                 inverted[alias] = cmd
         else:
             for alias in properties['aliases']:
                 inverted[alias] = cmd
             if properties.get('sub_commands', None):
                 subcommands[cmd] = self._gen_alias_dict(
                     properties['sub_commands'])
     inverted['sub_commands'] = subcommands
     return inverted
Beispiel #12
0
 async def pre_create(self, ctx: discord.ext.commands.Context):
     count = 0
     commands = {command.qualified_name: command for command in self.bot.walk_commands()}
     commands.update({name: cog for name, cog in self.bot.cogs.items()})
     for name, command_or_cog in commands.items():
         path = os.path.join(self.HELP_FILE_DIR, name.lower() + ".md")
         if not os.path.exists(path) or os.stat(path).st_size == 0:
             with open(path, "w") as file:
                 if isinstance(command_or_cog, discord.ext.commands.Command):
                     params = list(command_or_cog.params.values())[2:]
                     if len(params) > 0:
                         file.write("\n\nArguments:\n")
                         for param in params:
                             file.write(f"* `{param.name}`:\n")
                         file.write("\nExamples:\n")
             count += 1
     logger.info("Created %s files", count)
     embed = Embed(ctx, title="File Creation Was Successful", color=discord.Color.green(),
                   description="The extended help files were successfully created.")
     embed.add_field(name="Files Created", value=str(count))
     await ctx.send(embed=embed)
async def help(ctx, command:str="all", page:int=1):
  fields = 0
  embed = discord.Embed(title="幫助列表",color=0xccab2b)
  if command == "all":
    for command in bot.commands:
      if command.brief != None:
        if (page-1)*25<fields<=page*25-1:
          embed.add_field(name=f"{jdata['command_prefix']}{command.name}", value=command.brief, inline=True)
        fields += 1
    embed.set_footer(text=f"第{page}/{int((fields-fields%25)/25+1)}頁")
    await ctx.send(embed=embed)
  elif command in commands.values():
    for botcommand in bot.commands:
      if command == "common" and botcommand.cog_name == None:
        if (page-1)*25<fields<=page*25-1:
          embed.add_field(name=f"{jdata['command_prefix']}{botcommand.name}", value=botcommand.brief)
        fields += 1
      for ext,tag in commands.items():
        if tag == command and ext == botcommand.cog_name:
          if (page-1)*25<fields<=page*25-1:
            embed.add_field(name=f"{jdata['command_prefix']}{botcommand.name}", value=botcommand.brief)
          fields += 1
    embed.set_footer(text=f"第{page}/{int((fields-fields%25)/25+1)}頁")
    await ctx.send(embed=embed)
  else:
    for botcommand in bot.commands:
      if botcommand.name == command:
        aliases = botcommand.name
        params = ""
        for param in botcommand.clean_params:
          params += f"<{param}>"
        for alias in botcommand.aliases:
          aliases += f"|{alias}"
        embed.add_field(name=f"{jdata['command_prefix']}[{aliases}] {params}",value=botcommand.description)
        await ctx.send(embed=embed)
        return
    await ctx.send("找不到您要問的呢")
Beispiel #14
0
    async def send_bot_help(self,
        mapping: Mapping[Optional[discord.ext.commands.Cog], List[discord.ext.commands.Command]]) -> None:
        if self.context is None: return

        commands: Mapping[str, Set[discord.ext.commands.Command]] = collections.defaultdict(set)
        for cmds in mapping.values():
            for cmd in cmds:
                allowed = True
                for check in cmd.checks:
                    if isinstance(check, plugins.privileges.PrivCheck):
                        if not check(self.context):
                            allowed = False
                            break
                if allowed:
                    commands[cmd.module].add(cmd)
        prefix = self.context.prefix or ""

        listing = "\n".join("{}: {}".format(module.rsplit(".", 1)[-1],
                ", ".join(util.discord.format("{!i}", prefix + cmd.name) for cmd in sorted(cmds, key=lambda c: c.name)))
            for module, cmds in sorted(commands.items(), key=lambda mc: mc[0].rsplit(".", 1)[-1]))

        await self.get_destination().send(
            util.discord.format("**Commands:**\n{}\n\nType {!i} for more info on a command.",
                listing, prefix + self.invoked_with + " <command name>"))
Beispiel #15
0
async def on_message(message):
    # Don't need the bot to reply to itself.
    if message.author == client.user:
        return

    # Randomly picks a lyric from the list of kanye_lyrics
    if message.content.upper().startswith('+KANYE'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.kanye_lyrics))

    # Randomly picks a lyric from the list of gucci_lyrics
    if message.content.upper().startswith('+GUCCI'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.gucci_lyrics))

    # Randomly picks a lyrics from the list of random_lyrics
    if message.content.upper().startswith('+RANDOM'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.random_lyrics))

    # Randomly picks lyrics from the list of nas_lyrics
    # primarily lyrics from illmatic aka the best hip hop album of all time
    if message.content.upper().startswith('+NAS'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.nas_lyrics))

    # Randomly picks lyrics from the list of E40_lyrics
    if message.content.upper().startswith('+E40'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.E40_lyrics))

    # Randomly picks lyrics from the list of snoop_dogg_lyrics
    if message.content.upper().startswith('+SNOOP'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.snoop_dogg_lyrics))

    # Randomly picks lyrics from the list of three_six_lyrics
    if message.content.upper().startswith('+TRIPLE6'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.three_six_lyrics))

    # Randomly picks lyrics from the list of project_pat_lyrics
    if message.content.upper().startswith('+PAT'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.project_pat_lyrics))

    # Randomly picks lyrics from the list of wu_tang_lyrics
    if message.content.upper().startswith('+WUTANG'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.wu_tang_lyrics))

    # Randomly picks lyrics from the list of biggie_lyrics
    if message.content.upper().startswith('+BIGGIE'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.biggie_lyrics))

    # Rancomly picks lyrics from the list of doc_oct_lyrics
    if message.content.upper().startswith('+DROCTAGON'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.doc_oct_lyrics))

    # Randomly picks lyrics from the list of eminem_lyrics
    if message.content.upper().startswith('+EMINEM'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.eminem_lyrics))

    # Randomly picks lyrics from the list of gangsta gibbs lyrics
    if message.content.upper().startswith('+GIBBS'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.freddie_gibbs_lyrics))

    # Randomly picks lyrics from the list of Big L lyrics
    if message.content.upper().startswith('+BIGL'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.big_L_lyrics))

    # Randomly picks lyrics from the list of Outkast lyrics
    if message.content.upper().startswith('+OUTKAST'):
        await client.send_message(message.channel,
                                  random.choice(lyrics.outkast_lyrics))

    # Displays the bots personal opinion on who are the top 10 best hip-hop artist of all time
    if message.content.upper().startswith('+TOP10'):
        await client.send_message(
            message.channel,
            "This is my top ten list of the best hip-hop artist of all time.\n"
            "1. Nas\n"
            "2. Ghostface Killah\n"
            "3. Andre 3000\n"
            "4. The Notorious B.I.G.\n"
            "5. Big L\n"
            "6. Raekwon da Chef\n"
            "7. Tupac\n"
            "8. Kendrick Lamar\n"
            "9. Eminem\n"
            "10. Jay-Z")

    # Displays the bots personal opinion on who are the top 10 best hip-hop producers of all time
    if message.content.upper().startswith('+PRODUCERS'):
        await client.send_message(
            message.channel,
            "This is my top ten list of best hip-hop producers of all time.\n"
            "1. J Dilla\n"
            "2. Madlib\n"
            "3. RZA\n"
            "4. Dr. Dre\n"
            "5. Organized Noize\n"
            "6. No I.D.\n"
            "7. Pete Rock\n"
            "8. Sounwave\n"
            "9. Q-Tip\n"
            "10. Kanye West")

    # Uses markov chain to generate random lyrics
    if message.content.upper().startswith('+SPIT'):
        await client.send_message(message.channel, spit_game())

    # Displays commands for the user
    if message.content.upper().startswith('+HELP'):
        commands = {}
        commands[
            '+help'] = 'Young LD Displays the list of command that can be used.'
        commands[
            '+kanye'] = 'Displays random lyrics from the greatest artist of our generation.'
        commands[
            '+gucci'] = 'Displays lyrics by Guwop AKA El Gato the Human Glacier.'
        commands[
            '+nas'] = 'Displays random lyrics from the greatest album of all time, Illmatic.'
        commands['+e40'] = 'Displays random lyrics by E40 AKA Charlie Hustle.'
        commands['+snoop'] = 'Displays random lyrics by the Dogg Father.'
        commands['+triple6'] = 'Displays random lyrics by Three 6 Mafia.'
        commands['+pat'] = 'Displays random lyrics by Project Pat.'
        commands['+wutang'] = 'Wu-Tang is for the the children.'
        commands[
            '+biggie'] = 'Displays random lyrics by the black Frank White.'
        commands[
            '+droctagon'] = 'Displays random lyrics by Dr.Octagon AKA the Dr.Octagonecologyst.'
        commands['+eminem'] = 'Displays random lyrics by Eminem.'
        commands['+gibbs'] = 'Displays random lyrics by Gangsta Gibbs.'
        commands['+bigl'] = 'Displays random lyrics by Big L.'
        commands['+outkast'] = 'Displays random lyrics by Outkast.'
        commands[
            '+top10'] = 'Young LD displays his top 10 list of the best Hip-Hop artist of all time.'
        commands[
            '+producers'] = 'Young LD displays his top 10 list of the best Hip-Hop producers of all time.'
        commands[
            '+random'] = 'Displays random lyrics from a bunch of different artist.'
        commands[
            '+spit'] = 'Uses a Markov chain to combine lyrics and comes up with some funky shit.'

        msg = discord.Embed(title='Young Larry David',
                            description='Written by SnoopFrogg',
                            color=0x0000ff)
        for command, description in commands.items():
            msg.add_field(name=command, value=description, inline=False)
        #msg.add_field(name='Join our Discord/For Questions/Chilling', value='', inline=False)
        await client.send_message(message.channel, embed=msg)
Beispiel #16
0
    async def help(self, ctx, arg=""):
        prefix = await self.bot.read_prefix(ctx.guild.id)
        to_delete, delay, lang = await self.bot.read_settings(ctx.guild.id)
        lang_pack = locales(lang)
        trade_command = {
            f"<{prefix}wtb | {prefix}b> <pc | xbox | ps4 | swi> [ITEM_NAME]":
            lang_pack["help_wtb"],
            f"<{prefix}wts | {prefix}s> <pc | xbox | ps4 | swi> [ITEM_NAME]":
            lang_pack["help_wts"],
            f"<{prefix}riven | {prefix}r> <pc | xbox | ps4 | swi> [ITEM_NAME]":
            lang_pack["help_riven"],
            f"{prefix}ducats":
            lang_pack["help_ducats"]
        }
        ws_command = {
            f"<{prefix}fissures | {prefix}f> <pc | ps4 | xb1 | swi> <FILTER>":
            lang_pack["help_fissures"],
            f"{prefix}sortie":
            lang_pack["help_sortie"],
            f"{prefix}baro":
            lang_pack["help_baro"],
            f"{prefix}news <pc | xbox | ps4 | swi>":
            lang_pack["help_news"],
            f"{prefix}earth":
            lang_pack["help_earth"],
            f"{prefix}wiki [QUERY]":
            lang_pack["help_wiki"],
            f"{prefix}event":
            lang_pack["help_event"],
            f"{prefix}sentient":
            lang_pack["help_sentient"],
            f"{prefix}fish <cetus | fortuna>":
            lang_pack["help_fish"],
            f"{prefix}acolytes <pc | xbox | ps4 | swi>":
            "Views acolytes currently available"
        }
        other_commands = {
            f"{prefix}bug [MESSAGE]":
            lang_pack["help_bug"],
            f"{prefix}suggestion [MESSAGE]":
            lang_pack["help_suggestion"],
            f"{prefix}ping":
            lang_pack["help_ping"],
            f"{prefix}about":
            lang_pack["help_about"],
            f"{prefix}donate":
            lang_pack["help_donate"],
            f"{prefix}vote":
            lang_pack["help_vote"],
            f"{prefix}support":
            lang_pack["help_support"],
            f"{prefix}invite":
            lang_pack["help_invite"],
            f"{prefix}language [COUNTRY_CODE]":
            lang_pack["help_language"],
            f"{prefix}set_prefix [PREFIX]":
            lang_pack["help_set_prefix"],
            f"{prefix}get_prefix":
            lang_pack["help_get_prefix"],
            f"{prefix}settings [--delete] [n | no]":
            lang_pack["help_settings_delete"],
            f"{prefix}settings [--delay] [TIME_IN_SECOND]":
            lang_pack["help_settings_delay"],
            f"<{prefix}help | {prefix}h> <all>":
            lang_pack["help_help"]
        }
        if not len(arg):
            toReact = [
                'тПк', '<:wf_market:641718306260385792>',
                '<:ws:641721981292773376>', u"\u2699"
            ]
            embed = await self.embed_pagination(ctx)
            pagination = await ctx.send(embed=embed)
            for reaction in toReact:
                await pagination.add_reaction(reaction)
            while True:

                def check(reaction, user):
                    return user == ctx.message.author and str(
                        reaction.emoji) in toReact

                try:
                    reaction, user = await self.bot.wait_for('reaction_add',
                                                             check=check,
                                                             timeout=300.0)
                    emoji = str(reaction.emoji)
                except asyncio.TimeoutError:
                    try:
                        await ctx.message.delete()
                    except:
                        pass
                    return await pagination.delete()
                if 'тПк' in emoji:
                    embed = await self.embed_pagination(ctx)
                    thumb = ctx.guild.me.avatar_url
                elif '<:wf_market:641718306260385792>' in emoji:
                    embed = discord.Embed(
                        title="<:wf_market:641718306260385792> Warframe Market",
                        color=self.colour)
                    self._add_field(embed, trade_command)
                    thumb = "https://warframe.market/static/assets/frontend/logo_icon_only.png"

                elif '<:ws:641721981292773376>' in emoji:
                    embed = discord.Embed(
                        title="<:ws:641721981292773376> Worldstate commands",
                        color=self.colour)
                    self._add_field(embed, ws_command)
                    thumb = "https://avatars2.githubusercontent.com/u/24436369?s=280&v=4"
                elif u"\u2699" in emoji:
                    embed = discord.Embed(title=u"\u2699 Bot commands",
                                          color=self.colour)
                    self._add_field(embed, other_commands)
                    thumb = ctx.guild.me.avatar_url
                embed.set_thumbnail(url=thumb)
                embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)",
                                 icon_url=ctx.guild.me.avatar_url)
                await pagination.remove_reaction(reaction.emoji, user)
                await pagination.edit(embed=embed)
        elif arg == "all":
            commands = {
                "<:wf_market:641718306260385792> Warframe Market commands":
                trade_command,
                "<:ws:641721981292773376> Worldstate commands": ws_command,
                u"\u2699 Bot commands": other_commands
            }
            for k, v in commands.items():
                embed = discord.Embed(
                    title=k,
                    colour=self.colour,
                    description=lang_pack["help_description"])
                self._add_field(embed, v)
                embed.set_thumbnail(url=ctx.guild.me.avatar_url)
                embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)",
                                 icon_url=ctx.guild.me.avatar_url)
                await ctx.send(embed=embed)
        else:
            await ctx.send(
                message=lang_pack["command_help_invalide_arg"].format(
                    ctx.author.mention, prefix))
    async def commands_(self, ctx, user: discord.Member = None):
        """Get your or the specified users white- and blacklisted commands on this server"""
        guild = ctx.guild
        if not user:
            user = ctx.author

        if user.roles:
            roles = '(role IS NULL OR role IN ({}))'.format(', '.join(
                map(lambda r: str(r.id), user.roles)))
        else:
            roles = 'role IS NULL'

        where = f'guild={guild.id} AND (user={user.id} or user IS NULL) AND channel IS NULL AND {roles}'

        rows = self.get_rows(where)

        commands = {}
        for row in rows:
            name = row['command']

            if name in commands:
                commands[name].append(row)
            else:
                commands[name] = [row]

        whitelist = []
        blacklist = []
        global_blacklist = []
        for name, rows in commands.items():
            row = self.get_applying_perm(rows)
            name = f'`{name}`'
            if row is False:
                global_blacklist.append(name)
                continue

            # Don't want channel or server specific blacklists
            if row is None:
                continue

            if row['type'] == BlacklistTypes.WHITELIST:
                whitelist.append(name)

            elif row['type'] == BlacklistTypes.BLACKLIST:
                blacklist.append(name)

        s = ''
        if whitelist:
            s += f'{user}s whitelisted commands\n' + '\n'.join(
                whitelist) + '\n\n'

        if blacklist:
            s += f'Commands blacklisted fom {user}\n' + '\n'.join(
                blacklist) + '\n\n'

        if global_blacklist:
            s += f'Commands globally blacklisted for {user}\n' + '\n'.join(
                global_blacklist) + '\n\n'

        if not s:
            s = '{0} has no special perms set up on the server {1}'.format(
                user, guild.name)
        else:
            s += '{}s perms on server {}\nChannel specific perms are not checked'.format(
                user, guild.name)

        s = split_string(s, maxlen=2000, splitter='\n')
        for ss in s:
            await ctx.author.send(ss)
Beispiel #18
0
 async def help(self, ctx, command=None):
     commands = {
         'UTILITY': {
             'help': {
                 'description': 'Displays commands for DemaBot',
                 'usage': '!help [command]'
             },
             'ping': {
                 'description': 'PONG!',
                 'usage': '!ping'
             }
         },
         'FUN': {
             'tag': {
                 'description':
                 'Allows you to create a tag that others can use',
                 'usage': '!tag` `!tag create'
             },
             'hug': {
                 'description': 'Send a cute hug gif to another user',
                 'usage': '!hug [user]'
             }
         },
         'ECONOMY': {
             'bal': {
                 'description': 'Displays your current balance',
                 'usage': '!bal'
             },
             'top': {
                 'description': 'Lists the richest users in the server',
                 'usage': '!top'
             },
             'daily': {
                 'description':
                 'Gives you £100 every day plus a bonus reward for a 7 day streak',
                 'usage': '!daily'
             },
             'donate': {
                 'description': 'Donate money to another user',
                 'usage': '!donate [@user] [amount]'
             },
             'shop': {
                 'description':
                 'Displays the shop and allows you to buy items',
                 'usage': '!shop'
             },
             'role': {
                 'description':
                 'Allows you to choose from your purchased roles',
                 'usage': '!role'
             }
         }
     }
     if command is None:
         embed = discord.Embed(title="Help for DemaBot")
         embed.set_footer(text="Use `!help [command]` for more info")
         for name, cat in commands.items():
             coms = []
             for cname, com in cat.items():
                 coms.append(f"**{cname}** - {com['description']}")
             embed.add_field(name=name.upper(),
                             value='\n'.join(coms),
                             inline=False)
         await ctx.send(embed=embed)
     else:
         found = False
         for cat in commands.values():
             for name, com in cat.items():
                 if name == command:
                     embed = discord.Embed(title=f"Help for {name}")
                     embed.add_field(name='Description',
                                     value=com['description'],
                                     inline=False)
                     embed.add_field(name='Usage',
                                     value=f"`{com['usage']}`",
                                     inline=False)
                     await ctx.send(embed=embed)
                     found = True
                     return
             if found == True:
                 return
         if found == False:
             embed = discord.Embed(
                 title="ERROR",
                 description=
                 "The command you entered could not be found. Use `!help` to view a list of commands."
             )
             await ctx.send(embed=embed)
Beispiel #19
0
    async def help(self, ctx, arg=""):
        prefix = read_prefix(ctx.guild.id)
        trade_command = {
            f"<{prefix}wtb | {prefix}b> <pc | xbox | ps4 | swi> [ITEM_NAME]" : "Views 7 sellers sort by prices and status (Online in game)",
            f"<{prefix}wts | {prefix}s> <pc | xbox | ps4 | swi> [ITEM_NAME]" : "Views 7 buyers sort by prices and status (Online in game)",
            f"<{prefix}riven | {prefix}r> <pc | xbox | ps4 | swi> [ITEM_NAME]" : "Views 6 riven mod sorted by ascending prices and status (Online in game)",
            f"{prefix}ducats" : "Views 18 worth it items to sell in ducats"
        }
        ws_command = {
            f"<{prefix}fissures | {prefix}f> <pc | ps4 | xb1 | swi>" : "Views current fissures available",
            f"{prefix}sortie" : "Views current sortie",
            f"{prefix}baro" : "Views baro ki'teer inventory and dates",
            f"{prefix}news <pc | xbox | ps4 | swi>" : "Views news about Warframe",
            f"{prefix}earth" : "Views earth cycle",
            f"{prefix}wiki [QUERY]" : "Views wiki url according to the query",
            f"{prefix}event" : "Views current events",
            f"{prefix}sentient": "Views if Sentient ship is active or not",
            f"{prefix}fish <cetus | fortuna>": "Views fishing map based on location that you choosed"
        }
        other_commands = {
            f"{prefix}bug [MESSAGE]" : "Send me a bug report, this will helps to improve the bot",
            f"{prefix}suggestion [MESSAGE]" : "Suggestion to add for the bot, all suggestions are good don't hesitate",
            f"{prefix}ping" : "Views bot latency",
            f"{prefix}about" : "Bot info",
            f"{prefix}donate" : "Link to support me",
            f"{prefix}vote" : "An other way to support me",
            f"{prefix}support" : "Discord support if you need help or want to discuss with me",
            f"{prefix}invite" : "Views bot link invite",
            f"{prefix}set_prefix [PREFIX]" : "Set new prefix, Only admins",
            f"{prefix}get_prefix" : "Views actual guild prefix",
            f"{prefix}settings [--delete] [n | no]" : "Change message settings, Only admins",
            f"{prefix}settings [--delay] [TIME_IN_SECOND]" : "Change message delay setting, Only admins",
            f"<{prefix}help | {prefix}h> <all>" : "Views bot commands, you can provide argument `all` if you want all the commands in one"
        }
        if not len(arg):
            toReact = ['тПк', '<:wf_market:641718306260385792>', '<:ws:641721981292773376>',u"\u2699"]
            embed = self.embed_pagination(ctx)
            pagination = await ctx.send(embed=embed)
            for reaction in toReact:
                await pagination.add_reaction(reaction)
            while True:

                def check(reaction, user):
                    return user == ctx.message.author and str(reaction.emoji) in toReact
                try:
                    reaction, user = await self.bot.wait_for('reaction_add', check=check, timeout=300.0)
                    emoji = str(reaction.emoji)
                except asyncio.TimeoutError:
                    try:
                        await ctx.message.delete()
                    except:
                        pass
                    return await pagination.delete()
                if 'тПк' in emoji:
                    embed = self.embed_pagination(ctx)
                    thumb = ctx.guild.me.avatar_url
                elif '<:wf_market:641718306260385792>' in emoji:
                    embed = discord.Embed(title="<:wf_market:641718306260385792> Warframe Market",
                                        color=self.colour)
                    self._add_field(embed, trade_command)
                    thumb = "https://warframe.market/static/assets/frontend/logo_icon_only.png"

                elif '<:ws:641721981292773376>' in emoji:
                    embed = discord.Embed(title="<:ws:641721981292773376> Worldstate commands",
                                        color=self.colour)
                    self._add_field(embed, ws_command)
                    thumb = "https://avatars2.githubusercontent.com/u/24436369?s=280&v=4"
                elif u"\u2699" in emoji:
                    embed = discord.Embed(title=u"\u2699 Bot commands",
                                        color=self.colour)
                    self._add_field(embed, other_commands)
                    thumb = ctx.guild.me.avatar_url
                embed.set_thumbnail(url=thumb)
                embed.set_footer(text="Made with тЭдя╕П by Taki#0853 (WIP)",
                                icon_url=ctx.guild.me.avatar_url)
                await pagination.remove_reaction(reaction.emoji, user)
                await pagination.edit(embed=embed)
        elif arg == "all":
            commands = {
                "<:wf_market:641718306260385792> Warframe Market commands": trade_command,
                "<:ws:641721981292773376> Worldstate commands": ws_command,
                u"\u2699 Bot commands": other_commands
                }
            for k, v in commands.items():
                embed = discord.Embed(
                    title=k,
                    colour=self.colour,
                    description="`[RequiredArgument] <Parameter | To | Choose>`\n[Source code and commands](https://takitsu21.github.io/WarframeTrader/)"
                )
                self._add_field(embed, v)
                embed.set_thumbnail(url=ctx.guild.me.avatar_url)
                embed.set_footer(
                    text="Made with тЭдя╕П by Taki#0853 (WIP)",
                    icon_url=ctx.guild.me.avatar_url
                    )
                await ctx.send(embed=embed)
        else:
            msg = f"{ctx.author.mention} You provided an invalide argument, try with `{prefix}help all`"
            await ctx.send(message=msg)
Beispiel #20
0
    async def help(self, ctx, *args):
        commands = OrderedDict()
        commands['letmeknow'] = ['Get the letmeknow role, useful for getting pings when Lee goes live']
        # commands['morning'] = ['Good morning to our glorious Supreme Leader']  # dead meme
        # commands['quote'] = ['Shows quote #[quote_nr] or a random quote by [user]; if no number or user is given, a random quote is shown', '[quote_nr|user]', 'q']
        # commands['add_quote'] = ['Adds quote', '<quote> - <user>']
        # commands['remove_quote'] = ['Removes quote #[quote_nr] (Security only)', '<quote_nr>', 'remove_quote, del_quote']
        # commands['update_quote'] = ['Updates quote #[quote_nr] (Security only)', '<quote_nr> <"quote">', 'edit_quote, mod_quote']
        # commands['qcount'] = ['Shows how many quotes <name> has', '<name>']
        commands['time'] = ['Get Lee\'s local time']
        commands['hbd'] = ['Wish a happy birthday to the birthday kid']
        commands['report'] = ['Report an incident to the authorities']
        commands['dad'] = ['Get a random dad joke']
        commands['challenge'] = ['Challenge another user', '<mention>']
        # commands['offenses'] = ['Lists the amount of offenses the user has (Security only)', '<user_id>']
        commands['mute'] = ['Mutes the tagged user (Security only)', '<mention>']
        commands['gulag'] = ['Mute command with extra flavour (Security only)', '<mention>']
        commands['unmute'] = ['Unmutes the tagged user (Security only)', '<mention>']
        commands['free'] = ['Unmute command with extra flavour (Security only)', '<mention>']
        # commands['escape'] = ['Attempt to escape from the gulag (in gulag only)']
        commands['visit'] = ['Check out the wonders of the gulag as a visitor for a limited time']
        commands['ban'] = ['Bans the tagged user (Security only)', '<user_id> [reason] [days to purge]', 'yeet']
        commands['unban'] = ['Unbans the tagged user (Security only)', '<user_id> [reason]', 'unyeet']
        # commands['ignore'] = ['Adds [channel_id] to ignored channels; adds current channel if no parameter is given (Security only)', '[channel_id]', 'add_ignore']
        # commands['del_ignore'] = ['Removes channel [channel_id] from the ignored channel list (Security only)', '[channel_id]', 'remove_ignore']
        # commands['list_ignored'] = ['Lists all ignored channels (Security only)']
        commands['help'] = ['It\'s this command', '[command]', 'commands']

        prefix = 'l!'

        if not args:
            msg = '```'
            for command, desc in commands.items():  # for every command in the commands dict
                msg += f'{command}'  # command name
                try:
                    msg += f' {desc[1]}'
                except IndexError:
                    pass
                msg += f'\n'

            msg += f'''\n\n<required parameter>; [optional parameter]; \'...\' variable number of parameters; \'|\' OR operator\n
This server\'s prefix is {prefix}
Type {prefix}help [command] for more info on a command.```'''

        elif args[0] in commands:
            msg = f'```{prefix}{args[0]}'  # command name, arguments and aliases (if needed)
            try:
                msg += f' {commands[args[0]][1]}'
            except IndexError:
                pass
            msg += f'\n\n{commands[args[0]][0]}'
            try:
                msg += f'\n\nAliases: {commands[args[0]][2]}'
            except IndexError:
                pass
            msg += f'```'

        else:
            msg = 'No command called "'
            msg += ' '.join(args)
            msg += '" found.'
        await ctx.send(msg)
Beispiel #21
0
    async def help(self, ctx, *args):
        commands = OrderedDict()
        commands['touch'] = ['Touchy touchy', '<mention>', '']
        commands['bitchslap'] = ['Exactly what it sounds like', '<mention>', '']
        commands['challenge'] = ['Challenge another user', '<mention>', '']
        commands['banana'] = ['If you really need potassium', '', '']
        commands['fuckoff'] = ['Just f**k off mate', '', '']
        commands['pro'] = ['Professionals have standards', '', '']
        commands['reee'] = ['Autistic screeching of the highest quality', '', '']
        commands['yw'] = ['What can I say except you\'re welcome!', '', '']
        commands['f'] = ['Press F to pay respects', '', '']
        commands['banned'] = ['Doesn\'t actually ban but you get a cool gif', '', '']
        # commands['rape, molest'] = ['Non consensual sex with your preferred person/object (nsfw only)', '<mention>', 'nsfw']
        # commands['succ'] = ['Give someone of your choosing dat good succ (nsfw only)', '<mention>', 'nsfw']
        # commands['fill'] = [';)) (nsfw only)', '<mention>', 'nsfw']
        # commands['disable'] = ['Disables the tagged user (nsfw only)', '<mention>', 'nsfw']
        # commands['enable'] = ['Enables the tagged user (nsfw only)', '<mention>', 'nsfw']
        # commands['quote'] = ['Posts a random or selected quote from this server', '[quote number]', '']
        # commands['quote_list'] = ['Posts all the quotes from this server', '', '']
        # commands['add_quote'] = ['Adds the specified quote', '<"quote" - user>', '']
        commands['ricardo'] = ['Posts a random ricardo gif', '', '']
        commands['ricardobear'] = ['Posts the mighty ricardo bear', '', '']
        commands['bigricardo'] = ['Summons big ricardo', '', '']
        commands['wumpardo'] = ['Daddy Jack\'s wumpardo', '', '']
        # commands['check_nsfw'] = ['Checks if nsfw is enabled on this server or not', '', '']
        # commands['nsfw'] = ['Turns nsfw mode on or off (admin only)', '<on|off>', '']
        # commands['change_prefix'] = ['Changes the command prefix on this server (admin only)', '<prefix>', '']
        commands['help, commands'] = ['It\'s this command', '[command]', '']
        commands['invite'] = ['Get the invite link', '', '']

        # mode = sql_modes.check_mode(sv=ctx.guild.id)[0][0]   # returns list of tuples, use double index to get actual values
        # prefix = sql_modes.get_prefix(ctx.guild.id)
        prefix = '.'

        if not args:  # get longest command name, to have evenly spaced help message
            max_len = 0
            for cmd in commands:
                if len(cmd) > max_len:
                    max_len = len(cmd)

            msg = '```'
            for command, desc in commands.items():  # for every command in the commands dict
                # if mode != 'nsfw' and desc[2] == 'nsfw':
                #     continue
                msg += f'{command} '  # command name
                for _ in range(len(command), max_len):  # extra spaces
                    msg += ' '
                msg += f'{desc[0]}\n'  # add the description
            msg += f'''\n\n<required parameter>; [optional parameter]; \'...\' variable number of parameters; \'|\' OR operator\n
This server\'s prefix is {prefix}
Type {prefix}help [command] for more info on a command.

Database is down, idk when it's gonna be back up, some functionality won't be available til then.```'''

        elif args[0] in commands:
            msg = f'```{prefix}{args[0]} {commands[args[0]][1]}\n\n{commands[args[0]][0]}```'  # command name and arguments (if needed)

        else:
            msg = 'No command called "'
            msg += ' '.join(args)
            msg += '" found.'
        await ctx.send(msg)
    "marker": "Alignment marker test",
    "profiles": "Coffee profiling",
    "acc": "Accessory Guide",
}


@slash.slash(
    name="espresso",
    description="help with espresso",
    options=[
        manage_commands.create_option(
            name="topic",
            description="help topic",
            option_type=3,
            required=True,
            choices=[{"name": v, "value": k} for (k, v) in commands.items()],
        ),
        manage_commands.create_option(
            name="public",
            description="make the response to be visible for everyone in the channel",
            option_type=5,
            required=False,
        ),
    ],
    guild_ids=GUILD_IDS,
)
async def _help(ctx, topic: str, public: bool = False):
    if topic in db:
        await ctx.send(content=db[topic], hidden=not public)
    else:
        await ctx.send(content=f"We don't have anything for {topic}", hidden=not public)