bot.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:Nurevam 作者: Maverun 项目源码 文件源码
def command_checker(msg):
    try:
        if isinstance(msg.channel,discord.DMChannel):
            if "!reply" in msg.content:
                bot.command_prefix = commands.when_mentioned_or("!")
                return

        if bot.user.id == 181503794532581376:
            bot.command_prefix = commands.when_mentioned_or("$")
            bot.pm_help = False
            return

        cmd_prefix= await bot.db.redis.get("{}:Config:CMD_Prefix".format(msg.guild.id))
        cmd_prefix= cmd_prefix.split(",")
        if '' in cmd_prefix: #check if "none-space" as a command, if true, return, in order to prevent any spam in case, lower chance of getting kick heh.
            return
        bot.command_prefix = commands.when_mentioned_or(*cmd_prefix)
        if "help" in msg.content: #changing setting for help, if guild owner want Help command to be via PM or to guild.
            if await bot.db.redis.get("{}:Config:Whisper".format(msg.guild.id)) == "on":
                bot.pm_help =True
            else:
                bot.pm_help=False
    except:
        pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号