vylbot-app/src/commands/501231711271780357/entry.ts
Ethan Lane 1acedfbd3d
Some checks failed
Test / build (push) Failing after 4s
WIP: Start of implementing a link-only mode
2024-10-12 13:45:41 +01:00

31 lines
No EOL
1.3 KiB
TypeScript

import { CommandInteraction, EmbedBuilder, PermissionsBitField, SlashCommandBuilder, TextChannel } from "discord.js";
import EmbedColours from "../../constants/EmbedColours";
import SettingsHelper from "../../helpers/SettingsHelper";
import { Command } from "../../type/command";
export default class Entry extends Command {
constructor() {
super();
this.CommandBuilder = new SlashCommandBuilder()
.setName('entry')
.setDescription('Sends the entry embed')
.setDefaultMemberPermissions(PermissionsBitField.Flags.ModerateMembers);
}
public override async execute(interaction: CommandInteraction) {
if (!interaction.guildId) return;
if (!interaction.channel) return;
const rulesChannelId = await SettingsHelper.GetSetting("channels.rules", interaction.guildId) || "rules";
const embed = new EmbedBuilder()
.setColor(EmbedColours.Ok)
.setTitle("Welcome")
.setDescription(`Welcome to the server! Please make sure to read the rules in the <#${rulesChannelId}> channel and type the code found there in here to proceed to the main part of the server.`);
const channel = interaction.channel as TextChannel;
await channel.send({ embeds: [ embed ]});
}
}