Skip to content

Commit

Permalink
Update bot information
Browse files Browse the repository at this point in the history
  • Loading branch information
onepiecehung committed May 13, 2023
1 parent f6a9341 commit fd5f23e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 17 deletions.
55 changes: 39 additions & 16 deletions src/commands/slash/info.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
ChatInputCommandInteraction,
EmbedBuilder,
SlashCommandBuilder,
Expand Down Expand Up @@ -53,30 +56,50 @@ export default {
name: "Discord: ",
value: `Discord.js: 14.7.1`,
inline: true,
},
{
name: "Homepage: ",
value: `${infoBot.homepage}`,
inline: true,
},
{
name: "Bugs: ",
value: `${infoBot.bugs.url}`,
inline: true,
},
{
name: "Discussions: ",
value: `${infoBot.discussions}`,
inline: true,
}
// {
// name: "Homepage: ",
// value: `${infoBot.homepage}`,
// inline: true,
// },
// {
// name: "Bugs: ",
// value: `${infoBot.bugs.url}`,
// inline: true,
// },
// {
// name: "Discussions: ",
// value: `${infoBot.discussions}`,
// inline: true,
// }
);
break;

default:
break;
}

await reply.embed(interaction, embed);
const homepage = new ButtonBuilder()
.setLabel("Homepage")
.setURL(`${process.env.URL_HOMEPAGE}`)
.setStyle(ButtonStyle.Link);

const discussions = new ButtonBuilder()
.setLabel("Discussions")
.setURL(`${process.env.URL_DISCUSSIONS}`)
.setStyle(ButtonStyle.Link);

const reportBug = new ButtonBuilder()
.setLabel("Report bug")
.setURL(`${process.env.URL_REPORT_BUG}`)
.setStyle(ButtonStyle.Link);

const row = new ActionRowBuilder().addComponents(
homepage,
discussions,
reportBug
);
await reply.embedButtons(interaction, embed, row);
return;
},
};
Expand Down
20 changes: 19 additions & 1 deletion src/util/decorator/reply.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { CommandInteraction, EmbedBuilder } from "discord.js";
import {
CommandInteraction,
EmbedBuilder,
ActionRowComponent,
} from "discord.js";

import { FOOTER } from "../config/index";

Expand All @@ -19,6 +23,20 @@ class Reply {
return interaction.reply({ embeds: [embed] });
}

async embedButtons(
interaction: CommandInteraction,
embed: EmbedBuilder,
row: any
) {
if (!embed.data.footer) {
embed.setFooter({
text: FOOTER.text,
iconURL: FOOTER.icon,
});
}
return interaction.reply({ embeds: [embed], components: [row] });
}

async embedEdit(interaction: CommandInteraction, embed: EmbedBuilder) {
if (!embed.data.footer) {
embed.setFooter({
Expand Down

0 comments on commit fd5f23e

Please sign in to comment.