<commit_before>module Discordrb::Commands
  # Command that can be called in a chain
  class Command
    attr_reader :attributes, :name

    def initialize(name, attributes = {}, &block)
      @name = name
      @attributes = {
        # The lowest permission level that can use the command
        permission_level: attributes[:permission_level] || 0,

        # Whether this command is usable in a command chain
        chain_usable: attributes[:chain_usable].nil? ? true : attributes[:chain_usable],

        # Whether this command should show up in the help command
        help_available: attributes[:help_available].nil? ? true : attributes[:help_available],

        # Description (for help command)
        description: attributes[:description] || nil,

        # Usage description (for help command and error messages)
        usage: attributes[:usage] || nil,

        # Minimum number of arguments
        min_args: attributes[:min_args] || 0,

        # Maximum number of arguments (-1 for no limit)
        max_args: attributes[:max_args] || -1
      }

      @block = block
    end

    def call(event, arguments, chained = false)
      if arguments.length < @attributes[:min_args]
        event.respond "Too few arguments for command `#{name}`!"
        event.respond "Usage: `#{@attributes[:usage]}`" if @attributes[:usage]
        return
      end
      if @attributes[:max_args] >= 0 && arguments.length > @attributes[:max_args]
        event.respond "Too many arguments for command `#{name}`!"
        event.respond "Usage: `#{@attributes[:usage]}`" if @attributes[:usage]
        return
      end<commit_msg>Make :bucket an attribute of Command<commit_after>module Discordrb::Commands
  # Command that can be called in a chain
  class Command
    attr_reader :attributes, :name

    def initialize(name, attributes = {}, &block)
      @name = name
      @attributes = {
        # The lowest permission level that can use the command
        permission_level: attributes[:permission_level] || 0,

        # Whether this command is usable in a command chain
        chain_usable: attributes[:chain_usable].nil? ? true : attributes[:chain_usable],

        # Whether this command should show up in the help command
        help_available: attributes[:help_available].nil? ? true : attributes[:help_available],

        # Description (for help command)
        description: attributes[:description] || nil,

        # Usage description (for help command and error messages)
        usage: attributes[:usage] || nil,

        # Minimum number of arguments
        min_args: attributes[:min_args] || 0,

        # Maximum number of arguments (-1 for no limit)
        max_args: attributes[:max_args] || -1,

        # Rate limiting bucket (nil for no rate limiting)
        bucket: attributes[:bucket]
      }

      @block = block
    end

    def call(event, arguments, chained = false)
      if arguments.length < @attributes[:min_args]
        event.respond "Too few arguments for command `#{name}`!"
        event.respond "Usage: `#{@attributes[:usage]}`" if @attributes[:usage]
        return
      end
      if @attributes[:max_args] >= 0 && arguments.length > @attributes[:max_args]
        event.respond "Too many arguments for command `#{name}`!"
        event.respond "Usage: `#{@attributes[:usage]}`" if @attributes[:usage]
        return
      end
{'fraction_non_alphanumeric': 0.10643344203972725, 'fraction_numerical': 0.0029647198339756895, 'mean_word_length': 2.8960739030023093, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4916559', 'n_tokens_mistral': 888, 'n_tokens_neox': 862, 'n_words': 296}