-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
andrewstech
committed
Oct 22, 2023
1 parent
ede779d
commit 5e5abeb
Showing
8 changed files
with
164 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
const ChooseEmail = require("./select/ChooseEmail"); | ||
const deleteDomain = require("./select/delete"); | ||
const RecordContent = require("./select/RecordContent"); | ||
module.exports = async function (interaction) { | ||
if (interaction.customId === "email") { | ||
await ChooseEmail(interaction); | ||
} | ||
if (interaction.customId === "delete") { | ||
await deleteDomain(interaction); | ||
} | ||
if (interaction.customId.startsWith("Type-")) { | ||
await RecordContent(interaction); | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const Loading = require('../../components/loading'); | ||
const { EmbedBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, StringSelectMenuBuilder } = require('discord.js'); | ||
module.exports = async function (interaction) { | ||
const Domain = interaction.customId.slice(9); | ||
console.log(Domain) | ||
await Loading(interaction, true); | ||
|
||
const embed = new EmbedBuilder() | ||
.setTitle("Choose a Record Type") | ||
.setDescription("Please choose a record type for your domain.") | ||
.setColor("#0096ff") | ||
.setFooter({ | ||
text: "If using github pages, choose CNAME.", | ||
iconURL: "https://raw.githubusercontent.com/is-a-dev/register/main/media/logo.png" | ||
}); | ||
|
||
const select = new StringSelectMenuBuilder() | ||
.setCustomId(`Type-${Domain}`) | ||
.setPlaceholder("Choose a record type") | ||
.addOptions([ | ||
{ | ||
label: "A", | ||
value: "A", | ||
}, | ||
{ | ||
label: "AAAA", | ||
value: "AAAA", | ||
}, | ||
{ | ||
label: "CNAME", | ||
value: "CNAME", | ||
}, | ||
{ | ||
label: "MX", | ||
value: "MX", | ||
}, | ||
{ | ||
label: "TXT", | ||
value: "TXT", | ||
} | ||
]); | ||
|
||
const row = new ActionRowBuilder().addComponents(select); | ||
await interaction.editReply({ | ||
embeds: [embed], | ||
components: [row] | ||
}); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
const RegisterDomain = require('./modals/RegisterDomain'); | ||
const Confirm = require('./modals/Confirm'); | ||
module.exports = async function (interaction) { | ||
if (interaction.customId === "regiserDomain") { | ||
await RegisterDomain(interaction); | ||
} | ||
if (interaction.customId.startsWith("Content-")) { | ||
await Confirm(interaction); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const Loading = require('../../components/loading'); | ||
const { EmbedBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js'); | ||
module.exports = async function (interaction) { | ||
await Loading(interaction, true); | ||
const rawdomain = interaction.customId.slice(8) | ||
const domain = rawdomain.slice(0, -3); | ||
const dtype = rawdomain.substr(-1); | ||
let type = "" | ||
switch (dtype) { | ||
//A Record | ||
case '1': | ||
type = "A" | ||
break; | ||
//AAAA Record | ||
case '2': | ||
type = "AAAA" | ||
break; | ||
//CNAME Record | ||
case '3': | ||
type = "CNAME" | ||
break; | ||
//MX Record | ||
case '4': | ||
type = "MX" | ||
break; | ||
//TXT Record | ||
case '5': | ||
type = "TXT" | ||
break; | ||
} | ||
const content = interaction.fields.getTextInputValue(`Content`) | ||
const embed = new EmbedBuilder() | ||
.setTitle('Confirm Domain') | ||
.setDescription('This is the information you have entered. Please confirm that it is correct. \n\n' + `**Domain:** ${domain}.is-a.dev \n**Type:** ${type} \n**Content:** ${content}`) | ||
.setColor('#0096ff') | ||
const confirm = new ButtonBuilder() | ||
.setCustomId(`confirm-${domain}`) | ||
.setLabel("Confirm") | ||
.setStyle(ButtonStyle.Primary); | ||
const cancel = new ButtonBuilder() | ||
.setCustomId(`cancel-${domain}`) | ||
.setLabel("Cancel") | ||
.setStyle(ButtonStyle.Primary); | ||
const row = new ActionRowBuilder().addComponents(confirm, cancel); | ||
await interaction.editReply({ | ||
components: [row], | ||
ephemeral: true, | ||
embeds: [embed] | ||
}); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const Loading = require('../../components/loading'); | ||
const { EmbedBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder } = require('discord.js'); | ||
module.exports = async function (interaction) { | ||
const type = interaction.values[0]; | ||
let typeNum = 0; | ||
switch (type) { | ||
//A Record | ||
case 'A': | ||
typeNum = 1; | ||
break; | ||
//AAAA Record | ||
case 'AAAA': | ||
typeNum = 2; | ||
break; | ||
//CNAME Record | ||
case 'CNAME': | ||
typeNum = 3; | ||
break; | ||
//MX Record | ||
case 'MX': | ||
typeNum = 4; | ||
break; | ||
//TXT Record | ||
case 'TXT': | ||
typeNum = 5; | ||
break; | ||
} | ||
|
||
const domain = interaction.customId.slice(5); | ||
const register = new ModalBuilder().setTitle('Register a Domain').setCustomId(`Content-${domain}-t${typeNum}`) | ||
const content = new TextInputBuilder() | ||
.setCustomId(`Content`) | ||
.setPlaceholder('Enter the content') | ||
.setMinLength(1) | ||
.setMaxLength(100) | ||
.setRequired(true) | ||
.setLabel('Enter the content for the record. ') | ||
.setStyle("Short"); | ||
|
||
const row = new ActionRowBuilder().addComponents(content); | ||
register.addComponents(row); | ||
await interaction.showModal(register); | ||
|
||
} |