Module: MoonBot::Helpers

Defined in:
lib/MoonBot/plugins/helpers.rb

Instance Method Summary collapse

Instance Method Details

#match(msg, regex) ⇒ Object



12
13
14
15
16
17
# File 'lib/MoonBot/plugins/helpers.rb', line 12

def match msg, regex
  if msg[:trailing].scan(regex)
    args = msg[:trailing].gsub(regex, '')
    yield args
  end
end

#parse_user(user_string) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/MoonBot/plugins/helpers.rb', line 2

def parse_user user_string
  user = {} 
  nick, host = user_string.split('@')
  nick, name = nick.split('!')
  user[:nick] = nick
  user[:name] = name
  user[:host] = host
  user
end