理由はわかりませんが、関数を呼び出すたびに2回呼び出されます
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