Skip to content

Commit

Permalink
feat: custom msg per ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
flowergardn committed Jan 1, 2024
1 parent ec9c00e commit 4b6e635
Show file tree
Hide file tree
Showing 10 changed files with 867 additions and 1,365 deletions.
41 changes: 22 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# ENV
*.env
!example.env

# Typescript
dist/

# NodeJS
node_modules/
package-lock.json

#IntelliJ
.idea/

# Prisma
prisma/*
!prisma/schema.prisma

yarn-error.log
# ENV
*.env
!example.env

# Typescript
dist/

# NodeJS
node_modules/
package-lock.json

#IntelliJ
.idea/

# Prisma
prisma/*
!prisma/schema.prisma

yarn-error.log

src/constants/*
!src/constants/Colors.ts
12 changes: 6 additions & 6 deletions .prettierrc.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
useTabs = true
singleQuote = true
jsxSingleQuote = true
jsxBracketSameLine = true
trailingComma = "none"
semi = true
useTabs = true
singleQuote = true
jsxSingleQuote = true
jsxBracketSameLine = true
trailingComma = "none"
semi = true
printWidth = 100
24 changes: 12 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:18.7.0

# Run program in production
ENV NODE_ENV=production

# Set working directory and add source files
WORKDIR /app
COPY . .

# Install dependencies, then run the program
RUN yarn
ENTRYPOINT [ "yarn", "start" ]
FROM node:18.7.0

# Run program in production
ENV NODE_ENV=production

# Set working directory and add source files
WORKDIR /app
COPY . .

# Install dependencies, then run the program
RUN yarn
ENTRYPOINT [ "yarn", "start" ]
2 changes: 1 addition & 1 deletion example.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
TOKEN=
TOKEN=
LOGS_CHANNEL=
38 changes: 19 additions & 19 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
}

datasource db {
// https://www.prisma.io/docs/concepts/components/prisma-schema/data-sources
// If using docker, this requires a volume to be created in order to prevent data loss.
provider = "postgresql"
url = env("DATABASE_URL")
}

model Tickets {
id String @id
createdAt DateTime @default(now())
createdBy String
type String
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
provider = "prisma-client-js"
}

datasource db {
// https://www.prisma.io/docs/concepts/components/prisma-schema/data-sources
// If using docker, this requires a volume to be created in order to prevent data loss.
provider = "postgresql"
url = env("DATABASE_URL")
}

model Tickets {
id String @id
createdAt DateTime @default(now())
createdBy String
type String
}
6 changes: 3 additions & 3 deletions src/commands/close.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ class Close {
interaction: CommandInteraction
) {
await interaction.deferReply();

const ticket = await prisma.tickets.findUnique({
where: {
id: interaction.channelId
}
});

if (ticket == null) {
await interaction.reply({
content: 'You can only run this command inside of ticket',
ephemeral: true
await interaction.editReply({
content: 'You can only run this command inside of ticket'
});
return;
}
Expand Down
8 changes: 7 additions & 1 deletion src/commands/sendMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ interface TicketType {
title: string;
category: string;
description?: string;
message?: string;
forms: APITextInputComponent[];
}

Expand Down Expand Up @@ -126,8 +127,13 @@ class SendMenu {
.setTitle(`${type} Ticket`)
.setFields(fields);

const mention = userMention(interaction.user.id);
let messageContent = ticketInformation.message
? `${ticketInformation.message}\n${mention}`
: mention;

ticketChannel.send({
content: userMention(interaction.user.id),
content: messageContent,
embeds: [embed]
});

Expand Down
Empty file removed src/constants/embeds.toml
Empty file.
Empty file removed src/constants/tickets.toml
Empty file.
Loading

0 comments on commit 4b6e635

Please sign in to comment.