<commit_before>require 'cinch'
require 'json'
require './show.rb'
require './commands.rb'

$debug = false
$irc_test = false

$suggested_titles = []

def load_shows
  shows = []
  show_hashes = JSON.parse(File.open("shows.json").read)["shows"]
  show_hashes.each do |show_hash|
    shows.push Show.new(show_hash)
  end
  return shows
end

# Run bot
def bot_start
  bot = Cinch::Bot.new do
    configure do |c|
      c.server = "irc.freenode.org"
      if $irc_test
        c.channels = ["#cinch-bots"]
      else
        c.channels = ["#5by5"]
      end
      c.nick = "showbot"

      $shows ||= load_shows
    end

    on :message, /^!(.+?)(?:$|\s)(.*?)\s*(\d*|next)$/ do |m, command, arg1, arg2|

      @commands ||= Commands.new(m, $shows)

      args = []

      args.push arg1 if arg1 and arg1.strip != ""
      args.push arg2 if arg2 and arg1.strip != ""

      # Call the method in Commands via method_missing
      commands.run(command, args)
    end
  end
  bot.start
end

def test
  $shows ||= load_shows
  commands = Commands.new(nil, $shows)

<commit_msg>Fixed error with new @command declaration<commit_after>require 'cinch'
require 'json'
require './show.rb'
require './commands.rb'

$debug = false
$irc_test = false

$suggested_titles = []

def load_shows
  shows = []
  show_hashes = JSON.parse(File.open("shows.json").read)["shows"]
  show_hashes.each do |show_hash|
    shows.push Show.new(show_hash)
  end
  return shows
end

# Run bot
def bot_start
  bot = Cinch::Bot.new do
    configure do |c|
      c.server = "irc.freenode.org"
      if $irc_test
        c.channels = ["#cinch-bots"]
      else
        c.channels = ["#5by5"]
      end
      c.nick = "showbot"

      $shows ||= load_shows
    end

    on :message, /^!(.+?)(?:$|\s)(.*?)\s*(\d*|next)$/ do |m, command, arg1, arg2|

      @commands ||= Commands.new(m, $shows)

      args = []

      args.push arg1 if arg1 and arg1.strip != ""
      args.push arg2 if arg2 and arg1.strip != ""

      # Call the method in Commands via method_missing
      @commands.run(command, args)
    end
  end
  bot.start
end

def test
  $shows ||= load_shows
  commands = Commands.new(nil, $shows)


{'fraction_non_alphanumeric': 0.1516412390198798, 'fraction_numerical': 0.009246417013407305, 'mean_word_length': 2.6187290969899664, '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': '5025970', 'n_tokens_mistral': 830, 'n_tokens_neox': 812, 'n_words': 197}