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__))))
|
2015-05-31 08:00:39 +02:00
|
|
|
import utils
|
2015-05-31 21:20:09 +02:00
|
|
|
from conf import conf
|
2015-04-25 08:00:01 +02:00
|
|
|
|
2015-05-31 21:20:09 +02:00
|
|
|
@utils.add_cmd
|
2015-04-25 08:04:33 +02:00
|
|
|
def debug(irc, source, args):
|
2015-06-07 08:04:11 +02:00
|
|
|
print('user index: %s' % irc.users)
|
|
|
|
print('server index: %s' % irc.servers)
|
|
|
|
print('channels index: %s' % irc.channels)
|
2015-05-31 21:20:09 +02:00
|
|
|
utils.msg(irc, source, 'Debug info printed to console.')
|
|
|
|
|
|
|
|
@utils.add_cmd
|
|
|
|
def status(irc, source, args):
|
|
|
|
identified = irc.users[source].identified
|
|
|
|
if identified:
|
|
|
|
utils.msg(irc, source, 'You are identified as %s.' % identified)
|
|
|
|
else:
|
|
|
|
utils.msg(irc, source, 'You are not identified as anyone.')
|
|
|
|
|
|
|
|
@utils.add_cmd
|
|
|
|
def identify(irc, source, args):
|
|
|
|
try:
|
|
|
|
username, password = args[0], args[1]
|
|
|
|
except IndexError:
|
|
|
|
utils.msg(irc, source, 'Error: not enough arguments.')
|
|
|
|
return
|
|
|
|
if username.lower() == conf['login']['user'].lower() and password == conf['login']['password']:
|
|
|
|
realuser = conf['login']['user']
|
|
|
|
irc.users[source].identified = realuser
|
|
|
|
utils.msg(irc, source, 'Successfully logged in as %s.' % realuser)
|
|
|
|
else:
|
|
|
|
utils.msg(irc, source, 'Incorrect credentials.')
|
|
|
|
|
|
|
|
def listcommands(irc, source, args):
|
|
|
|
cmds = list(utils.bot_commands.keys())
|
|
|
|
cmds.sort()
|
|
|
|
utils.msg(irc, source, 'Available commands include: %s' % ', '.join(cmds))
|
|
|
|
utils.add_cmd(listcommands, 'list')
|