Пример #1
0
Файл: help.py Проект: mvk/sopel
def commands(bot, trigger):
    """Return a list of bot's commands"""
    names = ', '.join(sorted(iterkeys(bot.doc)))
    if not trigger.is_privmsg:
        bot.reply("I am sending you a private message of all my commands!")
    bot.msg(trigger.nick, 'Commands I recognise: ' + names + '.', max_messages=10)
    bot.msg(trigger.nick, ("For help, do '%s: help example' where example is the " +
                           "name of the command you want help for.") % bot.nick)
Пример #2
0
def commands(bot, trigger):
    """Return a list of bot's commands"""
    names = ', '.join(sorted(iterkeys(bot.doc)))
    if not trigger.is_privmsg:
        bot.reply("I am sending you a private message of all my commands!")
    bot.msg(trigger.nick,
            'Commands I recognise: ' + names + '.',
            max_messages=10)
    bot.msg(trigger.nick,
            ("For help, do '%s: help example' where example is the " +
             "name of the command you want help for.") % bot.nick)
Пример #3
0
def dumpReminders(fn, data, lock):
    lock.acquire()
    try:
        f = open(fn, "w")
        for tellee in iterkeys(data):
            for remindon in data[tellee]:
                line = "\t".join((tellee,) + remindon)
                try:
                    to_write = line + "\n"
                    if sys.version_info.major < 3:
                        to_write = to_write.encode("utf-8")
                    f.write(to_write)
                except IOError:
                    break
        try:
            f.close()
        except IOError:
            pass
    finally:
        lock.release()
    return True
Пример #4
0
def dumpReminders(fn, data, lock):
    lock.acquire()
    try:
        f = open(fn, 'w')
        for tellee in iterkeys(data):
            for remindon in data[tellee]:
                line = '\t'.join((tellee, ) + remindon)
                try:
                    to_write = line + '\n'
                    if sys.version_info.major < 3:
                        to_write = to_write.encode('utf-8')
                    f.write(to_write)
                except IOError:
                    break
        try:
            f.close()
        except IOError:
            pass
    finally:
        lock.release()
    return True
Пример #5
0
def dumpMemories(fn, data, lock):
    lock.acquire()
    try:
        f = open(fn, 'w')
        for keyword in iterkeys(data):
            message = data[keyword]
            line = '\t'.join((keyword, message))
            try:
                to_write = line + '\n'
                if sys.version_info.major < 3:
                    to_write = to_write.encode('utf-8')
                f.write(to_write)
            except IOError:
                break
        try:
            f.close()
        except IOError:
            pass
    finally:
        lock.release()
    return True
Пример #6
0
def dumpReminders(fn, data, lock):
    lock.acquire()  # lock file
    try:
        f = open(fn, 'w')  # open file with write access
        for tellee in iterkeys(data):  # go through everything
            for remindon in data[tellee]:
                line = '\t'.join((tellee, ) + remindon)
                try:
                    to_write = line + '\n'
                    if sys.version_info.major < 3:
                        to_write = to_write.encode('utf-8')
                    f.write(to_write)  # store the data
                except IOError:
                    break
        try:
            f.close()  # close the file
        except IOError:
            pass
    finally:
        lock.release()  # release the lock
    return True