help.txt 499 Bytes
def help(id, tokens, mud):
    if len(tokens) > 0:
        filename = 'help/' + tokens[0] + '.txt'
    else:
        filename = 'help/help.txt'
    try:
        with open(filename, 'r', encoding='utf-8') as f:
            for line in f:
                mud.send_message(id, line, '\r')
            mud.send_message(id, '')
    except:
        mud.send_message(id, 'No help topics available for \"{}\". A list\r\n of all commands is available at: help index'.format(tokens[0]))

help(id, tokens, mud)