コード例 #1
0
ファイル: antispam.py プロジェクト: awildfig/Flare-Cogs
 async def per(self, ctx, *, length: TimedeltaConverter):
     """How long of a timeframe to keep track of command spamming."""
     duration_seconds = length.total_seconds()
     await self.config.per.set(duration_seconds)
     await ctx.send(
         f"The spam filter has been set to check commands during a  {humanize_timedelta(seconds=duration_seconds)} period."
     )
     await self.gen_cache()
コード例 #2
0
ファイル: antispam.py プロジェクト: awildfig/Flare-Cogs
 async def length(self, ctx, *, length: TimedeltaConverter):
     """How long to blacklist a user from using commands."""
     duration_seconds = length.total_seconds()
     await self.config.mute_length.set(duration_seconds)
     await ctx.send(
         f"The spam filter blacklist timer has been set to {humanize_timedelta(seconds=duration_seconds)}."
     )
     await self.gen_cache()
コード例 #3
0
    async def per(self, ctx, *, length: TimedeltaConverter):
        """How long of a timeframe to keep track of command spamming.

        Accepts: seconds, minutes, hours, days, weeks
        Examples:
            `[p]antispamset per 1d2h30m`
            `[p]antispamset per 1 day 2 hours 30 minutes`
        """
        if not length:
            return await ctx.send("You must provide a value greater than 0.")
        duration_seconds = length.total_seconds()
        await self.config.per.set(duration_seconds)
        await ctx.send(
            f"The spam filter has been set to check commands during a {humanize_timedelta(seconds=duration_seconds).rstrip('s')} period."
        )
        await self.gen_cache()
コード例 #4
0
    async def length(self, ctx, *, length: TimedeltaConverter):
        """How long to blacklist a user from using commands.

        Accepts: seconds, minutes, hours, days, weeks
        Examples:
            `[p]antispamset length 1d2h30m`
            `[p]antispamset length 1 day 2 hours 30 minutes`
        """
        if not length:
            return await ctx.send("You must provide a value greater than 0.")
        duration_seconds = length.total_seconds()
        await self.config.mute_length.set(duration_seconds)
        await ctx.send(
            f"The spam filter blacklist timer has been set to {humanize_timedelta(seconds=duration_seconds)}."
        )
        await self.gen_cache()