2015-04-25 08:00:01 +02:00
|
|
|
# commands.py: base PyLink commands
|
|
|
|
import sys, os
|
|
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
import proto
|
|
|
|
|
|
|
|
@proto.add_cmd
|
|
|
|
def tell(irc, source, args):
|
|
|
|
try:
|
|
|
|
target, text = args[0], ' '.join(args[1:])
|
|
|
|
except IndexError:
|
|
|
|
proto._sendFromUser(irc, 'PRIVMSG %s :Error: not enough arguments' % source)
|
|
|
|
return
|
|
|
|
try:
|
2015-05-31 07:15:19 +02:00
|
|
|
proto._sendFromUser(irc, 'NOTICE %s :%s' % (irc.users[target], text))
|
2015-04-25 08:00:01 +02:00
|
|
|
except KeyError:
|
|
|
|
proto._sendFromUser(irc, 'PRIVMSG %s :unknown user %r' % (source, target))
|
2015-04-25 08:04:33 +02:00
|
|
|
|
|
|
|
@proto.add_cmd
|
|
|
|
def debug(irc, source, args):
|
|
|
|
proto._sendFromUser(irc, 'NOTICE %s :Debug info printed to console.' % (source))
|
|
|
|
print(irc.users)
|
2015-05-31 07:15:19 +02:00
|
|
|
print(irc.servers)
|