mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-14 01:51:22 +01:00
Use the api endpoint to only clean the keyvalue store for now. the messages should be handled by the external bot script
This commit is contained in:
parent
8be753b0c3
commit
1fac087b6d
@ -411,18 +411,18 @@ def cleanup_keyval_db():
|
||||
db.session.query(KeyValueProperties).filter(KeyValueProperties.expiration < datetime.datetime.now()).delete()
|
||||
db.session.commit()
|
||||
|
||||
guilds = Guilds.query.all()
|
||||
for guild in guilds:
|
||||
try:
|
||||
channelsjson = json.loads(guild.channels)
|
||||
except:
|
||||
continue
|
||||
for channel in channelsjson:
|
||||
chanid = channel["id"]
|
||||
msgs = db.session.query(Messages).filter(Messages.channel_id == chanid).order_by(Messages.timestamp.desc()).offset(50).all()
|
||||
for msg in msgs:
|
||||
db.session.delete(msg)
|
||||
db.session.commit()
|
||||
# guilds = Guilds.query.all()
|
||||
# for guild in guilds:
|
||||
# try:
|
||||
# channelsjson = json.loads(guild.channels)
|
||||
# except:
|
||||
# continue
|
||||
# for channel in channelsjson:
|
||||
# chanid = channel["id"]
|
||||
# msgs = db.session.query(Messages).filter(Messages.channel_id == chanid).order_by(Messages.timestamp.desc()).offset(50).all()
|
||||
# for msg in msgs:
|
||||
# db.session.delete(msg)
|
||||
# db.session.commit()
|
||||
|
||||
return ('', 204)
|
||||
abort(401)
|
||||
|
Loading…
Reference in New Issue
Block a user