Delete the messages before fetching new messages

This commit is contained in:
Jeremy Zhang
2017-09-22 01:39:43 +00:00
parent 495a08ea12
commit f46d33c943
2 changed files with 8 additions and 0 deletions

View File

@ -287,3 +287,9 @@ class DatabaseInterface(object):
dbuser.revoked = True
session.commit()
return "Successfully kicked **{}#{}**!".format(dbuser.username, dbuser.discriminator)
async def delete_all_messages_from_channel(self, channel_id):
async with threadpool():
with self.get_session() as session:
session.query(Messages).filter(Messages.channel_id == channel_id).delete()
session.commit()