Python __main__.send_cmd_help() Examples

The following are 30 code examples of __main__.send_cmd_help(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module __main__ , or try the search function .
Example #1
Source File: autoapprove.py    From Squid-Plugins with MIT License 6 votes vote down vote up
def autoapprove(self, ctx):
        server = ctx.message.server
        channel = ctx.message.channel
        me = server.me
        if not channel.permissions_for(me).manage_messages:
            await self.bot.say("I don't have manage_messages permissions."
                               " I do not recommend submitting your "
                               "authorization key until I do.")
            return
        if not channel.permissions_for(me).manage_server:
            await self.bot.say("I do not have manage_server. This cog is "
                               "useless until I do.")
            return
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx)
            return 
Example #2
Source File: welcome.py    From Dumb-Cogs with MIT License 6 votes vote down vote up
def welcomeset(self, ctx):
        """Sets welcome module settings"""
        server = ctx.message.server
        if server.id not in self.settings:
            self.settings[server.id] = deepcopy(default_settings)
            self.settings[server.id]["CHANNEL"] = server.default_channel.id
            dataIO.save_json(settings_path, self.settings)
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx)
            msg = "```"
            msg += "Random GREETING: {}\n".format(rand_choice(self.settings[server.id]["GREETING"]))
            msg += "CHANNEL: #{}\n".format(self.get_welcome_channel(server))
            msg += "ON: {}\n".format(self.settings[server.id]["ON"])
            msg += "WHISPER: {}\n".format(self.settings[server.id]["WHISPER"])
            msg += "BOTS_MSG: {}\n".format(self.settings[server.id]["BOTS_MSG"])
            msg += "BOTS_ROLE: {}\n".format(self.settings[server.id]["BOTS_ROLE"])
            msg += "```"
            await self.bot.say(msg) 
Example #3
Source File: draftroyale.py    From SML-Cogs with MIT License 6 votes vote down vote up
def draft_players(self, ctx: Context, *players: discord.Member):
        """Set the players playing in the draft."""
        author = ctx.message.author
        server = ctx.message.server

        if author != self.admin:
            await self.bot.say("Players must be set by the draft admin.")
            await self.bot.say(f"Draft admin: {self.admin.display_name}")
            return

        if players is None:
            await send_cmd_help(ctx)
            return

        # reset players if already set
        self.players = []
        for player in players:
            if player not in server.members:
                await self.bot.say(
                    f"{player.display_name} is not on this server.")
            else:
                self.players.append(player)

        await self.list_players()
        self.save_players_settings() 
Example #4
Source File: karma.py    From Squid-Plugins with MIT License 6 votes vote down vote up
def karma(self, ctx):
        """Checks a user's karma, requires @ mention

           Example: !karma @Red"""
        if len(ctx.message.mentions) != 1:
            await send_cmd_help(ctx)
            return
        member = ctx.message.mentions[0]
        if self.scores.get(member.id, 0) != 0:
            member_dict = self.scores[member.id]
            await self.bot.say(member.name + " has " +
                               str(member_dict["score"]) + " points!")
            reasons = self._fmt_reasons(member_dict.get("reasons", []))
            if reasons:
                await self.bot.send_message(ctx.message.author, reasons)
        else:
            await self.bot.say(member.name + " has no karma!") 
Example #5
Source File: economytrickle.py    From Dumb-Cogs with MIT License 6 votes vote down vote up
def trickleset(self, ctx):
        """Changes economy trickle settings
        Trickle amount:
            base amount + (# active users - 1) x multiplier + bonus pot
        Every active user gets the trickle amount. 
        It is not distributed between active users.
        """
        server = ctx.message.server
        settings = self.settings.setdefault(server.id,
                                            deepcopy(DEFAULT_SETTINGS))
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx)
            msg = "```"
            for k, v in settings.items():
                if k == 'CHANNELS':
                    v = ['#' + c.name if c else 'deleted-channel'
                         for c in (server.get_channel(cid) for cid in v)]
                    v = ', '.join(v)
                v = {True: 'On', False: 'Off'}.get(v, v)
                msg += str(k) + ": " + str(v) + "\n"
            msg += "```"
            await self.bot.say(msg) 
