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.")
评论列表
文章目录