Class: ModSpox::Bot

Inherits:
Object
  • Object
show all
Defined in:
lib/mod_spox/Bot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBot

Create a Bot



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/mod_spox/Bot.rb', line 37

def initialize
    unless(ModSpox.logto.nil?)
        logger = ::Logger.new(ModSpox.logto, 'daily')
        Logger.initialize(logger, ModSpox.loglevel)
    end
    clean_models
    @servers = Array.new
    @channels = Array.new
    @start_time = Time.now
    @pool = ActionPool::Pool.new(10, 100, 60, nil, logger)
    @pipeline = Pipeline.new(@pool)
    @timer = Timer.new(ActionTimer::Timer.new(@pool, logger), @pipeline)
    @config = BaseConfig.new(BotConfig[:userconfigpath])
    @factory = MessageFactory.new(@pipeline, @pool)
    @socket = nil
    @plugin_manager = PluginManager.new(@pipeline)
    if(@config[:plugin_upgrade] == 'yes')
        @plugin_manager.upgrade_plugins
        Logger.info('Main bot thread is now sleeping for 10 seconds to allow upgrade to conclude')
        sleep(10)
        Logger.info('Main bot thread sleep completed. Continuing loading.')
    end
    @config[:plugin_upgrade] = 'no'
    @config.write_configuration
    @shutdown = false
    @socket = Sockets.new(self)
    @nick = nil
    @thread = Thread.current
    @lock = Mutex.new
    @waiter = ConditionVariable.new
    hook_pipeline
end

Instance Attribute Details

#dcc_socketsObject (readonly)

DCC sockets



34
35
36
# File 'lib/mod_spox/Bot.rb', line 34

def dcc_sockets
  @dcc_sockets
end

#factoryObject (readonly)

message factory



31
32
33
# File 'lib/mod_spox/Bot.rb', line 31

def factory
  @factory
end

#pipelineObject (readonly)

message pipeline



25
26
27
# File 'lib/mod_spox/Bot.rb', line 25

def pipeline
  @pipeline
end

#plugin_managerObject (readonly)

plugin manager



28
29
30
# File 'lib/mod_spox/Bot.rb', line 28

def plugin_manager
  @plugin_manager
end

#poolObject (readonly)

thread pool



22
23
24
# File 'lib/mod_spox/Bot.rb', line 22

def pool
  @pool
end

#timerObject (readonly)

bot timer



19
20
21
# File 'lib/mod_spox/Bot.rb', line 19

def timer
  @timer
end

Instance Method Details

#admin(message) ⇒ Object

message

Messages::Outgoing::Admin message

Sends ADMIN message to server



408
409
410
# File 'lib/mod_spox/Bot.rb', line 408

def admin(message)
    @socket << "ADMIN #{message.target}"
end

#away(message) ⇒ Object

message

Messages::Outgoing::Away message

Sends AWAY message to server



472
473
474
# File 'lib/mod_spox/Bot.rb', line 472

def away(message)
    @socket << "AWAY :#{message.message}"
end

#bot_connect(message) ⇒ Object

message

Messages::Internal::EstablishConnection message

Initialize connection to IRC server



113
114
115
116
117
118
119
120
121
122
# File 'lib/mod_spox/Bot.rb', line 113

def bot_connect(message)
    Logger.info("Received a connection command")
    begin
        @socket = Sockets.new(self) if @socket.nil?
        @socket.irc_connect(message.server, message.port)
    rescue Object => boom
        Logger.warn("Failed connection to server: #{boom}")
        @pipeline << Messages::Internal::ConnectionFailed.new(@socket.irc_socket.server, @socket.irc_socket.port)
    end
end

#bot_statsObject

Returns status of the bot in a formatted string



150
151
152
153
154
155
156
# File 'lib/mod_spox/Bot.rb', line 150

def bot_stats
    return {:uptime => Helpers::format_seconds(Time.now - @start_time),
            :plugins => @plugin_manager.plugins.size,
            :socket_connect => @socket.irc_socket.connected_at,
            :sent => @socket.irc_socket.sent,
            :received => @socket.irc_socket.received}