Example #6
Source File: magic.py    From SML-Cogs with MIT License 5 votes vote down vote up
def magic_adduser(self, ctx, member: discord.Member):
        """Permit user to have the magic role."""
        if member is None:
            await send_cmd_help(ctx)
            return
        server = ctx.message.server
        member_ids = self.settings[server.id]["member_ids"]
        if member.id not in member_ids:
            member_ids.append(member.id)
            dataIO.save_json(JSON, self.settings)
        success = await self.edit_user_roles(server, member, add=True)
        if not success:
            await self.bot.say(
                "I don’t have permission to edit that user’s roles.")
        await self.list_magic_users(ctx) 
Example #7
Source File: keenlog.py    From SML-Cogs with MIT License 5 votes vote down vote up
def keenlog_userheatmap(self, ctx, *args):
        """User heat map"""
        parser = KeenLogger.parser()
        try:
            p_args = parser.parse_args(args)
        except SystemExit:
            await send_cmd_help(ctx)
            return

        server = ctx.message.server
        s = self.message_search.server_members_heatmap(server, p_args)

        p = pprint.PrettyPrinter(indent="4")
        for hit in s.scan():
            p.pprint(hit.to_dict()) 
Example #8
Source File: votemanager.py    From SML-Cogs with MIT License 5 votes vote down vote up
def votemanager(self, ctx):
        """Settings."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #9
Source File: banned.py    From SML-Cogs with MIT License 5 votes vote down vote up
def setbanned(self, ctx):
        """Set banned settings."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #10
Source File: mentionutil.py    From SML-Cogs with MIT License 5 votes vote down vote up
def mentionutilset_remove(self, ctx, member: discord.Member):
        """Add a user."""
        if member is None:
            await send_cmd_help(ctx)
            return

        if self.settings.mentionblock.users == Box():
            self.settings.mentionblock.users = BoxList()
        self.settings.mentionblock.users.remove(member)
        await self.bot.say("User removed.")
        self.save() 
Example #11
Source File: keenlog.py    From SML-Cogs with MIT License 5 votes vote down vote up
def ownerkeenlog(self, ctx):
        """Bot owner level data access.

        Mainly difference is that the bot owner is allowed to see data from another server
        since he/she admins those servers.
        """
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #12
Source File: magic.py    From SML-Cogs with MIT License 5 votes vote down vote up
def magic_removeuser(self, ctx, member: discord.Member):
        """Permit user to have the magic role."""
        if member is None:
            await send_cmd_help(ctx)
            return
        server = ctx.message.server
        member_ids = self.settings[server.id]["member_ids"]
        if member.id in member_ids:
            member_ids.remove(member.id)
            dataIO.save_json(JSON, self.settings)
        success = await self.edit_user_roles(server, member, remove=True)
        if not success:
            await self.bot.say(
                "I don’t have permission to edit that user’s roles.")
        await self.list_magic_users(ctx) 
Example #13
Source File: vcutil.py    From SML-Cogs with MIT License 5 votes vote down vote up
def vcutil(self, ctx):
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #14
Source File: mentionutil.py    From SML-Cogs with MIT License 5 votes vote down vote up
def mentionutilset(self, ctx):
        """Mention Utility settings."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #15
Source File: userdata.py    From SML-Cogs with MIT License 5 votes vote down vote up
def setuserdata(self, ctx):
        """Set user data settings."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #16
Source File: challonge.py    From SML-Cogs with MIT License 5 votes vote down vote up
def setchallonge(self, ctx: Context):
        """Set challonge settings.

        http://api.challonge.com/v1"""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #17
