def adduser(self, ctx, user: discord.User, *, command):
"""Restrict user from using [command]"""
confirm = await self._confirm_owner(ctx)
if not confirm:
return
AliasCog = self.bot.get_cog('Alias')
server = ctx.message.server
valid = True if self.bot.get_command(command) else False
if not valid:
valid = True if command in AliasCog.aliases[server.id] else False
if user and user.id in self.settings["USERS"]:
pass
else:
await self.bot.say("That user is not a co-owner.")
return
if valid and command not in self.settings["USERS"][user.id]["RESTRICTED"]:
await self.bot.say("**{} will be restricted from using**: {}".format(user.display_name, command))
self.settings["USERS"][user.id]["RESTRICTED"].append(command)
dataIO.save_json(self.path, self.settings)
elif command in self.settings["RESTRICTED"]:
await self.bot.say("{} is already a restricted command for {}".format(command, user.display_name))
else:
await self.bot.say("{} is not a valid command.".format(command))
评论列表
文章目录