end

#channel_mode(message) ⇒ Object

message

Messages::Outgoing::ChannelMode message

Sends MODE message to server



281
282
283
284
285
286
287
# File 'lib/mod_spox/Bot.rb', line 281

def channel_mode(message)
    target = message.target
    channel = message.channel
    target = target.nick if target.is_a?(Models::Nick)
    channel = channel.name if channel.is_a?(Models::Channel)
    @socket << "MODE #{channel} #{message.mode} #{target}"
end

#check_join(m) ⇒ Object



537
538
539
540
541
# File 'lib/mod_spox/Bot.rb', line 537

def check_join(m)
    if(m.nick.botnick)
        @channels << m.channel.name.downcase
    end
end

#check_part(m) ⇒ Object



543
544
545
546
547
# File 'lib/mod_spox/Bot.rb', line 543

def check_part(m)
    if(m.nick.botnick)
        @channels.delete(m.channel.name.downcase)
    end
end

#clear_timer(message) ⇒ Object

message

Messages::Internal::TimerClear

Clear all actions from timer



192
193
194
# File 'lib/mod_spox/Bot.rb', line 192

def clear_timer(message)
    @timer.clear
end

#connect(message) ⇒ Object

message

Messages::Outgoing::Connect message

Sends CONNECT message to server



396
397
398
# File 'lib/mod_spox/Bot.rb', line 396

def connect(message)
    @socket << "CONNECT #{message.target_server} #{message.port} #{message.remote_server}"
end

#die(message) ⇒ Object

message

Messages::Outgoing::Die message

Sends DIE message to server



490
491
492
# File 'lib/mod_spox/Bot.rb', line 490

def die(message)
    @socket << "DIE"
end

#disconnected(message) ⇒ Object

message

Messages::Internal::Disconnected

Disconnect the bot from the IRC server



198
199
200
# File 'lib/mod_spox/Bot.rb', line 198

def disconnected(message)
    reload
end

#get_nick(message) ⇒ Object

message

Messages::Internal::NickRequest

Sends the bot’s nick to plugins



216
217
218
# File 'lib/mod_spox/Bot.rb', line 216

def get_nick(message)
    @pipeline << Messages::Internal::NickResponse(message.requester, @nick)
end

#halt(message = nil) ⇒ Object

Stop the bot



203
204
205
206
# File 'lib/mod_spox/Bot.rb', line 203

def halt(message=nil)
    @shutdown = true
    reload
end

#hook_pipelineObject

Adds hooks to pipeline for processing messages



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/mod_spox/Bot.rb', line 159

def hook_pipeline
    {:Outgoing_Admin => :admin, :Outgoing_Away => :away,
     :Outgoing_ChannelMode => :channel_mode, :Outgoing_Connect => :connect,
     :Outgoing_Die => :die, :Outgoing_Info => :info,
     :Outgoing_Invite => :invite, :Outgoing_Ison => :ison,
     :Outgoing_Join => :join, :Outgoing_Kick => :kick,
     :Outgoing_Kill => :kill, :Outgoing_Links => :links,
     :Outgoing_List => :list, :Outgoing_Lusers => :lusers,
     :Outgoing_Motd => :motd, :Outgoing_Names => :names,
     :Outgoing_Nick => :nick, :Outgoing_Notice => :notice,
     :Outgoing_Oper => :oper, :Outgoing_Part => :part,
     :Outgoing_Pass => :pass, :Outgoing_Ping => :ping,
     :Outgoing_Pong => :pong, :Outgoing_Privmsg => :privmsg,
     :Outgoing_Quit => :quit, :Outgoing_Rehash => :rehash,
     :Outgoing_ServList => :servlist, :Outgoing_Squery => :squery,
     :Outgoing_Squit => :squit, :Outgoing_Stats => :stats,
     :Outgoing_Summon => :summon, :Outgoing_Time => :time,
     :Outgoing_Topic => :topic, :Outgoing_Trace => :trace,
     :Outgoing_Unaway => :unaway, :Outgoing_User => :user,
     :Outgoing_UserHost => :userhost, :Outgoing_UserMode => :user_mode,
     :Outgoing_Users => :users, :Outgoing_Version => :version,
     :Outgoing_Who => :who, :Outgoing_WhoWas => :whowas,
     :Outgoing_Whois => :whois, :Internal_EstablishConnection => :bot_connect,
     :Internal_StatusRequest => :status, :Internal_ChangeNick => :set_nick,
     :Internal_NickRequest => :get_nick, :Internal_HaltBot => :halt,
     :Internal_Disconnected => :disconnected, :Internal_TimerClear => :clear_timer,
     :Outgoing_Raw => :raw, :Internal_Reconnect => :reconnect,
     :Incoming_Join => :check_join, :Incoming_Part => :check_part
     }.each_pair{ |type,method| @pipeline.hook(self, method, type) }
