Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WORKDIR /app
RUN corepack enable

COPY package.json pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
COPY prisma ./prisma/
RUN pnpm install --frozen-lockfile

Expand All @@ -16,6 +17,7 @@ WORKDIR /app
RUN corepack enable

COPY package.json pnpm-lock.yaml ./
COPY pnpm-workspace.yaml ./
COPY prisma.config.ts ./
COPY prisma ./prisma/
RUN pnpm install --prod --frozen-lockfile
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Quest is capable of:
- Utilties such as reminders.
- Complete ticket system.
- Welcoming new members.
- Fun stuff such as confessions!

## Links

Expand Down
74 changes: 74 additions & 0 deletions src/commands/utility/setupConfessions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { Command } from '@sapphire/framework';
import { emojis } from '#utils/emoji.js';
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
ChannelType,
MessageFlags,
PermissionFlagsBits
} from 'discord.js';
import { updateSettings } from '#lib/settings.js';

export class SetupConfessionsCommand extends Command {
public constructor(context: Command.LoaderContext, options: Command.Options) {
super(context, { ...options });
}

public override registerApplicationCommands(registry: Command.Registry) {
registry.registerChatInputCommand((builder) =>
builder
.setName('setup-confessions')
.setDescription('Post the confession panel in a channel.')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addChannelOption((option) =>
option
.setName('panel-channel')
.setDescription('The channel where the confession panel should be posted')
.addChannelTypes(ChannelType.GuildText)
.setRequired(true)
)
.addChannelOption((option) =>
option
.setName('confession-channel')
.setDescription('The channel where confessions should be sent')
.addChannelTypes(ChannelType.GuildText)
.setRequired(true)
)
);
}

public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
if (!interaction.guild) {
await interaction.reply({
content: `${emojis.rightArrow2} This command can only be used in a server.`,
flags: MessageFlags.Ephemeral
});
return;
}

const panelChannel = interaction.options.getChannel('panel-channel', true, [ChannelType.GuildText]);
const confessionChannel = interaction.options.getChannel('confession-channel', true, [ChannelType.GuildText]);

const button = new ButtonBuilder()
.setCustomId('create-confession')
.setLabel('Create Confession')
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button);

await panelChannel.send({
content: `**Create a confession by clicking the button below!**`,
components: [row]
});

await updateSettings(interaction.guild.id, interaction.guild.name, {
confessionChannelId: confessionChannel.id
});

await interaction.reply({
content: `${emojis.rightArrow2} Confession panel sent in ${panelChannel}. Confessions will be posted in ${confessionChannel}.`,
flags: MessageFlags.Ephemeral
});
}
}
Loading