Пример #1
0
    async def config(self, ctx, *args):
        args = list(args)
        global serverSettings
        command = Sudo(bot, ctx, serverSettings)
        if Sudo.isSudoer(bot, ctx, serverSettings) == True:
            await command.config(args)
        else: await command.config([])

        with open('serverSettings.json', 'r') as data:
            serverSettings = json.load(data, object_hook=lambda d: {int(k) if k.isdigit() else k: v for k, v in d.items()})
        return
Пример #2
0
    async def sudo(self, ctx, *args):
        global serverSettings
        args = list(args)
        if Sudo.isSudoer(bot, ctx, serverSettings) == False:
            await ctx.send(f"{ctx.author} is not in the sudoers file.  This incident will be reported.")
            Log.appendToLog(ctx, 'sudo', 'unauthorised')
        else:
            Log.appendToLog(ctx, "sudo", ' '.join(args).strip())
            command = Sudo(bot, ctx, serverSettings)
            await command.sudo(args)

        with open('serverSettings.json', 'r') as data:
            serverSettings = json.load(data, object_hook=lambda d: {int(k) if k.isdigit() else k: v for k, v in d.items()})
        return
Пример #3
0
    async def sudo(self, ctx, *args):

        if Sudo.is_sudoer(self.bot, ctx):
            Log.append_to_log(ctx, None, args)
            command = Sudo(self.bot, ctx)

            self.bot.serverSettings, self.bot.userSettings = await command.sudo(
                list(args))
            Sudo.save_configs(self.bot)
        else:
            await ctx.send(
                f"`{ctx.author}` is not in the sudoers file.  This incident will be reported."
            )
            Log.append_to_log(ctx, None, 'unauthorised')
        return
Пример #4
0
    async def config(self, ctx, *args):
        args = list(args)

        command = Sudo(self.bot, ctx)
        if len(args) > 0:
            localSetting = args[0] in ['locale', 'alias']
        else:
            localSetting = False

        if Sudo.is_sudoer(self.bot, ctx) or localSetting:
            self.bot.serverSettings, self.bot.userSettings = await command.config(
                args)

        else:
            self.bot.serverSettings, self.bot.userSettings = await command.config(
                [])
        Sudo.save_configs(self.bot)
        Log.append_to_log(ctx)