mirror of
https://github.com/gryf/slack-backup.git
synced 2025-12-17 19:40:21 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f9f290ba4 | |||
|
|
08a0a82435 | ||
|
|
a42506dff9 | ||
|
|
0d7607cf3c |
2
setup.py
2
setup.py
@@ -10,7 +10,7 @@ except ImportError:
|
|||||||
|
|
||||||
setup(name="slack-backup",
|
setup(name="slack-backup",
|
||||||
packages=["slack_backup"],
|
packages=["slack_backup"],
|
||||||
version="0.4.4",
|
version="0.4.5",
|
||||||
description="Make copy of slack converstaions",
|
description="Make copy of slack converstaions",
|
||||||
author="Roman Dobosz",
|
author="Roman Dobosz",
|
||||||
author_email="gryf73@gmail.com",
|
author_email="gryf73@gmail.com",
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ class Client(object):
|
|||||||
channels = all_channels
|
channels = all_channels
|
||||||
|
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
|
logging.info("Getting messages for channel `%s'", channel.name)
|
||||||
latest = self.q(o.Message).\
|
latest = self.q(o.Message).\
|
||||||
filter(o.Message.channel == channel).\
|
filter(o.Message.channel == channel).\
|
||||||
order_by(o.Message.ts.desc()).first()
|
order_by(o.Message.ts.desc()).first()
|
||||||
@@ -146,8 +147,12 @@ class Client(object):
|
|||||||
Create message with corresponding possible metadata, like reactions,
|
Create message with corresponding possible metadata, like reactions,
|
||||||
files etc.
|
files etc.
|
||||||
"""
|
"""
|
||||||
user = self.q(o.User).\
|
try:
|
||||||
filter(o.User.slackid == data['user']).one()
|
user = self.q(o.User).\
|
||||||
|
filter(o.User.slackid == data['user']).one()
|
||||||
|
except KeyError:
|
||||||
|
user = self.q(o.User).\
|
||||||
|
filter(o.User.slackid == data['comment']['user']).one()
|
||||||
|
|
||||||
if data['type'] == 'message' and not data['text'].strip():
|
if data['type'] == 'message' and not data['text'].strip():
|
||||||
logging.info("Skipping message from `%s' since it's empty",
|
logging.info("Skipping message from `%s' since it's empty",
|
||||||
@@ -255,7 +260,7 @@ class Client(object):
|
|||||||
if not database:
|
if not database:
|
||||||
return 'assets'
|
return 'assets'
|
||||||
|
|
||||||
path = os.path.dirname(os.path.abspath(database))
|
path = os.path.dirname(database)
|
||||||
return os.path.join(path, 'assets')
|
return os.path.join(path, 'assets')
|
||||||
|
|
||||||
def _channels_list(self):
|
def _channels_list(self):
|
||||||
|
|||||||
@@ -79,8 +79,10 @@ class Download(object):
|
|||||||
count = 1
|
count = 1
|
||||||
|
|
||||||
while filetype != 'avatar' and os.path.exists(path):
|
while filetype != 'avatar' and os.path.exists(path):
|
||||||
base, ext = os.path.splitext(path)
|
if count == 1:
|
||||||
path = base + "%0.3d" % count + ext
|
base, ext = os.path.splitext(path)
|
||||||
|
path = base + ".%0.3d" % count + ext
|
||||||
|
count += 1
|
||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user