fixed bug when target overwriten by others

This commit is contained in:
Your Name 2024-12-08 17:11:45 +03:00
parent ed23de9ee5
commit 9dce37a864

15
ubot.py
View file

@ -312,19 +312,26 @@ async def main():
c.execute("INSERT INTO avocado(user_id,when_int,bio_str,bio_int,expr_int,expr_str) VALUES (?, ?, ?, ?, ?, ?)", (int( c.execute("INSERT INTO avocado(user_id,when_int,bio_str,bio_int,expr_int,expr_str) VALUES (?, ?, ?, ?, ?, ?)", (int(
u2id), int(when), str(experience), int(exp_int), int(datetime.timestamp(a)), str(a.strftime("%d.%m.%y")))) u2id), int(when), str(experience), int(exp_int), int(datetime.timestamp(a)), str(a.strftime("%d.%m.%y"))))
conn.commit() conn.commit()
logger.debug('success writen my attack')
except: except:
try: try:
c.execute("UPDATE avocado SET when_int = :wh, bio_str = :xp, bio_int = :xpi, expr_int = :end, expr_str = :do WHERE user_id = :z AND when_int <= :wh;", { c.execute("UPDATE avocado SET when_int = :wh, bio_str = :xp, bio_int = :xpi, expr_int = :end, expr_str = :do WHERE user_id = :z AND when_int <= :wh;", {
"wh": int(when), "xp": str(experience), "xpi": int(exp_int), "end": int(datetime.timestamp(a)), "do": str(a.strftime("%d.%m.%y")), "z": int(u2id)}) "wh": int(when), "xp": str(experience), "xpi": int(exp_int), "end": int(datetime.timestamp(a)), "do": str(a.strftime("%d.%m.%y")), "z": int(u2id)})
conn.commit() conn.commit()
logger.debug('success updated my attack')
except Exception as Err: except Exception as Err:
logger.exception(f'err: {Err} avocado') logger.exception(f'err: {Err} avocado')
logger.debug('success writen my attack')
if db_sqlite3 and u1id != my_id: if db_sqlite3 and u1id != my_id:
c.execute("INSERT OR REPLACE INTO avocado(user_id,when_int,bio_str,bio_int,expr_int) VALUES (?, ?, ?, ?, ?)", (int( try:
u2id), int(when), str(experience), int(exp_int), 0)) c.execute("INSERT INTO avocado(user_id,when_int,bio_str,bio_int,expr_int) VALUES (?, ?, ?, ?, ?)", (
int(u2id), int(when), str(experience), int(exp_int), 0))
conn.commit() conn.commit()
logger.debug('success writen not my bio attack') logger.debug('success writen not my new bio attack')
except:
c.execute("UPDATE avocado SET when_int = :wh, bio_str = :xp, bio_int = :xpi, expr_int = :end WHERE user_id = :z", {
"wh": int(when), "xp": str(experience), "xpi": int(exp_int), "end": 0, "z": int(u2id)})
conn.commit()
logger.debug('success updated not my new bio attack')
if db_pymysql: if db_pymysql:
try: try:
# from_infect who_id user_id profit until_infect until_str # from_infect who_id user_id profit until_infect until_str