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
11 changes: 10 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build Test
on:
push:
pull_request:

permissions:
contents: read
Expand All @@ -23,6 +24,14 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies
run: pnpm install
run: pnpm install --frozen-lockfile
- name: Build
run: pnpm build
- name: Build production image
run: docker build -t quest-bot:test .
- name: Test production image
run: >
docker run --rm --entrypoint sh quest-bot:test -c
"set -e;
test -f /app/dist/index.js;
node --check /app/dist/index.js"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ RUN pnpm install --prod --frozen-lockfile

COPY --from=builder /app/dist ./dist

CMD ["sh", "-c", "pnpm prisma db push && pnpm run deploy && pnpm start"]
CMD ["sh", "-c", "pnpm prisma db push && pnpm start"]
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ An opensource modern Discord Bot built for moderation, utilities and support!
4. Install dependencies with `pnpm install`
5. Generate prisma using `pnpm prisma generate`
6. Update your local databse using `pnpm prisma db push`
7. Deploy the commands with `pnpm run deploy`
8. Run the development server with `pnpm dev`
9. The bot is now live on Discord with registered commands!
7. Run the development server with `pnpm dev`
8. The bot will register commands automatically on startup.

> [!IMPORTANT]
> When testing, add the precondition, 'DevMode' and set 'DEV' to true in your env.
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"scripts": {
"build": "rimraf dist && prisma generate && tsc",
"lint": "prettier --check . && eslint --ext .ts --format=pretty src",
"deploy": "node --env-file-if-exists=.env dist/util/deploy.js",
"format": "prettier --write . && eslint --ext .ts --fix --format=pretty src",
"predev": "pnpm build",
"start": "node --env-file-if-exists=.env dist/index.js",
Expand Down
9 changes: 6 additions & 3 deletions src/commands/utility/setupTicket.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Command } from '@sapphire/framework';
import { emojis } from '#utils/emoji.js';
import {
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
ChannelType,
MessageFlags
MessageFlags,
PermissionFlagsBits
} from 'discord.js';

export class SetupTicketCommand extends Command {
Expand All @@ -17,6 +19,7 @@ export class SetupTicketCommand extends Command {
builder
.setName('setup-ticket')
.setDescription('Post the ticket panel in a channel.')
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
.addChannelOption((option) =>
option
.setName('channel')
Expand All @@ -38,12 +41,12 @@ export class SetupTicketCommand extends Command {
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button);

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

await interaction.reply({
content: `Ticket panel sent in ${channel}.`,
content: `${emojis.rightArrow2} Ticket panel sent in ${channel}.`,
flags: MessageFlags.Ephemeral
});
}
Expand Down
7 changes: 4 additions & 3 deletions src/interaction-handlers/ticket/createTicketHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from 'discord.js';
import { TextInputBuilder, TextInputStyle, type ButtonInteraction } from 'discord.js';
import { getSettings, updateSettings } from '#lib/settings.js';
import { emojis } from '#utils/emoji.js';

export class ButtonHandler extends InteractionHandler {
public constructor(ctx: InteractionHandler.LoaderContext, options: InteractionHandler.Options) {
Expand All @@ -29,15 +30,15 @@ export class ButtonHandler extends InteractionHandler {
public async run(interaction: ButtonInteraction) {
if (!interaction.inGuild()) {
await interaction.reply({
content: 'This button can only be used in a server.',
content: `${emojis.rightArrow2} This button can only be used in a server.`,
flags: MessageFlags.Ephemeral
});
return;
}

if (!interaction.guild) {
await interaction.reply({
content: 'Failed to create ticket.',
content: `${emojis.rightArrow2} Failed to create ticket.`,
flags: MessageFlags.Ephemeral
});
return;
Expand Down Expand Up @@ -113,7 +114,7 @@ export class ButtonHandler extends InteractionHandler {
});

await modalSubmit.reply({
content: 'Created a ticket!',
content: `${emojis.rightArrow2} Created a ticket!`,
flags: MessageFlags.Ephemeral
});

Expand Down
7 changes: 4 additions & 3 deletions src/interaction-handlers/ticket/removeTicketHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { InteractionHandler, InteractionHandlerTypes } from '@sapphire/framework';
import { MessageFlags } from 'discord.js';
import type { ButtonInteraction } from 'discord.js';
import { emojis } from '#utils/emoji.js';

export class ButtonHandler extends InteractionHandler {
public constructor(ctx: InteractionHandler.LoaderContext, options: InteractionHandler.Options) {
Expand All @@ -19,15 +20,15 @@ export class ButtonHandler extends InteractionHandler {
public async run(interaction: ButtonInteraction) {
if (!interaction.inGuild()) {
await interaction.reply({
content: 'This button can only be used in a server.',
content: `${emojis.rightArrow2} This button can only be used in a server.`,
flags: MessageFlags.Ephemeral
});
return;
}

if (!interaction.guild) {
await interaction.reply({
content: 'Failed to remove ticket.',
content: `${emojis.rightArrow2} Failed to remove ticket.`,
flags: MessageFlags.Ephemeral
});
return;
Expand All @@ -37,7 +38,7 @@ export class ButtonHandler extends InteractionHandler {

if (!channel || !('deletable' in channel) || !channel.deletable) {
await interaction.reply({
content: 'I cannot delete this channel.',
content: `${emojis.rightArrow2} I cannot delete this channel.`,
flags: MessageFlags.Ephemeral
});
return;
Expand Down
Loading