Example #1
0
File: eqbot.py Project: codl/eqbot
def newTracks(bot):
    for t in eqbeats.newTracks():
        for c in bot.channels:
            if c.level >= 90:
                bot.sendMsg(c.name, "New track: " + eqbeats.ppTrack(t))
        bot.lastTid = str(t['id'])
    return 120
Example #2
0
File: eqbot.py Project: codl/eqbot
def do(e, bot):
    words = e.msg.split()
    if len(words) < 3:
        bot.reply(e, "Usage : !do #channel action")
        if auth(e.source) >= HOP:
            bot.reply(e, "        !do nick action")
        return
    if auth(e.source) >= HOP or e.args[0][0] in "#&":
        bot.sendMsg(words[1], irc.action(" ".join(words[2:])))
Example #3
0
File: eqbot.py Project: codl/eqbot
def say(e, bot):
    words = e.msg.split()
    if len(words) < 3:
        bot.reply(e, "Usage : !say #channel message")
        if auth(e.source) >= HOP:
            bot.reply(e, "        !say nick message")
        return
    if auth(e.source) >= HOP or e.args[0][0] in "#&":
        if words[1].lower() == "chanserv" and words[2].lower() == "kick" and words[3].lower() == "#eqbeats":
            e.reply("Do it yourself.")
        else:
            bot.sendMsg(words[1], " ".join(words[2:]))
Example #4
0
File: eqbot.py Project: codl/eqbot
def fetchacc(user, bot = b):
    bot.sendMsg("NickServ", "acc " + user.partition("!")[0] + " *")
    for e in bot.eventLoop():
        if e.type == irc.NOTICE and e.sourceNick == "NickServ":
            args = e.msg.split()
            if args[0] == user.partition("!")[0] and args[3] == "ACC":
                _, _, account, _, level = args[:5]
                bot.acc[user] = account
                bot.userlevel[user] = 0
                if int(level) == 3:
                    if account in bot.ops:
                        bot.userlevel[user] = OP
                    if account in bot.hops:
                        bot.userlevel[user] = HOP
                break
Example #5
0
File: eqbot.py Project: codl/eqbot
def deliverMail(e, bot):
    nick = e.msg if e.type == irc.NICK else e.sourceNick
    db = getdb()
    c = db.cursor()
    c.execute("SELECT source, msg, private, time FROM mail WHERE dest LIKE ?", (nick,))
    messages = c.fetchall()
    c.execute("DELETE FROM mail WHERE dest LIKE ?", (nick,))
    for m in messages:
        msg = nick + ": Mail from " + m[0]
        if m[3]:
            msg += " sent %s ago" % (relativetime(time.time() - int(m[3])))
        msg += ": " + m[1]
        if m[2] or not e.channel:
            bot.sendMsg(nick, msg)
        else:
            bot.reply(e, msg)
    db.commit()
Example #6
0
File: eqbot.py Project: codl/eqbot
def violence(e, bot): # never the answer
    if(e.type == irc.ACTION and re.search("(hits|kicks|slaps|punches|crushes|maims|harms|shoots|stabs) " + i.nick, e.msg, re.I)):
        if e.channel == "#eqbeats" and random.random() < 0.1:
            bot.reply(e, "You thought you could abuse old EqBot, that pushover. Well, new EqBot is not going to have any of that!")
            time.sleep(0.5)
            bot.sendMsg("ChanServ", "kick #eqbeats " + e.sourceNick)
        else:
            bot.reply(e, random.choice((
                "Ow!",
                "Stop that!",
                "HALP!",
                ":(",
                "You broke my " + bodypart() + "!",
                "I don't like you. :(",
                irc.action("cries"),
                irc.action("flails"),
                irc.action("whimpers"),
                irc.action("whines"),
                irc.action("flees"))
            ))
                                      'subj_id', 'random_round', 'K', 'lr',
                                      'nepochs', 'pretrain_path', 'channel',
                                      'loss', 'W', 'N1', 'N2', 'N3', 'REM',
                                      'MF1', 'finetune_weight_path'
                                  ])
                print(df)

                # each fold save weight in separate directory, but the first one keep all fold's result
                all_result_csv = pjoin(all_results_path, 'all_folds.csv')
                if os.path.exists(all_result_csv):
                    df.to_csv(all_result_csv,
                              mode='a',
                              header=False,
                              index=False)
                else:
                    df.to_csv(all_result_csv, index=False)

                del finetune, results, df

            if go_next_subj:
                break

        if go_next_subj:
            break

    bot.sendMsg('[DONE] FinetuneCNNKFolds fine-tune path:', all_results_path,
                '=> Subject', subject_id, 'done.')

bot.sendMsg('[DONE] FinetuneCNNKFolds fine-tune path:', all_results_path,
            ' 🥳🥳🥳')
Example #8
0
File: eqbot.py Project: codl/eqbot
def once(bot):
    for channel in bot.channels:
        if channel.level >= 95:
            bot.sendMsg(channel.name, "once")
    return random.randint(30, 172800) # 48h :D