summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-04-25 14:58:04 +0300
committerJan Tuomi <jan@jantuomi.fi>2025-04-25 14:58:04 +0300
commitd77026c271b3d81ed29c0435c1cb24850389fe67 (patch)
treebf334b64a44944b1c9ff0c67f26980b20b0b9487 /src
parentf064ff4617b2656a6c70e6675764ea73223e5c91 (diff)
Support /veeti url message
Diffstat (limited to 'src')
-rw-r--r--src/index.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts
index a246292..d489dc3 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -37,7 +37,11 @@ app.command("/veeti", async ({ command, ack, respond, client }) => {
}
console.log("Received command: /veeti", command.text);
- const url = command.text.trim();
+ const cmdText = command.text.trim();
+ const cmdParts = cmdText.split(" ");
+ const url = cmdParts[0];
+ const msg =
+ cmdParts.length > 1 ? `\nViesti: ${cmdParts.slice(1).join(" ")}` : "";
const respondWithFile = async (fileName: string) => {
try {
@@ -46,7 +50,7 @@ app.command("/veeti", async ({ command, ack, respond, client }) => {
console.log("Sending message to channel", command.channel_id);
await client.filesUploadV2({
channel_id: command.channel_id,
- initial_comment: `Lähettäjä: @${command.user_name}`,
+ initial_comment: `Lähettäjä: @${command.user_name}${msg}`,
file: fileContent,
filename: fileName,
});