예제 #1
0
파일: _scheduler.py 프로젝트: Kronifer/bot
    def __init__(self, bot: Bot, supported_infractions: t.Container[str]):
        self.bot = bot
        self.scheduler = scheduling.Scheduler(self.__class__.__name__)

        scheduling.create_task(
            self.reschedule_infractions(supported_infractions),
            event_loop=self.bot.loop)
예제 #2
0
파일: _cog.py 프로젝트: Kronifer/bot
    def __init__(self, bot: Bot):
        self.bot = bot
        self.scheduler = scheduling.Scheduler(self.__class__.__name__)

        self.guild: discord.Guild = None
        self.cooldown_role: discord.Role = None

        # Categories
        self.available_category: discord.CategoryChannel = None
        self.in_use_category: discord.CategoryChannel = None
        self.dormant_category: discord.CategoryChannel = None

        # Queues
        self.channel_queue: asyncio.Queue[discord.TextChannel] = None
        self.name_queue: t.Deque[str] = None

        self.last_notification: t.Optional[arrow.Arrow] = None

        self.dynamic_message: t.Optional[int] = None
        self.available_help_channels: t.Set[discord.TextChannel] = set()

        # Asyncio stuff
        self.queue_tasks: t.List[asyncio.Task] = []
        self.init_task = scheduling.create_task(self.init_cog(),
                                                event_loop=self.bot.loop)
예제 #3
0
    def __init__(self, bot: Bot):
        self.bot = bot
        self.scheduler = scheduling.Scheduler(self.__class__.__name__)

        # Categories
        self.available_category: discord.CategoryChannel = None
        self.in_use_category: discord.CategoryChannel = None
        self.dormant_category: discord.CategoryChannel = None

        # Queues
        self.channel_queue: asyncio.Queue[discord.TextChannel] = None
        self.name_queue: t.Deque[str] = None

        self.last_notification: t.Optional[datetime] = None

        # Asyncio stuff
        self.queue_tasks: t.List[asyncio.Task] = []
        self.init_task = self.bot.loop.create_task(self.init_cog())
예제 #4
0
파일: filtering.py 프로젝트: Kronifer/bot
    def __init__(self, bot: Bot):
        self.bot = bot
        self.scheduler = scheduling.Scheduler(self.__class__.__name__)
        self.name_lock = asyncio.Lock()

        staff_mistake_str = "If you believe this was a mistake, please let staff know!"
        self.filters = {
            "filter_zalgo": {
                "enabled":
                Filter.filter_zalgo,
                "function":
                self._has_zalgo,
                "type":
                "filter",
                "content_only":
                True,
                "user_notification":
                Filter.notify_user_zalgo,
                "notification_msg":
                ("Your post has been removed for abusing Unicode character rendering (aka Zalgo text). "
                 f"{staff_mistake_str}"),
                "schedule_deletion":
                False
            },
            "filter_invites": {
                "enabled":
                Filter.filter_invites,
                "function":
                self._has_invites,
                "type":
                "filter",
                "content_only":
                True,
                "user_notification":
                Filter.notify_user_invites,
                "notification_msg":
                (f"Per Rule 6, your invite link has been removed. {staff_mistake_str}\n\n"
                 r"Our server rules can be found here: <https://pythondiscord.com/pages/rules>"
                 ),
                "schedule_deletion":
                False
            },
            "filter_domains": {
                "enabled":
                Filter.filter_domains,
                "function":
                self._has_urls,
                "type":
                "filter",
                "content_only":
                True,
                "user_notification":
                Filter.notify_user_domains,
                "notification_msg":
                (f"Your URL has been removed because it matched a blacklisted domain. {staff_mistake_str}"
                 ),
                "schedule_deletion":
                False
            },
            "watch_regex": {
                "enabled": Filter.watch_regex,
                "function": self._has_watch_regex_match,
                "type": "watchlist",
                "content_only": True,
                "schedule_deletion": True
            },
            "watch_rich_embeds": {
                "enabled": Filter.watch_rich_embeds,
                "function": self._has_rich_embed,
                "type": "watchlist",
                "content_only": False,
                "schedule_deletion": False
            },
            "filter_everyone_ping": {
                "enabled":
                Filter.filter_everyone_ping,
                "function":
                self._has_everyone_ping,
                "type":
                "filter",
                "content_only":
                True,
                "user_notification":
                Filter.notify_user_everyone_ping,
                "notification_msg":
                ("Please don't try to ping `@everyone` or `@here`. "
                 f"Your message has been removed. {staff_mistake_str}"),
                "schedule_deletion":
                False,
                "ping_everyone":
                False
            },
        }

        scheduling.create_task(self.reschedule_offensive_msg_deletion(),
                               event_loop=self.bot.loop)
예제 #5
0
파일: stream.py 프로젝트: Kronifer/bot
 def __init__(self, bot: Bot):
     self.bot = bot
     self.scheduler = scheduling.Scheduler(self.__class__.__name__)
     self.reload_task = scheduling.create_task(
         self._reload_tasks_from_redis(), event_loop=self.bot.loop)