Ejemplo n.º 1
0
    async def delfilteredtoken(self, ctx: commands.Context, n: int):
        """
        Delete a filtered token
        #STAFF
        """
        if n < 0 or n >= len(config()["filters"]["token_blacklist"]):
            await ctx.send("Invalid number - do `!lfw` to view")
        conf = BotConfirmation(ctx, 0x5555ff)
        await conf.confirm(
            f'Delete `{config()["filters"]["token_blacklist"][n]}`?')

        if conf.confirmed:
            try:
                s = config()["filters"]["token_blacklist"][n]
                del config()["filters"]["token_blacklist"][n]
                save_config()
            except Exception as e:  # noqa e722
                await conf.update("An error occurred", color=0xffff00)
            else:
                await conf.update("Deleted!", color=0x55ff55)
                await self.modlog.log_message("Filter Token Modification",
                                              f"```diff\n - {s}```",
                                              ctx.author)
        else:
            await conf.update("Canceled", color=0xff5555)
Ejemplo n.º 2
0
    async def delstatus(self, ctx, n: int):
        """
        Deletes a status
        #OWNER
        """
        if len(config()["statuses"]) == 1:
            await ctx.send("Can't delete only status, do `!resetstatus`")
            return
        if n < 0 or n >= len(config()["statuses"]):
            await ctx.send("Invalid index, do `!liststatus`")
            return
        conf = BotConfirmation(ctx, 0x5555ff)
        await conf.confirm(f'Delete `{config()["statuses"][n]}`?')

        if conf.confirmed:
            try:
                s = config()["statuses"][n]
                del config()["statuses"][n]
                save_config()
                self.status = cycle(config()["statuses"])
                self.status_rotate.restart()
            except Exception as e:  # noqa e722
                await conf.update("An error occurred", color=0xffff00)
            else:
                await conf.update("Deleted!", color=0x55ff55)
                await self.modlog.log_message("Status Modification", f"```diff\n - {s}```", ctx.author)
        else:
            await conf.update("Canceled", color=0xff5555)
Ejemplo n.º 3
0
 async def autokick(self, ctx: commands.Context, days: int = None):
     """
     Set the threshold age to kick new accounts at
     !ak - shows current state
     !ak 4 - set to 4 days
     !ak 0 - turn off
     #STAFF
     """
     if days is None:
         st = "off" if config()["autokick"] == 0 else f"kicking accounts newer than " \
                                                      f"{config()['autokick']} days"
         await ctx.send(f"{self._get_autokick_emoji()} Autokick is {st}")
         return
     config()['autokick'] = days
     save_config()
     st = "off" if config()["autokick"] == 0 else f"kicking accounts newer than " \
                                                  f"{config()['autokick']} days"
     await ctx.send(f"{self._get_autokick_emoji()} Autokick is {st}")
Ejemplo n.º 4
0
    async def resetstatus(self, ctx: commands.Context):
        """
        Clear status list
        #OWNER
        """
        conf = BotConfirmation(ctx, 0x5555ff)
        await conf.confirm('Reset status list?')

        if conf.confirmed:
            try:
                config()["statuses"] = ["Hi"]
                save_config()
                self.status = cycle(config()["statuses"])
                self.status_rotate.restart()
            except Exception as e:  # noqa e722
                await conf.update("An error occurred", color=0xffff00)
            else:
                await conf.update("Reset!", color=0x55ff55)
                await self.modlog.log_message("Status Modification", "```# Reset #```", ctx.author)
        else:
            await conf.update("Canceled", color=0xff5555)
Ejemplo n.º 5
0
    async def addfilteredword(self, ctx: commands.Context, *, w: str):
        """
        Add a filtered word
        #STAFF
        """
        w = w.strip("` ")
        conf = BotConfirmation(ctx, 0x5555ff)
        await conf.confirm(f'Add `{w}`?')

        if conf.confirmed:
            try:
                config()["filters"]["word_blacklist"].append(w)
                save_config()
            except Exception as e:  # noqa e722
                await conf.update("An error occurred", color=0xffff00)
            else:
                await conf.update("Added!", color=0x55ff55)
                await self.modlog.log_message("Filter Word Modification",
                                              f"```diff\n + {w}```",
                                              ctx.author)
        else:
            await conf.update("Canceled", color=0xff5555)
Ejemplo n.º 6
0
    async def addstatus(self, ctx: commands.Context, *, w: str):
        """
        Adds a status
        #OWNER
        """
        w = w.strip("` ")
        conf = BotConfirmation(ctx, 0x5555ff)
        await conf.confirm(f'Add `{w}`?')

        if conf.confirmed:
            try:
                config()["statuses"].append(w)
                save_config()
                self.status = cycle(config()["statuses"])
                self.status_rotate.restart()
            except Exception as e:  # noqa e722
                await conf.update("An error occurred", color=0xffff00)
            else:
                await conf.update("Added!", color=0x55ff55)
                await self.modlog.log_message("Status Modification", f"```diff\n + {w}```", ctx.author)
        else:
            await conf.update("Canceled", color=0xff5555)