def __init__(self, prem: tuple, reg: tuple): self.types = { "user": BucketType.user, "channel": BucketType.channel, "guild": BucketType.guild, } self.premium_mapping = CooldownMapping.from_cooldown(*self.clean(prem)) self.regular_mapping = CooldownMapping.from_cooldown(*self.clean(reg))
def __init__(self, bot) -> None: self.bot = bot self.bot.check(is_not_excluded) self.bot.before_invoke(self.before_invoke) self.spam_counter = {} self.spam_cooldown = CooldownMapping.from_cooldown( rate=10, per=7.5, type=BucketType.user) self.exclusion_watch = None
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.db = None # pylint: disable=invalid-name self.session = ClientSession() self.xp_cooldown = CooldownMapping.from_cooldown(1, 60, BucketType.member) self.players = {} self.prefixes = [] self.welcome_message = None
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) print('-' * 50) self.session = AioClientSession(loop=self.loop) for attr in ('_command_cd', '_error_cd', '_clock_cd', '_warn_cd'): setattr( self, attr, CooldownMapping.from_cooldown(1, GLOBAL_USER_COOLDOWN, BucketType.member)) for env in ('JISHAKU_NO_UNDERSCORE', 'JISHAKU_NO_UNDERSCORE'): environ[env] = 'true' for ext in ('jishaku', EXTENSION_LOADER_PATH): self.load_extension(ext)
def __init__(self, bot: Eris): self.bot = bot self.cooldown = CooldownMapping.from_cooldown(1, 60, BucketType.member)
def __init__(self, bot): self.bot = bot self.mem_update = CooldownMapping.from_cooldown( 1, 1, BucketType.member)
from dataclasses import dataclass from functools import partial as funct_partial from typing import List, Tuple, Union from discord.ext.commands import BucketType, CooldownMapping from discord.ext.menus import ListPageSource from jikanpy import AioJikan from utils.converters import to_human_datetime, try_unpack_class from utils.formatters import BetterEmbed global_cd = BucketType.default ApiCooldown = namedtuple('ApiCooldown', ['long', 'short']) API_COOLDOWNS = ApiCooldown( long=CooldownMapping.from_cooldown(30, 60, global_cd), short=CooldownMapping.from_cooldown(2, 1, global_cd), ) NSFW_MANGA = {'doujinshi', 'ecchi', 'hentai'} TIME_TEMPLATE = "%Y-%m-%dT%H:%M:%S%z" # iso 8601 #* Base classes @dataclass class Response: request_hash: str request_cached: bool request_cache_expiry: int results: list
def __init__(self, bot): self.bot = bot self._cooldown = CooldownMapping.from_cooldown( rate=5, per=20, type=BucketType.user )
def __init__(self, bot): self.bot = bot self.cb_client = ac.Cleverbot(TRAVITIA_TOKEN) self.cb_client.set_context(ac.DictContext(self.cb_client)) self.cb_emotions = tuple(ac.Emotion) self._cd = CooldownMapping.from_cooldown(1.0, 5.0, BucketType.member)