Class: WelcomePlugin

Inherits:
CrazyDoll::Plugin show all
Defined in:
lib/crazy_doll/plugins/welcome_plugin.rb

Instance Attribute Summary

Attributes inherited from CrazyDoll::Plugin

#line, #opts, #params

Instance Method Summary collapse

Methods inherited from CrazyDoll::Plugin

#c, config, #config, #current_channel, #current_nick, #custom_messages, #custom_messages_chan, #custom_messages_priv, #get, #initialize, #join, #parse_message, #post, #register_events, #register_keys, #reply, #reply_to, #reply_to_a_channel?, #say, #talked_with_me?

Constructor Details

This class inherits a constructor from CrazyDoll::Plugin

Instance Method Details

#add_ignoreObject



15
16
17
18
19
20
# File 'lib/crazy_doll/plugins/welcome_plugin.rb', line 15

def add_ignore
  setup_chan(opts.to)
  return reply "I'm already ignoring #{@params.user}." if c.messages[opts.to][:ignore].include?(@params.user)
  c.messages[opts.to][:ignore] << @params.user
  reply "I've started to ignore #{@params.user}"
end

#change_messageObject



27
28
29
30
31
# File 'lib/crazy_doll/plugins/welcome_plugin.rb', line 27

def change_message
  setup_chan(opts.to)
  c.messages[opts.to][:message] = @params.message
  reply 'Message updated!'
end

#get_joinObject



9
10
11
12
13
# File 'lib/crazy_doll/plugins/welcome_plugin.rb', line 9

def get_join
  chan = opts.channel
  setup_chan(chan)
  reply c.messages[chan][:message] if opts.user != current_nick and not c.messages[chan][:ignore].include?(opts.user) and c.messages[chan][:message]
end

#setup_chan(chan) ⇒ Object



22
23
24
25
# File 'lib/crazy_doll/plugins/welcome_plugin.rb', line 22

def setup_chan(chan)
  c.messages[chan] ||= {}
  c.messages[chan][:ignore] ||= []
end