Source File: userdata.py    From SML-Cogs with MIT License 5 votes vote down vote up
def userdata(self, ctx):
        """User Data."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #18
Source File: keenlog.py    From SML-Cogs with MIT License 5 votes vote down vote up
def ownerkeenlog_users(self, ctx, *args):
        """Show debug"""
        parser = KeenLogger.parser()
        try:
            p_args = parser.parse_args(args)
        except SystemExit:
            await send_cmd_help(ctx)
            return

        await self.bot.type()
        server = ctx.message.server
        s = self.message_search.server_messages(server, p_args)

        results = [{
            "author_id": doc.author.id,
            "channel_id": doc.channel.id,
            "timestamp": doc.timestamp,
            "rng_index": None,
            "rng_timestamp": None,
            "doc": doc
        } for doc in s.scan()]

        p = pprint.PrettyPrinter(indent="4")
        out = p.pformat(results)

        for page in pagify(out, shorten_by=80):
            await self.bot.say(box(page, lang='py')) 
Example #19
Source File: draftroyale.py    From SML-Cogs with MIT License 5 votes vote down vote up
def draft(self, ctx: Context):
        """Clash Royale Draft System.

        Full help
        !draft help
        """
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #20
Source File: keenlog.py    From SML-Cogs with MIT License 5 votes vote down vote up
def keenlogset(self, ctx):
        """ES Log settings."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #21
Source File: recruit.py    From SML-Cogs with MIT License 5 votes vote down vote up
def recruit_get(self, ctx: Context, clan: str):
        if clan is None:
            await send_cmd_help(ctx)
        server = ctx.message.server
        self.init_server_settings(server.id)
        if clan not in self.settings[server.id]["messages"]:
            await self.bot.say(
                "{} has no recruitment messages set.".format(clan))
            return
        await self.bot.say(self.settings[server.id]["messages"][clan]) 
Example #22
Source File: recruit.py    From SML-Cogs with MIT License 5 votes vote down vote up
def recruit_set(self, ctx: Context, clan: str, *, msg: str):
        """Set recruiting message."""
        if clan is None:
            await send_cmd_help(ctx)
        if msg is None:
            await send_cmd_help(ctx)
        server = ctx.message.server
        author = ctx.message.author
        author_roles = [r.name for r in author.roles]
        if clan not in author_roles:
            await self.bot.say(
                "{} is not in {}.".format(
                    author.display_name, clan))
            return
        self.init_server_settings(server.id)
        server_permit_roles = self.settings[server.id]["roles"]
        allowed = False
        for r in server_permit_roles:
            if discord.utils.get(author.roles, name=r) is not None:
                allowed = True
        if not allowed:
            await self.bot.say(
                "{} is not permitted to set recruitment messages".format(
                    author.display_name))
            return
        self.settings[server.id]["messages"][clan] = str(msg)
        await self.bot.say(
            "Added recruitment messages for {}".format(clan))
        dataIO.save_json(JSON, self.settings) 
Example #23
Source File: recruit.py    From SML-Cogs with MIT License 5 votes vote down vote up
def setrecruit(self, ctx: Context):
        """Set roles allowed to change recruit messages."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #24
Source File: firebase.py    From SML-Cogs with MIT License 5 votes vote down vote up
def firebase(self, ctx):
        """Run Firebase commands."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #25
Source File: firebase.py    From SML-Cogs with MIT License 5 votes vote down vote up
def setfirebase(self, ctx):
        """Set Firebase settings."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #26
Source File: ga.py    From SML-Cogs with MIT License 5 votes vote down vote up
def setga(self, ctx):
        """Set Firebase settings."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #27
Source File: smldebug.py    From SML-Cogs with MIT License 5 votes vote down vote up
def smldebug(self, ctx):
        """SML Debugging utility."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #28
Source File: feedback.py    From SML-Cogs with MIT License 5 votes vote down vote up
def setfeedback_addrole(self, ctx: Context):
        """Set feedback role permissions."""
        if ctx.invoked_subcommand is None or\
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx) 
Example #29
Source File: feedback.py    From SML-Cogs with MIT License 5 votes vote down vote up
def setfeedback(self, ctx: Context):
        """Set settings."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
Example #30
Source File: archive.py    From SML-Cogs with MIT License 5 votes vote down vote up
def archiveserver(self, ctx):
        """Archive server."""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx)