Add repo and funding link to about message (#176)
Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/vylbot-app/pulls/176
This commit is contained in:
parent
7e7167796f
commit
7c90b2ff88
4 changed files with 29 additions and 11 deletions
|
@ -1,3 +1,5 @@
|
|||
import { Emoji, MessageActionRow, MessageButton } from "discord.js";
|
||||
import { MessageButtonStyles } from "discord.js/typings/enums";
|
||||
import { ICommandContext } from "../contracts/ICommandContext";
|
||||
import PublicEmbed from "../helpers/embeds/PublicEmbed";
|
||||
import { Command } from "../type/command";
|
||||
|
@ -9,11 +11,24 @@ export default class About extends Command {
|
|||
}
|
||||
|
||||
public override async execute(context: ICommandContext) {
|
||||
const fundingLink = process.env.ABOUT_FUNDING;
|
||||
const repoLink = process.env.ABOUT_REPO;
|
||||
|
||||
const embed = new PublicEmbed(context, "About", "")
|
||||
.addField("Version", process.env.BOT_VER!)
|
||||
.addField("Author", process.env.BOT_AUTHOR!)
|
||||
.addField("Date", process.env.BOT_DATE!);
|
||||
.addField("Version", process.env.BOT_VER!, true)
|
||||
.addField("Author", process.env.BOT_AUTHOR!, true)
|
||||
.addField("Date", process.env.BOT_DATE!, true);
|
||||
|
||||
const row = new MessageActionRow();
|
||||
|
||||
if (repoLink) {
|
||||
row.addComponents(new MessageButton().setURL(repoLink).setLabel("Repo").setStyle(MessageButtonStyles.LINK));
|
||||
}
|
||||
|
||||
if (fundingLink) {
|
||||
row.addComponents(new MessageButton().setURL(fundingLink).setLabel("Funding").setStyle(MessageButtonStyles.LINK));
|
||||
}
|
||||
|
||||
await embed.SendToCurrentChannel();
|
||||
await embed.SendToCurrentChannel({ components: [row] });
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import { MessageEmbed, Permissions, TextChannel } from "discord.js";
|
||||
import { MessageEmbed, MessageOptions, Permissions, TextChannel } from "discord.js";
|
||||
import { ICommandContext } from "../../contracts/ICommandContext";
|
||||
|
||||
export default class PublicEmbed extends MessageEmbed {
|
||||
|
@ -20,7 +20,7 @@ export default class PublicEmbed extends MessageEmbed {
|
|||
}
|
||||
|
||||
// Send methods
|
||||
public async SendToCurrentChannel() {
|
||||
public async SendToCurrentChannel(options?: MessageOptions) {
|
||||
const channel = this.context.message.channel as TextChannel;
|
||||
const botMember = await this.context.message.guild?.members.fetch({ user: this.context.message.client.user! });
|
||||
|
||||
|
@ -30,6 +30,6 @@ export default class PublicEmbed extends MessageEmbed {
|
|||
|
||||
if (!permissions.has(Permissions.FLAGS.SEND_MESSAGES)) return;
|
||||
|
||||
this.context.message.channel.send({ embeds: [ this ]});
|
||||
this.context.message.channel.send({ embeds: [ this ], ...options});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue