more bugs. Cleaner dockerfile
This commit is contained in:
@@ -123,7 +123,7 @@ async def fetch_missed_thread_messages():
|
||||
)["messages"]
|
||||
except SlackApiError:
|
||||
logger.error("Hit rate limit while querying threaded messages, retrying in {}s ({}/{} queries elapsed)".format(config["api_wait_time"], i, len(threads)))
|
||||
await asyncio.sleep(config["api_wait_time"])
|
||||
await asyncio.sleep(int(config["api_wait_time"]))
|
||||
messages = slack_client.conversations_replies(
|
||||
channel = config["archive_id"],
|
||||
ts = t.slack_ts,
|
||||
@@ -152,7 +152,7 @@ async def fetch_missed_channel_reactions():
|
||||
reactions = query["message"].get("reactions", []) # default = []
|
||||
except SlackApiError: # probably a rate_limit:
|
||||
logger.error("Hit rate limit while querying reactions. retrying in {}s ({}/{} queries elapsed)".format(config["api_wait_time"], i, len(threads)))
|
||||
await asyncio.sleep(config["api_wait_time"])
|
||||
await asyncio.sleep(int(config["api_wait_time"]))
|
||||
reactions = query["message"].get("reactions", [])
|
||||
|
||||
for r in reactions:
|
||||
@@ -202,11 +202,13 @@ def message_dict_to_model(message):
|
||||
)
|
||||
logger.info("Saved (text) {} (new={})".format(m, new))
|
||||
|
||||
for f in message.get("files", []): #default: []
|
||||
files = message.get("files", [])
|
||||
if len(files) >= 1:
|
||||
f = files[0] #default: []
|
||||
m.file_type = f["filetype"]
|
||||
m.perma_link = f["url_private_download"]
|
||||
m.save()
|
||||
logger.info("Saved permalink {} to {} (possibly overwriting)".format(f["name"], m))
|
||||
logger.info("Saved permalink {} to {}".format(f["name"], m))
|
||||
if new:
|
||||
return m
|
||||
else:
|
||||
|
@@ -164,7 +164,7 @@ class BotApp(App):
|
||||
|
||||
|
||||
|
||||
class BotRunner(Thread):
|
||||
class BotRunner():
|
||||
"""Stupid encapsulation so that we can apply the slack decorators to the BotApp"""
|
||||
def __init__(self, callback, *args, **kwargs) -> None:
|
||||
self.bot_worker = BotApp(callback, token=config["auth_token"])
|
||||
@@ -177,11 +177,11 @@ class BotRunner(Thread):
|
||||
def handle_incoming_reaction(event, say):
|
||||
return self.bot_worker.handle_incoming_reaction(event)
|
||||
|
||||
target = self.launch
|
||||
super().__init__(target=target)
|
||||
# target = self.launch
|
||||
# super().__init__(target=target)
|
||||
|
||||
|
||||
def launch(self):
|
||||
def start(self):
|
||||
self.bot_worker.start()
|
||||
SocketModeHandler(self.bot_worker, config["app_token"]).start()
|
||||
|
||||
|
Reference in New Issue
Block a user