summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/remotectl.rb
blob: cb7775e2835b4e6336fbc47943155e69f48ed693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#-- vim:sw=4:et
#++
#
# :title: RemoteCtl plugin
#
# Author:: jsn (dmitry kim) <dmitry dot kim at gmail dot org>
# Copyright:: (C) 2007 dmitry kim
# License:: in public domain
#
# Adds druby remote command execution to rbot. See 'bin/rbot-remote' for
# example usage.

class RemoteCtlPlugin < Plugin
    include RemotePlugin

    def remote_command(m, params)
        s = params[:string].to_s
        new_m = PrivMessage.new(@bot, @bot.server, @bot.server.user('-remote.client-'), @bot.myself, s)
        @bot.plugins.delegate "listen", new_m
        @bot.plugins.privmsg(new_m)
    end
end

me = RemoteCtlPlugin.new

me.remote_map 'dispatch *string',
    :action => 'remote_command',
    :action_path => 'dispatch'

me.default_auth('*', false)