3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00
PyLink/plugins/commands.py

22 lines
716 B
Python
Raw Normal View History

# 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:
proto._sendFromUser(irc, 'NOTICE %s :%s' % (irc.users[target].uid, text))
except KeyError:
proto._sendFromUser(irc, 'PRIVMSG %s :unknown user %r' % (source, target))
@proto.add_cmd
def debug(irc, source, args):
proto._sendFromUser(irc, 'NOTICE %s :Debug info printed to console.' % (source))
print(irc.users)