end

#info(message) ⇒ Object

message

Messages::Outgoing::Info message

Sends INFO message to server



414
415
416
# File 'lib/mod_spox/Bot.rb', line 414

def info(message)
    @socket << "INFO #{message.target}"
end

#invite(message) ⇒ Object

message

Messages::Outgoing::Invite message

Sends INVITE message to server



312
313
314
315
316
317
# File 'lib/mod_spox/Bot.rb', line 312

def invite(message)
    okay_to_send(message.channel)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    channel = message.channel.is_a?(Models::Channel) ? message.channel.name : message.channel
    @socket << "INVITE #{nick} #{channel}"
end

#ison(message) ⇒ Object

message

Messages::Outgoing::Ison message

Sends ISON message to server



526
527
528
529
# File 'lib/mod_spox/Bot.rb', line 526

def ison(message)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    @socket << "ISON #{nick}"
end

#join(message) ⇒ Object

message

Messages::Outgoing::Join message

Sends JOIN message to server



267
268
269
270
# File 'lib/mod_spox/Bot.rb', line 267

def join(message)
    channel = message.channel.is_a?(Models::Channel) ? message.channel.name : message.channel
    @socket << "JOIN #{channel} #{message.key}"
end

#kick(message) ⇒ Object

message

Messages::Outgoing::Kick message

Sends KICK message to server



321
322
323
324
325
326
# File 'lib/mod_spox/Bot.rb', line 321

def kick(message)
    okay_to_send(message.channel)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    channel = message.channel.is_a?(Models::Channel) ? message.channel.name : message.channel
    @socket << "KICK #{channel} #{nick} :#{message.reason}"
end

#kill(message) ⇒ Object

message

Messages::Outgoing::Kill message

Sends KILL message to server



453
454
455
456
# File 'lib/mod_spox/Bot.rb', line 453

def kill(message)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    @socket << "KILL #{nick} :#{message.comment}"
end
message

Messages::Outgoing::Links message

Sends LINKS message to server



384
385
386
# File 'lib/mod_spox/Bot.rb', line 384

def links(message)
    @socket << "LIST #{message.server} #{message.mask}"
end

#list(message) ⇒ Object

message

Messages::Outgoing::List message

Sends LIST message to server



305
306
307
308
# File 'lib/mod_spox/Bot.rb', line 305

def list(message)
    channel = message.channel.is_a?(Models::Channel) ? message.channel.name : message.channel
    @socket << "LIST #{channel}"
end

#lusers(message) ⇒ Object

message

Messages::Outgoing::Lusers message

Sends LUSERS message to server



365
366
367
# File 'lib/mod_spox/Bot.rb', line 365

def lusers(message)
    @socket << "LUSERS #{message.mask} #{message.target}"
end

#motd(message) ⇒ Object

message

Messages::Outgoing::Motd message

Sends MOTD message to server



359
360
361
# File 'lib/mod_spox/Bot.rb', line 359

def motd(message)
    @socket << "MOTD #{message.target}"
end

#names(message) ⇒ Object

message

Messages::Outgoing::Names message

Sends NAMES message to server



298
299
300
301
# File 'lib/mod_spox/Bot.rb', line 298

