foxwells: join request logger
This commit is contained in:
parent
1e68c2be12
commit
28bdba1fd4
1 changed files with 30 additions and 0 deletions
|
@ -263,3 +263,33 @@ async function processReaction(_msg, reaction, user) {
|
|||
|
||||
events.add("messageReactionAdd", "vinboard", processReaction);
|
||||
events.add("messageReactionRemove", "vinboard", processReaction);
|
||||
|
||||
/* join request logger */
|
||||
const STAFF_CHANNEL_ID = "662007759738372096";
|
||||
|
||||
function processJoinRequest(data) {
|
||||
if (data.status !== "SUBMITTED") return;
|
||||
if (!data.request) return;
|
||||
if (data.request.guild_id !== FOXWELLS_GUILD_ID) return;
|
||||
|
||||
const channel = hf.bot.guilds.get(FOXWELLS_GUILD_ID).channels.get(STAFF_CHANNEL_ID);
|
||||
const userId = data.request.user_id;
|
||||
|
||||
channel.createMessage({
|
||||
embeds: [
|
||||
{
|
||||
title: "New join request",
|
||||
description: `<@${userId}> (\`${userId}\`)`,
|
||||
fields: data.request.form_responses
|
||||
.filter((field) => field.field_type !== "TERMS")
|
||||
.map((field) => ({name: field.label, value: `\`\`\`\n${field.response}\n\`\`\``})),
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
events.add("unknown", "foxwells_joinrequest", (packet) => {
|
||||
if (packet.t === "GUILD_JOIN_REQUEST_UPDATE") {
|
||||
processJoinRequest(packet.d);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue