mirror of
https://github.com/System-End/slack-end.git
synced 2026-04-19 22:05:10 +00:00
chore: cmd
This commit is contained in:
parent
f471b6f727
commit
c53d8bd0fe
2 changed files with 18 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ import * as Sentry from "@sentry/node";
|
|||
import { ModifiedApp } from "../modules/slackapp";
|
||||
import { compareSync } from "bcrypt";
|
||||
import { EncryptedJsonDb } from "../modules/encrypted-db";
|
||||
import { sendSchedule } from "../modules/robotics";
|
||||
const clean = async (text) => {
|
||||
// If our input is a promise, await it before continuing
|
||||
if (text && text.constructor?.name == "Promise") text = await text;
|
||||
|
|
@ -186,6 +187,21 @@ export default class Message implements Command {
|
|||
app.ws.on("connect", () => {
|
||||
console.log("Connected to WS server");
|
||||
});
|
||||
} else if (cmd == "robotics") {
|
||||
const out = await sendSchedule(args.join(" "), app, `C07R8DYAZMM`)
|
||||
if(out) {
|
||||
await app.client.chat.postEphemeral({
|
||||
channel: event.channel,
|
||||
text: `Robotics schedule sent!`,
|
||||
user: event.user,
|
||||
});
|
||||
} else {
|
||||
await app.client.chat.postEphemeral({
|
||||
channel: event.channel,
|
||||
text: `Robotics schedule not sent!`,
|
||||
user: event.user,
|
||||
});
|
||||
}
|
||||
}
|
||||
console.debug(`#message-`);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ export async function sendSchedule(
|
|||
channel: string,
|
||||
) {
|
||||
const schedule = extractText(text);
|
||||
if (schedule.length == 0) return;
|
||||
if (schedule.length == 0) return 0;
|
||||
const msg = await app.client.chat.postMessage({
|
||||
channel,
|
||||
text: `Oh whats this? a schedule? for .. Robotics?? :robot:`,
|
||||
|
|
@ -65,4 +65,5 @@ export async function sendSchedule(
|
|||
});
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue