mom: fix attachment downloads - pass store to SlackBot, process files, use absolute paths

This commit is contained in:
Mario Zechner 2025-12-11 23:55:49 +01:00
parent d277d739b3
commit e3576fe016
4 changed files with 246 additions and 107 deletions

View file

@ -100,7 +100,7 @@ function createSlackContext(event: SlackEvent, slack: SlackBot, state: ChannelSt
userName: user?.userName,
channel: event.channel,
ts: event.ts,
attachments: [],
attachments: (event.attachments || []).map((a) => ({ local: a.local })),
},
channelName: slack.getChannel(event.channel)?.name,
store: state.store,
@ -243,10 +243,14 @@ const handler: MomHandler = {
log.logStartup(workingDir, sandbox.type === "host" ? "host" : `docker:${sandbox.container}`);
// Shared store for attachment downloads (also used per-channel in getState)
const sharedStore = new ChannelStore({ workingDir, botToken: MOM_SLACK_BOT_TOKEN! });
const bot = new SlackBotClass(handler, {
appToken: MOM_SLACK_APP_TOKEN,
botToken: MOM_SLACK_BOT_TOKEN,
workingDir,
store: sharedStore,
});
bot.start();