def names(message)
    channel = message.channel.is_a?(Models::Channel) ? message.channel.name : message.channel
    @socket << "NAMES #{channel} #{message.target}"
end

#nick(message) ⇒ Object

message

Messages::Outgoing::Nick message

Sends NICK message to server



228
229
230
231
# File 'lib/mod_spox/Bot.rb', line 228

def nick(message)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    @socket << "NICK #{nick}"
end

#notice(message) ⇒ Object

message

Messages::Outgoing::Notice message

Sends NOTICE message to server



350
351
352
353
354
355
# File 'lib/mod_spox/Bot.rb', line 350

def notice(message)
    okay_to_send(message.target)
    target = message.target.name if message.target.is_a?(Models::Channel)
    target = message.target.nick if message.target.is_a?(Models::Nick)
    @socket << "NOTICE #{target} :#{message}"
end

#oper(message) ⇒ Object

message

Messages::Outgoing::Oper message

Sends Oper message to server



241
242
243
# File 'lib/mod_spox/Bot.rb', line 241

def oper(message)
    @socket << "OPER #{message.name} #{message.password}"
end

#part(message) ⇒ Object

message

Messages::Outgoing::Part message

Sends PART message to server



274
275
276
277
# File 'lib/mod_spox/Bot.rb', line 274

def part(message)
    channel = message.channel.is_a?(Models::Channel) ? message.channel.name : message.channel
    @socket << "PART #{channel} :#{message.reason}"
end

#pass(message) ⇒ Object

message

Messages::Outgoing::Pass message

Sends PASS message to server



222
223
224
# File 'lib/mod_spox/Bot.rb', line 222

def pass(message)
    @socket << "PASS #{message.password}"
end

#ping(message) ⇒ Object

message

Messages::Outgoing::Ping message

Sends PING message to server



460
461
462
# File 'lib/mod_spox/Bot.rb', line 460

def ping(message)
    @socket << "PING #{message.message}"
end

#pong(message) ⇒ Object

message

Messages::Outgoing::Pong message

Sends PONG message to server



466
467
468
# File 'lib/mod_spox/Bot.rb', line 466

def pong(message)
    @socket << "PONG #{message.server} #{message.string.nil? ? '' : ":#{message.string}"}"
end

#privmsg(message) ⇒ Object

message

Messages::Outgoing::Privmsg message

Sends PRIVMSG message to server



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/mod_spox/Bot.rb', line 330

