<commit_before>require 'socket' # TCPSocket
require 'openssl'
require 'array-unique'

#require "fantasy-irc/rooms"
#require "fantasy-irc/users"
#require "fantasy-irc/events"
#require "fantasy-irc/plugins"

module Fantasy
    class IRC
        attr_reader :events, :rooms, :users, :plugins
        attr_reader :started, :session, :loggedin, :connected

        def initialize options={}
            $bot = self
            @data = Hash.new
            @started = Time.now.to_i
            @running = 0
            @loggedin = 0
            @connected = 0
            @prefix = options[:prefix] || '!'

            @events = Event::Factory.new
            @rooms = Room::Factory.new self
            @users = User::Factory.new self
            @plugins = Plugins.new

            %w{tick loggedin connected user_joined channel_message}.each do |e|
                @events.create(e)
            end
        end

        def login data
            if not data[:nickname] and data[:username] then
                data[:nickname] = data[:username]
            end
            if not data[:username] and data[:nickname] then
                data[:username] = data[:nickname]
            end
            if not data[:realname] then
                data[:realname] = "https://bitbucket.org/v2px/fantasy-irc"
            end

            if not data[:nickname] then
                raise "you need to specify :nickname and/or :username on login"
            end

            if data[:password] then<commit_msg>updating bot url in the default gecos field<commit_after>require 'socket' # TCPSocket
require 'openssl'
require 'array-unique'

#require "fantasy-irc/rooms"
#require "fantasy-irc/users"
#require "fantasy-irc/events"
#require "fantasy-irc/plugins"

module Fantasy
    class IRC
        attr_reader :events, :rooms, :users, :plugins
        attr_reader :started, :session, :loggedin, :connected

        def initialize options={}
            $bot = self
            @data = Hash.new
            @started = Time.now.to_i
            @running = 0
            @loggedin = 0
            @connected = 0
            @prefix = options[:prefix] || '!'

            @events = Event::Factory.new
            @rooms = Room::Factory.new self
            @users = User::Factory.new self
            @plugins = Plugins.new

            %w{tick loggedin connected user_joined channel_message}.each do |e|
                @events.create(e)
            end
        end

        def login data
            if not data[:nickname] and data[:username] then
                data[:nickname] = data[:username]
            end
            if not data[:username] and data[:nickname] then
                data[:username] = data[:nickname]
            end
            if not data[:realname] then
                data[:realname] = "https://rubygems.org/gems/fantasy-irc"
            end

            if not data[:nickname] then
                raise "you need to specify :nickname and/or :username on login"
            end

            if data[:password] then
{'fraction_non_alphanumeric': 0.10168372400132057, 'fraction_numerical': 0.00231099372730274, 'mean_word_length': 1.7396021699819169, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '7183556', 'n_tokens_mistral': 869, 'n_tokens_neox': 811, 'n_words': 230}