plugins/hello.rb
def execute(message, query=nil)

    # if the query parameter was sent in then this one runs
    if query
      # message.reply sends a message to the channel.
      # query is the captured value from the regular expression
      # in the matcher.
      # So, Jeeves greets the person you say.
      message.reply("Hi there, #{query}!")
    else
      # message.user.nick gets the username of the person who sent the
      # original message.
      # So Jeeves greets you.
      message.reply("Hi there, #{message.user.nick}!")
    end

    # and that's it. The rest is up to you! Use any Ruby code
    # you want, including other objects, modules, Gems, whatever!
    # Make an awesome thing!

  end
# Called when something matches the "match" rule above.
# Execute any code you want here.
# the message is the message object from the chat. It's a way
# to reply or get info about the message that the bot is responding
# to, including the user and the channel the message came from.
#
# The query is anything that was captured after the matcher
#
# The query may or may not be there. - if the match didn't capture anything
# then there will be no query - it'll be nil. If there was a capture, it'll
# be in the query variable.
#
# For example, the !greetings command captures some user input
# after the phrase. So its value is in the query. But the !hello command
# does not.
Called when something matches the "match" rule above.
Execute any code you want here.
the message is the message object from the chat. It's a way
to reply or get info about the message that the bot is responding
to, including the user and the channel the message came from.

The query is anything that was captured after the matcher

The query may or may not be there. - if the match didn't capture anything
then there will be no query - it'll be nil. If there was a capture, it'll
be in the query variable.

For example, the !greetings command captures some user input
after the phrase. So its value is in the query. But the !hello command
does not.
Called when something matches the " match " rule above . Execute any code you want here . the message is the message object from the chat . It ' s a way to reply or get info about the message that the bot is responding to including the user and the channel the message came from . The query is anything that was captured after the matcher The query may or may not be there . - if the match didn ' t capture anything then there will be no query - it ' ll be nil . If there was a capture it ' ll be in the query variable . For example the !greetings command captures some user input after the phrase . So its value is in the query . But the !hello command does not .
def execute(message, query=nil)
    if query
      message.reply("Hi there, #{query}!")
    else
      message.reply("Hi there, #{message.user.nick}!")
    end
  end
def execute ( message , query = nil ) if query message . reply ( "Hi there, #{query}!" ) else message . reply ( "Hi there, #{message.user.nick}!" ) end end
Called when something matches the "match" rule above.
Called when something matches the " match " rule above .
# if the query parameter was sent in then this one runs # message.reply sends a message to the channel. # query is the captured value from the regular expression # in the matcher. # So, Jeeves greets the person you say. # message.user.nick gets the username of the person who sent the # original message. # So Jeeves greets you. # and that's it. The rest is up to you! Use any Ruby code # you want, including other objects, modules, Gems, whatever! # Make an awesome thing!
message
query