|
@@ -17,8 +17,8 @@ logging.config.fileConfig("logging.conf", disable_existing_loggers=False)
|
|
|
with open(os.environ.get("SECRET_FILE", "secrets.toml"), "r") as sfile:
|
|
|
secrets = toml.load(sfile)
|
|
|
database_file = os.environ.get("DATABASE_FILE", secrets["database_file"])
|
|
|
-groupme_bots = secrets["groupme_bots"]
|
|
|
-groupme_token = secrets["groupme_token"]
|
|
|
+groupme_bots = secrets["groupme"]["bots"]
|
|
|
+groupme_token = secrets["groupme"]["token"]
|
|
|
groupme_admins = secrets["admins"]["origin"]
|
|
|
group_admins = secrets["admins"]["channel"]
|
|
|
|
|
@@ -97,17 +97,18 @@ class GroupMeBot(rollbot.Rollbot[GroupMeMessage]):
|
|
|
message = ""
|
|
|
attachments = []
|
|
|
try:
|
|
|
- for att in res.attachments:
|
|
|
- if att.name == "image":
|
|
|
- if isinstance(att.body, bytes):
|
|
|
- attachments.append(
|
|
|
- {
|
|
|
- "type": "image",
|
|
|
- "url": await self.upload_image(att.body),
|
|
|
- }
|
|
|
- )
|
|
|
- else:
|
|
|
- attachments.append({"type": "image", "url": att.body})
|
|
|
+ if res.attachments is not None:
|
|
|
+ for att in res.attachments:
|
|
|
+ if att.name == "image":
|
|
|
+ if isinstance(att.body, bytes):
|
|
|
+ attachments.append(
|
|
|
+ {
|
|
|
+ "type": "image",
|
|
|
+ "url": await self.upload_image(att.body),
|
|
|
+ }
|
|
|
+ )
|
|
|
+ else:
|
|
|
+ attachments.append({"type": "image", "url": att.body})
|
|
|
except:
|
|
|
self.context.debugging = "".join(traceback.format_exc())
|
|
|
message += "Failed to upload one or more attachments!\n"
|