def run_cc(self, cmd, msg):
gid = str(msg.guild.id)
if self.ccs[gid][cmd]["locked"] and not msg.author.guild_permissions.manage_messages:
await respond(msg, f"**WARNING: Custom command {cmd} is locked.**")
else:
ccdat = self.ccs[gid][cmd]["content"]
try:
res = self._find_tags(ccdat, msg)
except CustomCommandSyntaxError as e:
err = e if e else "Syntax error."
await respond(msg, f"**WARNING: Author made syntax error: {err}**")
except CommandSyntaxError as e:
err = e if e else "Syntax error."
await respond(msg, f"**WARNING: {err}**")
except Exception:
self.logger.exception("Exception occurred in custom command: ", exc_info=True)
await respond(msg, "**WARNING: An error occurred while running the custom command.**")
else:
if res:
await respond(msg, res)
else:
self.logger.warning(f"CC {cmd} of {str(msg.guild)} returns nothing!")
self.ccvars = {}
self.ccs[gid][cmd]["times_run"] += 1
self._save_ccs()
评论列表
文章目录