Skip to content

Commit

Permalink
Configure the contact admin posting
Browse files Browse the repository at this point in the history
  • Loading branch information
emilekm committed May 26, 2024
1 parent 046765f commit 5c18e09
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 27 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ It is common to create one Forum channel and direct all forms to it with differe

```yaml
contactadmin:
# The role that should be tagged when a form is posted
adminRoleID:
application:
public:
channelID:
Expand Down
2 changes: 2 additions & 0 deletions config.yaml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ prspy:


contactadmin:
# The role that should be tagged when a form is posted
adminRoleID:
application:
public:
channelID:
Expand Down
4 changes: 4 additions & 0 deletions config/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
"ContactAdmin": {
"additionalProperties": false,
"properties": {
"adminRoleID": {
"type": "string"
},
"appeal": {
"$ref": "#/definitions/FormConfig"
},
Expand All @@ -32,6 +35,7 @@
}
},
"required": [
"adminRoleID",
"appeal",
"application",
"report"
Expand Down
1 change: 1 addition & 0 deletions config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ interface FormConfig {
}

interface ContactAdmin {
adminRoleID: string;
application: FormConfig;
appeal: FormConfig;
report: FormConfig;
Expand Down
17 changes: 8 additions & 9 deletions modals/adminhelp/appeal.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import dotenv from "dotenv";
dotenv.config();

import { EmbedBuilder } from "discord.js";

import config from "../../config.js";

export default {
data: {
name: "appeal",
Expand All @@ -20,13 +19,13 @@ export default {
**What did he do: **
${interaction.fields.getTextInputValue("why")}\n
`);
await interaction.member.guild.channels.cache.get("1021942980950634597").threads.create({
await interaction.member.guild.channels.cache.get(config.contactadmin.appeal.public.channelID).threads.create({
name: `🟢 ${interaction.user.username}'s Appeal`,
message: {
content: `<@&${process.env.ADMIN_ID}>`,
content: `<@&${config.contactadmin.adminRoleID}>`,
embeds: [embed]
},
appliedTags: ["1021973561918902333"]
appliedTags: config.contactadmin.appeal.public.tags
})
.then(threadChannel => {
threadChannel.members.add(interaction.user.id);
Expand All @@ -48,13 +47,13 @@ export default {
**The bannable offence: **
${interaction.fields.getTextInputValue("why")}\n
`);
interaction.member.guild.channels.cache.get("1022285742799589416").threads.create({
interaction.member.guild.channels.cache.get(config.contactadmin.appeal.private.channelID).threads.create({
name: `🔒🟢 ${interaction.user.username}'s Appeal`,
message: {
content: `<@&${process.env.ADMIN_ID}>`,
content: `<@&${config.contactadmin.adminRoleID}>`,
embeds: [embed]
},
appliedTags: ["1022300302659039272"]
appliedTags: config.contactadmin.appeal.private.tags
});
});
}
Expand Down
17 changes: 8 additions & 9 deletions modals/adminhelp/apply.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import dotenv from "dotenv";
dotenv.config();

import { EmbedBuilder } from "discord.js";

import config from "../../config.js";

export default {
data: {
name: "apply",
Expand All @@ -24,13 +23,13 @@ export default {
**How active: **
${interaction.fields.getTextInputValue("active")}\n
`);
await interaction.member.guild.channels.cache.get("1021942980950634597").threads.create({
await interaction.member.guild.channels.cache.get(config.contactadmin.application.public.channelID).threads.create({
name: `🔵 ${interaction.user.username}'s Application`,
message: {
content: `<@&${process.env.ADMIN_ID}>`,
content: `<@&${config.contactadmin.adminRoleID}>`,
embeds: [embed]
},
appliedTags: ["1021973497645387816"]
appliedTags: config.contactadmin.application.public.tags
})
.then(threadChannel => {
threadChannel.members.add(interaction.user.id);
Expand All @@ -56,13 +55,13 @@ export default {
**How active: **
${interaction.fields.getTextInputValue("active")}\n
`);
interaction.member.guild.channels.cache.get("1022285742799589416").threads.create({
interaction.member.guild.channels.cache.get(config.contactadmin.application.private.channelID).threads.create({
name: `🔒🔵 ${interaction.user.username}'s Application`,
message: {
content: `<@&${process.env.ADMIN_ID}>`,
content: `<@&${config.contactadmin.adminRoleID}>`,
embeds: [embed]
},
appliedTags: ["1022300221981593662"]
appliedTags: config.contactadmin.application.private.tags
});
});
}
Expand Down
17 changes: 8 additions & 9 deletions modals/adminhelp/report.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import dotenv from "dotenv";
dotenv.config();

import { EmbedBuilder } from "discord.js";

import config from "../../config.js";

export default {
data: {
name: "report",
Expand All @@ -22,13 +21,13 @@ export default {
**What happened: **
${interaction.fields.getTextInputValue("what")}\n
`);
await interaction.member.guild.channels.cache.get("1021942980950634597").threads.create({
await interaction.member.guild.channels.cache.get(config.contactadmin.report.public.channelID).threads.create({
name: `🔴 ${interaction.user.username}'s Report`,
message: {
content: `<@&${process.env.ADMIN_ID}>`,
content: `<@&${config.contactadmin.adminRoleID}>`,
embeds: [embed]
},
appliedTags: ["1021973747546210305"]
appliedTags: config.contactadmin.report.public.tags
})
.then(threadChannel => {
threadChannel.members.add(interaction.user.id);
Expand All @@ -52,13 +51,13 @@ export default {
**What happened: **
${interaction.fields.getTextInputValue("what")}\n
`);
interaction.member.guild.channels.cache.get("1022285742799589416").threads.create({
interaction.member.guild.channels.cache.get(config.contactadmin.report.private.channelID).threads.create({
name: `🔒🔴 ${interaction.user.username}'s Report`,
message: {
content: `<@&${process.env.ADMIN_ID}>`,
content: `<@&${config.contactadmin.adminRoleID}>`,
embeds: [embed]
},
appliedTags: ["1022300442023186462"]
appliedTags: config.contactadmin.report.private.tags
});
});
}
Expand Down

0 comments on commit 5c18e09

Please sign in to comment.