internal corporate restructuring (90% of our engineer team has been laid off and replaced by Grok)
This commit is contained in:
parent
e377117d33
commit
7dcc0c2cc4
11 changed files with 184 additions and 96 deletions
55
src/joinRequestActions/lockUnlock.tsx
Normal file
55
src/joinRequestActions/lockUnlock.tsx
Normal file
|
@ -0,0 +1,55 @@
|
|||
import { ComponentTypes, InteractionTypes, MessageFlags } from "oceanic.js";
|
||||
import { client } from "..";
|
||||
import { db } from "../utils/database";
|
||||
import { PendingApplicationMessage } from "../components/PendingApplicationMessage";
|
||||
import { canUser } from "../utils/utils";
|
||||
|
||||
client.on("interactionCreate", async (interaction) => {
|
||||
if (interaction.type === InteractionTypes.MESSAGE_COMPONENT)
|
||||
if (interaction.data.componentType === ComponentTypes.BUTTON) {
|
||||
if (!interaction.data.customID.includes("lock")) return;
|
||||
|
||||
if (!canUser(interaction.member!, "owner"))
|
||||
return await interaction.createMessage({
|
||||
flags: MessageFlags.EPHEMERAL,
|
||||
content: "💢 nop"
|
||||
});
|
||||
|
||||
const application = await db.get(
|
||||
"SELECT * FROM applications WHERE message_id=?",
|
||||
interaction.message.id
|
||||
);
|
||||
console.log(application);
|
||||
|
||||
switch (interaction.data.customID.split("-")[0]) {
|
||||
case "lock": {
|
||||
await interaction.editParent(
|
||||
<PendingApplicationMessage
|
||||
id={application.id}
|
||||
response={JSON.parse(application.responses)}
|
||||
user={await client.rest.users.get(
|
||||
application.user_id
|
||||
)}
|
||||
locked={true}
|
||||
threadID={application.thread_id}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "unlock": {
|
||||
await interaction.editParent(
|
||||
<PendingApplicationMessage
|
||||
id={application.id}
|
||||
response={JSON.parse(application.responses)}
|
||||
user={await client.rest.users.get(
|
||||
application.user_id
|
||||
)}
|
||||
locked={false}
|
||||
threadID={application.thread_id}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue