<commit_before>require 'cinch'
require 'cinch/tyrant/cmd'
require 'tyrant'
require 'tyrant/cards'
require 'tyrant/conquest'
require 'yaml'

module Cinch; module Plugins; class TyrantConquestCommands
  include Cinch::Plugin

  def self.cqmatch(regex, args)
    args[:prefix] = lambda { |m| /!c /i }
    match(regex, args.dup)
    args[:prefix] = lambda { |m| m.bot.nick + ': ' }
    match(regex, args.dup)
  end

  match(/cq/i, method: :status)
  match(/slot\s*(\d+)(\s+-s)?/i, method: :slot)

  cqmatch(/slot\s*(\d+)(\s+-s)?/i, method: :slot)
  cqmatch(/stat(?:us)?(?:\s+(\d+))?/i, method: :cstatus)
  cqmatch(/check\s+(\d+)(\s+-s)?/i, method: :check)
  cqmatch(/(?:set|change)\s*(\d+) (.*)/i, method: :cset)
  cqmatch(/setas\s+(\S+)\s+(\d+) (.*)/i, method: :csetas)
  cqmatch(/append\s+(\d+) (.*)/i, method: :update)
  cqmatch(/appendas\s+(\S+)\s+(\d+) (.*)/i, method: :updateas)
  cqmatch(/merge\s+(\d+) (.*)/i, method: :merge)
  cqmatch(/claim\s+(\d+)(?:\s+(.+))?/i, method: :claim)
  cqmatch(/unclaim\s+(\d+)(?:\s+(.+))?/i, method: :unclaim)
  cqmatch(/stuck(?:\s+(\d+)(?:\s+(.+))?)?/i, method: :stuck)
  cqmatch(/unstuck\s+(\d+)(?:\s+(.+))?/i, method: :unstuck)
  cqmatch(/claimed/i, method: :list_claimed)<commit_msg>TyrantConquestCommands: Anchor !c to front, allow \s+ after<commit_after>require 'cinch'
require 'cinch/tyrant/cmd'
require 'tyrant'
require 'tyrant/cards'
require 'tyrant/conquest'
require 'yaml'

module Cinch; module Plugins; class TyrantConquestCommands
  include Cinch::Plugin

  def self.cqmatch(regex, args)
    args[:prefix] = lambda { |m| /^!c\s+/i }
    match(regex, args.dup)
    args[:prefix] = lambda { |m| m.bot.nick + ': ' }
    match(regex, args.dup)
  end

  match(/cq/i, method: :status)
  match(/slot\s*(\d+)(\s+-s)?/i, method: :slot)

  cqmatch(/slot\s*(\d+)(\s+-s)?/i, method: :slot)
  cqmatch(/stat(?:us)?(?:\s+(\d+))?/i, method: :cstatus)
  cqmatch(/check\s+(\d+)(\s+-s)?/i, method: :check)
  cqmatch(/(?:set|change)\s*(\d+) (.*)/i, method: :cset)
  cqmatch(/setas\s+(\S+)\s+(\d+) (.*)/i, method: :csetas)
  cqmatch(/append\s+(\d+) (.*)/i, method: :update)
  cqmatch(/appendas\s+(\S+)\s+(\d+) (.*)/i, method: :updateas)
  cqmatch(/merge\s+(\d+) (.*)/i, method: :merge)
  cqmatch(/claim\s+(\d+)(?:\s+(.+))?/i, method: :claim)
  cqmatch(/unclaim\s+(\d+)(?:\s+(.+))?/i, method: :unclaim)
  cqmatch(/stuck(?:\s+(\d+)(?:\s+(.+))?)?/i, method: :stuck)
  cqmatch(/unstuck\s+(\d+)(?:\s+(.+))?/i, method: :unstuck)
  cqmatch(/claimed/i, method: :list_claimed)
{'fraction_non_alphanumeric': 0.28937875751503006, 'fraction_numerical': 0.0, 'mean_word_length': 4.083503054989817, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4323542', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1108, 'n_words': 179}