Sha256: 3c93259768a6e7cc7679c243183e8e89aa75468079e0de77594bb26ebb9fb028

Contents?: true

Size: 1.56 KB

Versions: 10

Compression:

Stored size: 1.56 KB

Contents

core.help_add('cross', 'as', 'as <nickname> {message}', 'Processes given message as given user')
cmd(cmd: 'as') do |dat|
  nick = dat[:split][0]
  if dat[:plug].users[nick]
    user = dat[:plug].getuser(nick)
    host = dat[:plug].gethost(nick)
    message = dat[:split][1..dat[:split].length - 1].join(' ')
    dat[:plug].emit(dat.merge(type: :privmsg, nick: nick, user: user, host: host,
                              message: message, target: dat[:target], reply_to: dat[:reply_to]))
  else
    dat.nreply 'No such user!'
  end
end.perm!('crossuser')

core.help_add('cross', 'at', 'at <channel> {message}', 'Processes given message at given channel')
cmd(cmd: 'at') do |dat|
  chan = dat[:split][0]
  if dat[:plug].chans[chan]
    nick = dat[:nick]
    user = dat[:plug].getuser(nick)
    host = dat[:plug].gethost(nick)
    message = dat[:split][1..dat[:split].length - 1].join(' ')
    dat[:plug].emit(dat.merge(type: :privmsg, nick: nick, user: user, host: host,
                              message: message, target: chan, reply_to: chan))
  else
    dat.nreply 'No such chan!'
  end
end.perm!('crosschan')

core.help_add('cross', 'on', 'on <server> {message}', 'Processes given message on given server')
cmd(cmd: 'on') do |dat|
  plug = dat[:split][0]
  if bot.plugs[plug] && bot.plugs[plug].running
    message = dat[:split][1..dat[:split].length - 1].join(' ')
    bot.plugs[plug].emit(dat.merge(type: :privmsg, nick: nil, user: nil, host: nil,
                                   message: message, plug: bot.plugs[plug]))
  else
    dat.nreply 'No such plug!'
  end
end.perm!('crossplug')

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
protonbot-0.3.7 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.3.6 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.3.5 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.3.4 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.3.3 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.3.2 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.3.1 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.3.0 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.2.7 lib/protonbot/core_plugin/commands/cross.rb
protonbot-0.2.6 lib/protonbot/core_plugin/commands/cross.rb