def decorator(func): if isinstance(func, commands.Command): func._buckets = commands.CooldownMapping( commands.Cooldown(rate, per, type)) else: func.__commands_cooldown__ = commands.Cooldown(rate, per, type) return func
def __init__(self, func, **kwargs) -> None: self.member_permissions = to_list( kwargs.get("member_permissions") or getattr(func, "member_permissions", ["send_messages"]) or kwargs.get("extras", {}).get("member_permissions") ) self.bot_permissions = to_list( kwargs.get("bot_permissions") or getattr(func, "bot_permissions", ["send_messages"]) or kwargs.get("extras", {}).get("bot_permissions") ) super().__init__(func, **kwargs) if not self._buckets._cooldown: self._buckets = commands.CooldownMapping(commands.Cooldown(1, 3), commands.BucketType.user) self._buckets._cooldown = commands.Cooldown(1, 3)
def __init__(self): super().__init__( command_attrs={ 'cooldown': commands.Cooldown(1, 3.0, commands.BucketType.member), 'help': 'Shows help about the bot, a command, or a category' })
def __init__(self, prefix, config, aiohttp=None, **options): if 'formatter' not in options: options['formatter'] = Formatter(width=150) super().__init__(prefix, owner_id=config.owner, **options) self._runas = None self.remove_command('help') @self.group(invoke_without_command=True) @bot_has_permissions(embed_links=True) @cooldown(1, 10, commands.BucketType.guild) async def help(ctx, *commands_: str): """Shows all commands you can use on this server. Use {prefix}{name} all to see all commands""" await self._help(ctx, *commands_) @help.command(name='all') @bot_has_permissions(embed_links=True) @cooldown(1, 10, commands.BucketType.guild) async def all_(ctx, *commands_: str): """Shows all available commands even if you don't have the correct permissions to use the commands. Bot owner only commands are still hidden tho""" await self._help(ctx, *commands_, type=Formatter.Generic) log.debug('Using loop {}'.format(self.loop)) if aiohttp is None: aiohttp = ClientSession(loop=self.loop) self.aiohttp_client = aiohttp self.config = config self.voice_clients_ = {} self._error_cdm = CooldownMapping( commands.Cooldown(2, 5, commands.BucketType.guild))
def __init__(self, bot): self.bot = bot self.debug = False self.lru_errors = utils.EvieeLRU(name='Errors', limit=10) self.spam = commands.CooldownMapping(commands.Cooldown(3, 60, commands.BucketType.user)) self.counter_cmdf = 0
def __init__(self, bot): self.bot = bot self.help_icon = "" self.big_icon = "" self.long_raid_cooldown = commands.CooldownMapping(commands.Cooldown(25, 15, commands.BucketType.guild)) self.short_raid_cooldown = commands.CooldownMapping.from_cooldown(8, 4, commands.BucketType.guild) self.color = color_picker('colors')
def __init__(self): super().__init__( command_attrs={ 'cooldown': commands.Cooldown(1, 3.0, commands.BucketType.member), 'help': 'Bot、コマンド、カテゴリーのヘルプを表示します。' })
def __init__(self): super().__init__( command_attrs={ "help": "Shows help for the bot, a category, or a command.", "cooldown": commands.Cooldown(1, 2.5, commands.BucketType.user), })
def __init__(self): super().__init__( command_attrs={ "cooldown": commands.Cooldown(1, 3.0, commands.BucketType.member), "help": "Shows help about the bot, a command, or a category", } )
def __init__(self): super().__init__( command_attrs={ 'help': 'Shows the various commands, their usages, and other specifics', 'cooldown': commands.Cooldown(1, 5.0, commands.BucketType.member) })
def __init__(self, **options): command_attrs = options.pop('command_attrs', {}) command_attrs.update( cooldown=commands.Cooldown(1, 3.0, commands.BucketType.user), max_concurrency=commands.MaxConcurrency( 3, per=commands.BucketType.channel, wait=False), help='Shows help about the bot, a command, or a category') super().__init__(command_attrs=command_attrs, **options)
def __init__(self): super().__init__(command_attrs={ # This is the command.help string 'help': 'Shows help about the bot, a command, or a category', # this is a custom attribute passed to the # help command - cooldown 'cooldown': commands.Cooldown( 1, 3.0, commands.BucketType.member)})
def __init__(self): """Saute the veggies for 3 second.""" super().__init__( command_attrs={ 'cooldown': commands.Cooldown(1, 3.0, commands.BucketType.member), 'help': 'Shows help about the bot, a command, or a category' })
def __init__(self): super().__init__( command_attrs={ 'cooldown': commands.Cooldown(1, 3.0, commands.BucketType.member), 'help': "Montre l'aide à propos d'une commande, d'une catégorie" })
def assign_default_cooldown(buckets): """ Assigns a default cooldown to a command which was defined without one. """ if buckets._cooldown is None: # Command was defined without a cooldown buckets._cooldown = commands.Cooldown( 1, # Can invoke command once 10.0, # Every ten seconds commands.BucketType.user)
def __init__(self, embed_color): self.embed_color = embed_color super().__init__( command_attrs={ 'cooldown': commands.Cooldown(1, 3.0, commands.BucketType.member), 'help': 'Shows help about the bot, a command, or a category', 'hidden': True })
def __init__(self): super().__init__(verify_checks=True, command_attrs={ 'help': 'Shows help about the bot, a command, or a cog', 'cooldown': commands.Cooldown(1, 3.0, commands.BucketType.member), })
def __init__(self): self.owner_cogs = ['Jishaku'] self.admin_cogs = ['admin'] self.ignore_cogs = ['Error', 'DLP', 'Slash', 'Logs'] self.help_icon = '<:store:729571108260675604>' super().__init__(command_attrs={ "cooldown": commands.Cooldown(1, 5, commands.BucketType.member), "help": "The help command", "aliases": ["h"] })
def __init__(self): super().__init__( command_attrs={ "aliases": ["yardım"], "help": "Katagori ve komutların yardım mesajını görüntüler.", "cooldown": commands.Cooldown(1, 3.0, commands.BucketType.member), }) self.owner_cogs = ["Admin"] self.ignore_cogs = ["Events", "Jishaku"]
def shared_cooldown(rate, per, type=commands.BucketType.default): cooldown = commands.Cooldown(rate, per, type=type) def decorator(func): if isinstance(func, commands.Command): func._buckets = commands.CooldownMapping(cooldown) else: func.__commands_cooldown__ = cooldown return func return decorator
def __init__(self): super().__init__( command_attrs={ "cooldown": commands.CooldownMapping(commands.Cooldown(1, 5.0), commands.BucketType.member), "help": "Shows help about the bot, a command, or a category", "hidden": True, })
def __init__(self): super().__init__(verify_checks=False, command_attrs={ 'cooldown': commands.Cooldown(1, 3, commands.BucketType.member), 'help': 'Gibt dir Hilfe zu den Commands', 'aliases': ['h', 'commands', 'cmds'], 'hidden': True })
def __init__(self): super().__init__( command_attrs={ "cooldown": commands.CooldownMapping( commands.Cooldown(1, config.BOT_COMMAND_COOLDOWN), commands.BucketType.user, ), "help": "Shows help about the bot, a command, or a category", "aliases": ["man", "manual", "h"], }, verify_checks=False, )
def __init__(self, **options): options['verify_checks'] = False super().__init__(**options) self.paginator = commands.Paginator(max_size=1985) self.commands_heading = "Commands" self.aliases_heading = "Aliases:" self.no_category = "No Category" self.command_attrs = { 'description': "Provides help for various commands.", 'cooldown': commands.Cooldown(3, 10, commands.BucketType.channel), 'name': 'help' }
def __init__(self, bot): self.bot = bot self._original_help_command = bot.help_command bot.help_command = TakuruHelpCommand(verify_checks=True, show_hidden=False, command_attrs={ "cooldown": commands.Cooldown( 1, 2.5, commands.BucketType.user) }) bot.help_command.cog = self self.bot.get_command("help").hidden = True
def __init__(self, *args, **kwargs): self.show_hidden = False super().__init__(command_attrs={ 'help': 'Shows help about bot and/or commands', 'brief': 'See cog/command help', 'usage': '[category / command]', 'cooldown': commands.Cooldown(1, 10, commands.BucketType.user), 'name': 'help'}) self.verify_checks = True self.help_icon = '' self.big_icon = '' self.owner_cogs = ['Owner', 'Devishaku', 'Jishaku'] self.admin_cogs = ['Staff'] self.booster_cogs = ['Boosters'] self.ignore_cogs = ["Help", "Events", "CommandError", "Logging", 'Tasks', "AutomodEvents", 'DiscordExtremeList', 'DiscordLabs', 'DiscordLists', 'ShitGG', 'Others']
def __init__(self, *args, **kwargs): self.show_hidden = False super().__init__(command_attrs={ 'help': 'Shows help about bot and/or commands', 'brief': 'See cog/command help', 'usage': '[category / command]', 'cooldown': commands.Cooldown(1, 3, commands.BucketType.user), 'name': 'help'}) self.verify_checks = True self.color = color_picker('colors') self.owner_cogs = ['Devishaku', 'Music', 'Owner', "Economy", "Music"] self.admin_cogs = ['Staff'] self.vip_cogs = ['Booster'] self.ignore_cogs = ["Help", "Events", "Cmds", "Logs", "dredd", 'DBL', 'BG', 'StatcordPost', "AutomodEvents", "Eventss"]
def __init__(self, bot: Bot): self.default = bot.help_command self.bot = bot self.load_time = datetime.datetime.now(datetime.timezone.utc) help_command = AvimetryHelp( verify_checks=False, show_hidden=False, command_attrs=dict( hidden=True, usage="[command|module]", aliases=["h"], cooldown=commands.CooldownMapping(commands.Cooldown(1, 2), commands.BucketType.user), ), ) help_command.cog = self self.bot.help_command = help_command
def __init__(self, config: Config, *args: Any, **kwargs: Any) -> None: kwargs['help_command'] = HelpCommand( paginator=Paginator(), command_attrs={ 'brief': 'List commands for this bot or get help for commands', 'cooldown': commands.Cooldown(5, 30.0, commands.BucketType.channel), }, ) kwargs['description'] = description super().__init__(config, *args, verify_ssl=False, **kwargs) for extension in extensions: try: self.load_extension(f'erasmus.cogs.{extension}') except Exception: log.exception('Failed to load extension %s.', extension)
async def work(self, ctx: commands.Context): user = GameUser(self.bot.con, str(ctx.author.id)) cooltime = 5 for item in list(user.items): effect: ItemEffect = item.effect if effect.name == "work-speed": if cooltime > effect.effect: cooltime = effect.effect if effect.use_remove: user.items.remove(item) user.commit() if (self.cooldown.get(ctx.author.id) and time() - self.cooldown[ctx.author.id] < cooltime): raise commands.CommandOnCooldown( commands.Cooldown(1, cooltime, commands.BucketType.user), cooltime - (time() - self.cooldown[ctx.author.id]), ) x, y = map(int, self.bot.config["game"]["work_money"].split("-")) for item in list(user.items): effect: ItemEffect = item.effect if effect.name == "work-power": if y > effect.effect: y *= int(effect.effect) if effect.use_remove: user.items.remove(item) user.commit() add = randint(x, y) user.money += add user.commit() self.cooldown[ctx.author.id] = time() await ctx.reply(embed=make_text_embed( ctx.author, f"당신은 일을 해서 {format_money(add, self.bot.config['game']['unit'])}을(를) 얻었습니다." f"\n다음 일은 {seconds_to_timestr(cooltime)}후에 가능합니다.", ))