Suggestions and guide now work in DMs. Invite no longer has the bot scope (no longer required by discord)
diff --git a/src/commands/nucleus/guide.ts b/src/commands/nucleus/guide.ts
index c95e78c..8c32ef6 100644
--- a/src/commands/nucleus/guide.ts
+++ b/src/commands/nucleus/guide.ts
@@ -6,7 +6,7 @@
builder.setName("guide").setDescription("Shows the welcome guide for the bot");
const callback = async (interaction: CommandInteraction) => {
- await guide(interaction.guild!, interaction);
+ await guide(interaction.guild, interaction);
};
export { command };
diff --git a/src/commands/nucleus/invite.ts b/src/commands/nucleus/invite.ts
index 0307c68..561de03 100644
--- a/src/commands/nucleus/invite.ts
+++ b/src/commands/nucleus/invite.ts
@@ -23,7 +23,7 @@
.setURL(
`https://discord.com/api/oauth2/authorize?client_id=${
client.user!.id
- }&permissions=407900777662&scope=bot%20applications.commands`
+ }&permissions=407900777662&scope=applications.commands`
)
])
],
diff --git a/src/commands/nucleus/suggest.ts b/src/commands/nucleus/suggest.ts
index c1f0312..f6755e2 100644
--- a/src/commands/nucleus/suggest.ts
+++ b/src/commands/nucleus/suggest.ts
@@ -19,7 +19,6 @@
builder.setName("suggest").setDescription("Sends a suggestion to the developers");
const callback = async (interaction: CommandInteraction): Promise<void> => {
- await interaction.guild?.members.fetch(interaction.member!.user.id);
await interaction.reply({ embeds: LoadingEmbed, ephemeral: true });
let closed = false;
let suggestionTitle: string | null = null;
@@ -90,18 +89,25 @@
suggestionTitle = suggestionTitle ? suggestionTitle : `${suggestionDesc.substring(0, 70)}`;
const channel = client.channels.cache.get(config.suggestionChannel) as Discord.TextChannel;
const m = await channel.send({ embeds: LoadingEmbed });
- const issue = await client.GitHub.rest.issues.create({
- owner: "ClicksMinutePer",
- repo: "Nucleus",
- title: suggestionTitle,
- body: `Linked Suggestion in Private Developer Channel: [Message](${
- m.url
- })\n\n**Suggestion:**\n> ${suggestionDesc
- .replaceAll("@", "@<!-- -->")
- .replaceAll("/issues", "/issues<!-- -->")
- .replaceAll("/pull", "/pull<!-- -->")}\n\n`,
- labels: ["🤖 Auto", "📝 Suggestion"]
- });
+ let issueNumber: number | null = null;
+ try {
+ const issue = await client.GitHub.rest.issues.create({
+ owner: "ClicksMinutePer",
+ repo: "Nucleus",
+ title: suggestionTitle,
+ body: `Linked Suggestion in Private Developer Channel: [Message](${
+ m.url
+ })\n\n**Suggestion:**\n> ${suggestionDesc
+ .replaceAll("@", "@<!-- -->")
+ .replaceAll("/issues", "/issues<!-- -->")
+ .replaceAll("/pull", "/pull<!-- -->")}\n\n`,
+ labels: ["🤖 Auto", "📝 Suggestion"]
+ });
+ issueNumber = issue.data.number;
+ } catch (_e) {
+ console.log("Could not connect to GitHub");
+ }
+ const disabled = issueNumber ? false : true;
await m.edit({
embeds: [
new EmojiEmbed()
@@ -109,25 +115,27 @@
.setTitle(`Suggestion from ${interaction.user.tag} (${interaction.user.id})`)
.setDescription(`**Suggestion:**\n> ${suggestionDesc}\n\n`)
.setStatus("Success")
- .setFooter({ text: `${issue.data.number}` })
+ .setFooter({ text: `${issueNumber ? issueNumber : "Could not connect to GitHub"}` })
],
components: [
new Discord.ActionRowBuilder<ButtonBuilder>().addComponents(
- new ButtonBuilder().setCustomId("accept:Suggestion").setLabel("Accept").setStyle(ButtonStyle.Success),
- new ButtonBuilder().setCustomId("deny:Suggestion").setLabel("Deny").setStyle(ButtonStyle.Danger),
- new ButtonBuilder().setCustomId("close:Suggestion").setLabel("Close").setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder().setCustomId("accept:Suggestion").setLabel("Accept").setStyle(ButtonStyle.Success).setDisabled(disabled),
+ new ButtonBuilder().setCustomId("deny:Suggestion").setLabel("Deny").setStyle(ButtonStyle.Danger).setDisabled(disabled),
+ new ButtonBuilder().setCustomId("close:Suggestion").setLabel("Close").setStyle(ButtonStyle.Secondary).setDisabled(disabled),
new ButtonBuilder()
.setCustomId("implemented:Suggestion")
.setLabel("Implemented")
- .setStyle(ButtonStyle.Secondary),
+ .setStyle(ButtonStyle.Secondary)
+ .setDisabled(disabled),
new ButtonBuilder()
- .setLabel(`Open Issue #${issue.data.number}`)
+ .setLabel(`Open Issue #${issueNumber ? issueNumber : "0"}`)
.setStyle(ButtonStyle.Link)
- .setURL(`https://github.com/ClicksMinutePer/Nucleus/issues/${issue.data.number}`)
+ .setURL(`https://github.com/ClicksMinutePer/Nucleus/issues/${issueNumber}`)
+ .setDisabled(disabled)
),
new Discord.ActionRowBuilder<ButtonBuilder>().addComponents(
- new ButtonBuilder().setCustomId("lock:Suggestion").setLabel("Lock").setStyle(ButtonStyle.Danger),
- new ButtonBuilder().setCustomId("spam:Suggestion").setLabel("Mark as Spam").setStyle(ButtonStyle.Danger)
+ new ButtonBuilder().setCustomId("lock:Comment").setLabel("Lock").setStyle(ButtonStyle.Danger).setDisabled(disabled),
+ new ButtonBuilder().setCustomId("spam:Suggestion").setLabel("Mark as Spam").setStyle(ButtonStyle.Danger).setDisabled(disabled)
)
]
});