Skip to content

Commit

Permalink
add: Added help command and big fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkkermit committed Jun 22, 2024
1 parent 8f37b04 commit 4de5921
Show file tree
Hide file tree
Showing 6 changed files with 742 additions and 81 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"torquise",
"Unboost",
"Unboosted",
"Unmutes",
"userverdata",
"verificationdata",
"verifybutton",
Expand Down
11 changes: 0 additions & 11 deletions src/commands/Community/ping.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/commands/Fun/pepeSign.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {

const signText = interaction.options.getString("text").trim();

if (filter.words.includes(text)) return interaction.reply({ content: `${client.config.filterMessage}`, ephemeral: true});
if (filter.words.includes(signText)) return interaction.reply({ content: `${client.config.filterMessage}`, ephemeral: true});

const maxLineWidth = 60;
let lines = [];
Expand Down
91 changes: 91 additions & 0 deletions src/commands/Help/help.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
const { SlashCommandBuilder, StringSelectMenuBuilder, ButtonStyle, ButtonBuilder, EmbedBuilder, ActionRowBuilder } = require('discord.js');
var timeout = [];

module.exports = {
data: new SlashCommandBuilder()
.setName('help')
.setDescription('Cannot find what you were wishing to? Check this out!')
.addSubcommand(command => command.setName('server').setDescription('Join our official support server for Orbit!'))
.addSubcommand(command => command.setName('manual').setDescription('Get some information on our bot commands and plans.')),
async execute(interaction, client) {

const sub = interaction.options.getSubcommand();

switch (sub) {
case 'server':

const button = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel('Support Server')
.setStyle(ButtonStyle.Link)
.setURL("https://discord.gg/xcMVwAVjSD")
)


const embedHelpServer = new EmbedBuilder()
.setColor(client.config.embedColor)
.setTitle(`${client.user.username} Help Center ${client.config.arrowEmoji}`)
.setFooter({ text: `🚑 ${client.user.username}'s support server`})
.setTimestamp()
.setAuthor({ name: `🚑 Help Command ${client.config.devBy}`})
.setDescription(`> Join our official support server for ${client.user.username}! \n> Get help, report bugs, and more!`)
.setThumbnail(client.user.avatarURL())
.addFields({ name: `Manual link to the Discord server:`, value: `> [SERVER](https://discord.gg/xcMVwAVjSD)`})

await interaction.reply({ embeds: [embedHelpServer], components: [button] })

break;
case 'manual':

const helprow1 = new ActionRowBuilder()
.addComponents(

new StringSelectMenuBuilder()
.setMinValues(1)
.setMaxValues(1)
.setCustomId('selecthelp')
.setPlaceholder('• Select a menu')
.addOptions(
{
label: '• Help Center',
description: 'Navigate to the Help Center.',
value: 'helpcenter',
},

{
label: '• How to add the bot',
description: `Displays how to add ${client.user.username} to your amazing server.`,
value: 'howtoaddbot'
},

{
label: '• Feedback',
description: `Displays how to contribute to the development of ${client.user.username} by giving feedback.`,
value: 'feedback'
},

{
label: '• Commands Help',
description: 'Navigate to the Commands help page.',
value: 'commands',
},
),
);

const embed = new EmbedBuilder()
.setColor(client.config.embedColor)
.setTitle(`${client.user.username} Help Center ${client.config.arrowEmoji}`)
.setAuthor({ name: `🚑 Help Command ${client.config.devBy}`})
.setFooter({ text: `🚑 ${client.user.username}'s help center`})
.setThumbnail(client.user.avatarURL())
.addFields({ name: `• Commands Help`, value: `> Get all **Commands** (**${client.commands.size}** slash & **${client.pcommands.size}** prefix) ${client.user.username} looks over!`})
.addFields({ name: "• How to add Bot", value: `> Quick guide on how to add our **${client.user.username}** \n> to your server.`})
.addFields({ name: "• Feedback", value: "> How to send us feedback and suggestions."})
.addFields({ name: "• Exclusive Functionality", value: `> Guide on how to receive permission to \n> use exclusive functionality (${client.user.username} Beta version).`})
.setTimestamp()

await interaction.reply({ embeds: [embed], components: [helprow1] });
}
}
}
69 changes: 0 additions & 69 deletions src/events/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,75 +35,6 @@ module.exports = {

console.error(`${color.red}[${getTimestamp()}] [INTERACTION_CREATE] Error while executing command. \n${color.red}[${getTimestamp()}] [INTERACTION_CREATE] Please check you are using the correct execute method: "async execute(interaction, client)":`, error);

const channelID = `${client.config.commandErrorChannel}`;
const channel = client.channels.cache.get(channelID);

const embed = new EmbedBuilder()
.setColor("Blue")
.setTimestamp()
.setAuthor({ name: `${client.user.username} Command Error`, iconURL: client.user.avatarURL()})
.setFooter({ text: 'Error Reported At' })
.setTitle('Command Execution Error')
.setDescription('An error occurred while executing the command.')
.addFields(
{ name: '> • Command', value: `\`\`\`${interaction.commandName}\`\`\`` },
{ name: '> • Triggered By', value: `\`\`\`${interaction.user.username}#${interaction.user.discriminator}\`\`\`` },
{ name: '> • Error Stack', value: `\`\`\`${error.stack}\`\`\`` },
{ name: '> • Error Message', value: `\`\`\`${error.message}\`\`\`` });

const yellowButton = new ButtonBuilder()
.setCustomId('change_color_yellow')
.setLabel('Mark As Pending')
.setStyle('1');

const greenButton = new ButtonBuilder()
.setCustomId('change_color_green')
.setLabel('Mark As Solved')
.setStyle('3');

const redButton = new ButtonBuilder()
.setCustomId('change_color_red')
.setLabel('Mark As Unsolved')
.setStyle('4');

const row = new ActionRowBuilder()
.addComponents(yellowButton, greenButton, redButton);

client.on('interactionCreate', async (interaction) => {
try {
if (!interaction.isButton()) return;
if (interaction.message.id !== message.id) return;

const { customId } = interaction;

if (customId === 'change_color_yellow') {
embed.setColor('#FFFF00');
await interaction.reply({
content: 'This error has been marked as pending.',
ephemeral: true,
});
} else if (customId === 'change_color_green') {
embed.setColor('#00FF00');
await interaction.reply({
content: 'This error has been marked as solved.',
ephemeral: true,
});
} else if (customId === 'change_color_red') {
embed.setColor('#FF0000');
await interaction.reply({
content: 'This error has been marked as unsolved.',
ephemeral: true,
});
}
await message.edit({ embeds: [embed], components: [row] });
await interaction.deferUpdate();
} catch (error) {
client.logs.error('[ERROR_LOGGING] Error in button interaction:', error);
}
});

const message = await channel.send({ embeds: [embed], components: [row] });

const errorEmbed = new EmbedBuilder()
.setColor("Red")
.setDescription(`There was an error while executing this command!\n\`\`\`${error}\`\`\``)
Expand Down
Loading

0 comments on commit 4de5921

Please sign in to comment.