mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Fixes to cleanup and fetch scripts
This commit is contained in:
parent
91f926bfe3
commit
495a08ea12
@ -89,7 +89,7 @@ class Titan(discord.Client):
|
|||||||
d = session.query(Messages).filter(Messages.channel_id == chanid, ~Messages.id.in_(keep_these)).delete(synchronize_session=False)
|
d = session.query(Messages).filter(Messages.channel_id == chanid, ~Messages.id.in_(keep_these)).delete(synchronize_session=False)
|
||||||
session.commit()
|
session.commit()
|
||||||
print(" --{} [{}]".format(channel["name"], d))
|
print(" --{} [{}]".format(channel["name"], d))
|
||||||
d = session.query(Messages).filter(~Messages.channel_id.in_(active_channels)).delete(synchronize_session=False)
|
d = session.query(Messages).filter(Messages.guild_id == guild.id, ~Messages.channel_id.in_(active_channels)).delete(synchronize_session=False)
|
||||||
session.commit()
|
session.commit()
|
||||||
print(" INACTIVE {}".format(d))
|
print(" INACTIVE {}".format(d))
|
||||||
print("done!")
|
print("done!")
|
||||||
|
@ -69,10 +69,13 @@ class Titan(discord.Client):
|
|||||||
|
|
||||||
print("working on this...")
|
print("working on this...")
|
||||||
for channel in self.get_all_channels():
|
for channel in self.get_all_channels():
|
||||||
if str(channel.type) == "text":
|
try:
|
||||||
print("Processing channel: ID-{} Name-'{}' ServerID-{} Server-'{}'".format(channel.id, channel.name, channel.server.id, channel.server.name))
|
if str(channel.type) == "text":
|
||||||
async for message in self.logs_from(channel, limit=50, reverse=True):
|
print("Processing channel: ID-{} Name-'{}' ServerID-{} Server-'{}'".format(channel.id, channel.name, channel.server.id, channel.server.name))
|
||||||
await self.database.push_message(message)
|
async for message in self.logs_from(channel, limit=50, reverse=True):
|
||||||
|
await self.database.push_message(message)
|
||||||
|
except:
|
||||||
|
continue
|
||||||
print("done!")
|
print("done!")
|
||||||
await self.logout()
|
await self.logout()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user