当前位置: 首页>>代码示例>>Python>>正文


Python __main__.send_cmd_help方法代码示例

本文整理汇总了Python中__main__.send_cmd_help方法的典型用法代码示例。如果您正苦于以下问题:Python __main__.send_cmd_help方法的具体用法?Python __main__.send_cmd_help怎么用?Python __main__.send_cmd_help使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在__main__的用法示例。


在下文中一共展示了__main__.send_cmd_help方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: welcomeset

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
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) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:20,代码来源:welcome.py

示例2: trickleset

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
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) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:24,代码来源:economytrickle.py

示例3: autoapprove

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
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 
开发者ID:tekulvw,项目名称:Squid-Plugins,代码行数:18,代码来源:autoapprove.py

示例4: karma

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
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!") 
开发者ID:tekulvw,项目名称:Squid-Plugins,代码行数:19,代码来源:karma.py

示例5: draft_players

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
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() 
开发者ID:smlbiobot,项目名称:SML-Cogs,代码行数:27,代码来源:draftroyale.py

示例6: welcomeset_msg

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def welcomeset_msg(self, ctx):
        """Manage welcome messages
        """
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:9,代码来源:welcome.py

示例7: welcomeset_bot

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def welcomeset_bot(self, ctx):
        """Special welcome for bots"""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx)
            return 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:8,代码来源:welcome.py

示例8: whisper

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def whisper(self, ctx, choice: str=None):
        """Sets whether or not a DM is sent to the new user

        Options:
            off - turns off DMs to users
            only - only send a DM to the user, don't send a welcome to the channel
            both - send a message to both the user and the channel

        If Option isn't specified, toggles between 'off' and 'only'
        DMs will not be sent to bots"""
        options = {"off": False, "only": True, "both": "BOTH"}
        server = ctx.message.server
        if choice is None:
            self.settings[server.id]["WHISPER"] = not self.settings[server.id]["WHISPER"]
        elif choice.lower() not in options:
            await send_cmd_help(ctx)
            return
        else:
            self.settings[server.id]["WHISPER"] = options[choice.lower()]
        dataIO.save_json(settings_path, self.settings)
        channel = self.get_welcome_channel(server)
        if not self.settings[server.id]["WHISPER"]:
            await self.bot.say("I will no longer send DMs to new users")
        elif self.settings[server.id]["WHISPER"] == "BOTH":
            await self.bot.send_message(channel, "I will now send welcome "
                                        "messages to {0.mention} as well as to "
                                        "the new user in a DM".format(channel))
        else:
            await self.bot.send_message(channel, "I will now only send "
                                        "welcome messages to the new user "
                                        "as a DM".format(channel))
        await self.send_testing_msg(ctx) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:34,代码来源:welcome.py

示例9: adventure

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def adventure(self, ctx):
        """Greetings adventurer. What is it that you plan on doing today?"""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx)
            return 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:7,代码来源:adventure.py

示例10: team_list

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def team_list(self, ctx):
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:6,代码来源:adventure.py

示例11: tableset

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def tableset(self, ctx):
		"""Got some nice settings for my UNflipped tables"""
		if ctx.invoked_subcommand is None:
			await send_cmd_help(ctx)
			msg = "```"
			for k, v in self.settings.items():
				msg += str(k) + ": " + str(v) + "\n"
			msg = "```"
			await self.bot.say(msg) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:11,代码来源:noflippedtables.py

示例12: replset

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def replset(self, ctx):
        """global repl settings"""
        if ctx.invoked_subcommand is None:
            await send_cmd_help(ctx) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:6,代码来源:repl.py

示例13: replset_print

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def replset_print(self, ctx):
        """Sets where repl content goes when response is too large."""
        if ctx.invoked_subcommand is None or \
                isinstance(ctx.invoked_subcommand, commands.Group):
            await send_cmd_help(ctx) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:7,代码来源:repl.py

示例14: replset_pagelength

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def replset_pagelength(self, ctx, length: int=1500):
        """Sets the page length when using the [p]replset print pages option

        length must be between 300 and 1700.
        length defaults to 1500"""
        if not (300 <= length <= 1700):
            return await send_cmd_help(ctx)
        old_length = self.settings["PAGES_LENGTH"]
        self.settings["PAGES_LENGTH"] = length
        dataIO.save_json("data/repl/settings.json", self.settings)
        await self.bot.say("each page will now break at {} characters "
                           "(was {})".format(length, old_length)) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:14,代码来源:repl.py

示例15: registerbot

# 需要导入模块: import __main__ [as 别名]
# 或者: from __main__ import send_cmd_help [as 别名]
def registerbot(self, ctx, agree: str):
        """registers the bot into Economy.py bank.

        Although nothing bad will probably happen,
        this was not how Economy was intended.
        I can't guarantee this and/or the economy cog won't break.
        I can't gaurantee your bank won't get corrupted.
        If you understand this and still want to register
        your bot in the bank, type
        [p]registerbot "I have read and understand. Just give my bot money!"
        """
        if agree.lower() == ("i have read and understand. "
                             "just give my bot money!"):
            econ = self.bot.get_cog('Economy')
            if not econ:
                await self.bot.say('Unable to load Economy cog. '
                                   'Please make sure it is loaded with '
                                   '`{}load economy`'.format(ctx.prefix))
                return
            botuser = ctx.message.server.me
            if not econ.bank.account_exists(botuser):
                econ.bank.create_account(botuser)
                await self.bot.say("Account opened for {}. Current balance: "
                                   "{}".format(botuser.mention,
                                               econ.bank.get_balance(botuser)))
            else:
                await self.bot.say("{} already has an account at the "
                                   "Twentysix bank.".format(botuser.mention))
        else:
            await send_cmd_help(ctx) 
开发者ID:irdumbs,项目名称:Dumb-Cogs,代码行数:32,代码来源:economytrickle.py


注:本文中的__main__.send_cmd_help方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。