0

我不知道为什么,但每次我调用一个函数时,它都会被调用两次

    def nicks(self, user, nick=None, mode="get"):
            db = w.connect("bots.db")
            c = db.cursor()

            if mode == "create":
                    c.execute('delete from nicks where user like("%s")' % (user))
                    c.execute('insert into nicks(user, nick, time) values("%s", "%s", "%s")' % (user, nick, set_time))
                    db.commit()
            elif mode == "ginfo":
                    nick = "".join([n[1] for n in c.fetchall()])
                    time = "".join([t[2] for t in c.fetchall()])
                    try: return "NICK_SET: %s TIME_SET: %s" % (nick, formatTime(time))
                    except Exception as e: return "NICK_SET: Not Found TIME_SET: Not Found"
            elif mode == "get":
                    try:
                         print("MODE: %s" % mode)
                         c.execute('select * from nicks where user like("%s")' % (user))
                         #nick = "".join([us[2] for us in c.fetchall()])
                         return ''.join([us[2] for us in c.fetchall()])
                    except: return user
  print(nicks(user="user", nick="nick", mode="create"))
  print(nicks(user="user"))
  return_value: nick
  return_value: nick

整个模块可以在这里找到http://yuribot.com/mod.txt

4

0 回答 0