def privmsg(message)
    okay_to_send(message.target)
    target = message.target.name if message.target.is_a?(Models::Channel)
    target = message.target.nick if message.target.is_a?(Models::Nick)
    target = message.target unless target
    messages = message.message.is_a?(Array) ? message.message : [message.message]
    messages.each do |part|
        part.split("\n").each do |content|
            while(content.size > 400)
                output = content[0..400]
                content.slice!(0, 401) #(450, content.size)
                @socket.prioritize_message(target, "PRIVMSG #{target} :#{message.is_ctcp? ? "\cA#{message.ctcp_type} #{output}\cA" : output}")
            end
            @socket.prioritize_message(target, "PRIVMSG #{target} :#{message.is_ctcp? ? "\cA#{message.ctcp_type} #{content}\cA" : content}")
        end
    end
end

#quit(message) ⇒ Object

message

Messages::Outgoing::Quit message

Sends QUIT message to server



255
256
257
# File 'lib/mod_spox/Bot.rb', line 255

def quit(message)
    @socket << "QUIT :#{message.message}"
end

#raw(message) ⇒ Object

message

Messages::Outoing::Raw message

Send raw message to server



533
534
535
# File 'lib/mod_spox/Bot.rb', line 533

def raw(message)
    @socket << message.message
end

#reconnect(message = nil) ⇒ Object

message

Messages::Internal::Reconnect

instructs bot to reconnect to IRC server



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/mod_spox/Bot.rb', line 126

def reconnect(message=nil)
    begin
        @plugin_manager.reload_plugins
        @socket.irc_reconnect
    rescue Object => boom
        Logger.warn("Initial reconnect failed. (#{boom}) Starting timed reconnect process.")
        begin
            @socket.irc_reconnect
        rescue Object => boom
            Logger.warn("Failed to connect to server. Reason: #{boom}")
            Logger.warn("Will retry in 20 seconds")
            sleep(20)
            retry
        end
    end
end

#rehash(message) ⇒ Object

message

Messages::Outgoing::Rehash message

Sends REHASH message to server



484
485
486
# File 'lib/mod_spox/Bot.rb', line 484

def rehash(message)
    @socket << "REHASH"
end

#reloadObject

Reload the bot (basically a restart)



105
106
107
108
109
# File 'lib/mod_spox/Bot.rb', line 105

def reload
    @lock.synchronize do
        @waiter.signal
    end
end

#restart(message) ⇒ Object

message

Messages::Outgoing::Restart message

Sends RESTART message to server



496
497
498
# File 'lib/mod_spox/Bot.rb', line 496

def restart(message)
    @socket << "RESTART"
end

#runObject

Run the bot



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mod_spox/Bot.rb', line 71

def run
    trap('SIGTERM'){ Logger.warn("Caught SIGTERM"); halt }
    trap('SIGKILL'){ Logger.warn("Caught SIGKILL"); halt }
    trap('SIGINT'){ Logger.warn("Caught SIGINT"); halt }
    trap('SIGQUIT'){ Logger.warn("Caught SIGQUIT"); halt }
    until @shutdown do
        @pipeline << Messages::Internal::BotInitialized.new
        begin
            @lock.synchronize do
                Logger.info('Putting main execution thread to sleep until shutdown')
                @waiter.wait(@lock)
                Logger.info('Main execution thread has been restored.')
            end
        rescue Object => boom
            Logger.fatal("Caught exception: #{boom}")
        ensure
            shutdown
        end
    end
end

#servlist(message) ⇒ Object

message

Messages::Outgoing::ServList message

Sends SERVLIST message to server



420
421
422
# File 'lib/mod_spox/Bot.rb', line 420

def servlist(message)
    @socket << "SERVLIST #{message.mask} #{message.type}"
end

#set_nick(message) ⇒ Object

message

Messages::Internal::ChangeNick message

Changes the bot’s nick to the given nick



210
211
212
# File 'lib/mod_spox/Bot.rb', line 210

def set_nick(message)
    @nick = message.new_nick
end

#shutdownObject

Shut the bot down



93
94
95
96
97
98
99
100
101
102
# File 'lib/mod_spox/Bot.rb', line 93

def shutdown
    @shutdown = true
    Logger.info('Shutdown sequence initiated')
    @plugin_manager.destroy_plugins
    @timer.stop
    @pipeline << Messages::Internal::Shutdown.new
    sleep(0.1)
    @socket.shutdown unless @socket.nil?
    clean_models
end

#squery(message) ⇒ Object

message

Messages::Outgoing::Squery message

Sends SQUERY message to server



426
427
428
# File 'lib/mod_spox/Bot.rb', line 426

def squery(message)
    @socket << "SQUERY #{message.service_name} #{message.message}"
end

#squit(message) ⇒ Object

message

Messages::Outgoing::Squit message

Sends SQUIT message to server



261
262
263
# File 'lib/mod_spox/Bot.rb', line 261

def squit(message)
    @socket << "SQUIT #{message.server} :#{message.comment}"
end

#stats(message) ⇒ Object

message

Messages::Outgoing::Stats message

Sends STATS message to server



377
378
379
380
# File 'lib/mod_spox/Bot.rb', line 377

def stats(message)
    raise Exceptions::InvalidValue.new('Query must be a single character') unless message.query =~ /^[a-z]$/
    @socket << "STATS #{message.query} #{message.target}"
end

#status(message) ⇒ Object

message

Messages::Internal::StatusRequest message

Returns the current status of the bot



145
146
147
# File 'lib/mod_spox/Bot.rb', line 145

def status(message)
    @pipeline << Messages::Internal::StatusResponse.new(message.requester, bot_stats)
end

#summon(message) ⇒ Object

message

Messages::Outgoing::Summon message

Sends SUMMON message to server



502
503
504
505
506
# File 'lib/mod_spox/Bot.rb', line 502

def summon(message)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    channel = message.channel.is_a?(Models::Channel) ? message.channel.name : message.channel
    @socket << "SUMMON #{nick} #{message.target} #{channel}"
end

#time(message) ⇒ Object

message

Messages::Outgoing::Time message

Sends TIME message to server



390
391
392
# File 'lib/mod_spox/Bot.rb', line 390

def time(message)
    @socket << "TIME #{message.target}"
end

#topic(message) ⇒ Object

message

Messages::Outgoing::Topic message

Sends TOPIC message to server



291
292
293
294
# File 'lib/mod_spox/Bot.rb', line 291

def topic(message)
    channel = message.channel.is_a?(Models::Channel) ? message.channel.name : message.channel
    @socket << "TOPIC #{channel} :#{message.topic}"
end

#trace(message) ⇒ Object

message

Messages::Outgoing::Trace message

Sends TRACE message to server



402
403
404
# File 'lib/mod_spox/Bot.rb', line 402

def trace(message)
    @socket << "TRACE #{message.target}"
end

#unaway(message) ⇒ Object

message

Messages::Outgoing::Unaway message

Sends AWAY message to server



478
479
480
# File 'lib/mod_spox/Bot.rb', line 478

def unaway(message)
    @socket << "AWAY"
end

#user(message) ⇒ Object

message

Messages::Outgoing::User message

Sends USER message to server



235
236
237
# File 'lib/mod_spox/Bot.rb', line 235

def user(message)
    @socket << "USER #{message.username} #{message.mode} * :#{message.real_name}"
end

#user_mode(message) ⇒ Object

message

Messages::Outgoing::UserMode message

Sends MODE message to server



247
248
249
250
251
# File 'lib/mod_spox/Bot.rb', line 247

def user_mode(message)
    raise Exceptions::InvalidValue.new('Mode must be in the form of: [+-][a-z]+') unless message.mode =~ /^[+\-][a-z]+$/
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    @socket << "MODE #{nick} #{message.mode}"
end

#userhost(message) ⇒ Object

message

Messages::Outgoing::UserHost message

Sends USERHOST message to server



519
520
521
522
# File 'lib/mod_spox/Bot.rb', line 519

def userhost(message)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    @socket << "USERHOST #{nick}"
end

#users(message) ⇒ Object

message

Messages::Outgoing::Users message

Sends USERS message to server



510
511
512
# File 'lib/mod_spox/Bot.rb', line 510

def users(message)
    @socket << "USERS #{message.target}"
end

#version(message) ⇒ Object

message

Messages::Outgoing::Version message

Sends VERSION message to server



371
372
373
# File 'lib/mod_spox/Bot.rb', line 371

def version(message)
    @socket << "VERSION #{message.target}"
end

#wallopsObject



514
515
# File 'lib/mod_spox/Bot.rb', line 514

def wallops
end

#who(message) ⇒ Object

message

Messages::Outgoing::Who message

Sends WHO message to server



432
433
434
435
# File 'lib/mod_spox/Bot.rb', line 432

def who(message)
    o = message.only_ops? ? 'o' : ''
    @socket.prioritize_message('*who', "WHO #{message.mask} #{o}")
end

#whois(message) ⇒ Object

message

Messages::Outgoing::Whois message

Sends WHOIS message to server



439
440
441
442
# File 'lib/mod_spox/Bot.rb', line 439

def whois(message)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    @socket.prioritize_message('*whois', "WHOIS #{message.target_server} #{nick}")
end

#whowas(message) ⇒ Object

message

Messages::Outgoing::WhoWas message

Sends WHOWAS message to server



446
447
448
449
# File 'lib/mod_spox/Bot.rb', line 446

def whowas(message)
    nick = message.nick.is_a?(Models::Nick) ? message.nick.nick : message.nick
    @socket << "WHOWAS #{message.nick} #{message.count} #{message.target}"
end