custom_commands.py 文件源码

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

项目:Red_Star 作者: medeor413 项目源码 文件源码
def _dumpcc(self, msg):
        gid = str(msg.guild.id)
        self._initialize(gid)
        if msg.author.id in self.storage[gid]["cc_create_ban"]:
            raise UserPermissionError("You are banned from editing custom commands.")
        gid = str(msg.guild.id)
        self._initialize(gid)
        args = msg.content.split(" ", 1)
        if len(args) < 2:
            raise CommandSyntaxError("No name provided.")
        name = args[1].lower()
        if name in self.ccs[gid]:
            t_cc = {
                "name": name,
                "content": self.ccs[gid][name]["content"]
            }
            t_cc = json.dumps(t_cc, indent=2, ensure_ascii=False)
            async with msg.channel.typing():
                await respond(msg, "**AFFIRMATIVE. Completed file upload.**",
                              file=File(BytesIO(bytes(t_cc, encoding="utf-8")), filename=name + ".json"))
        else:
            raise CommandSyntaxError("No such custom command.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号