- add prisma
This commit is contained in:
parent
236477b0c3
commit
b7cc57770c
@ -12,6 +12,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.7.18",
|
||||
"@types/node-cleanup": "^2.1.2",
|
||||
"nodemon": "^2.0.20",
|
||||
"prisma": "^4.3.1",
|
||||
"ts-node": "^10.9.1",
|
||||
@ -24,6 +25,7 @@
|
||||
"@discordjs/rest": "^1.1.0",
|
||||
"@prisma/client": "^4.3.1",
|
||||
"discord.js": "^14.3.0",
|
||||
"dotenv": "^16.0.2"
|
||||
"dotenv": "^16.0.2",
|
||||
"node-cleanup": "^2.1.2"
|
||||
}
|
||||
}
|
||||
|
BIN
prisma/dev.db
BIN
prisma/dev.db
Binary file not shown.
Binary file not shown.
@ -6,13 +6,16 @@ import {
|
||||
import config from "config";
|
||||
import EventEmitter from "events";
|
||||
import DiscordService from "Services/discord.service";
|
||||
import PrismaService from "Services/prisma.service";
|
||||
|
||||
export default class DiscordController extends EventEmitter {
|
||||
private discordService!: DiscordService;
|
||||
private prismaService: PrismaService;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.discordService = new DiscordService();
|
||||
this.prismaService = new PrismaService();
|
||||
this.discordService.client.once("ready", () => {
|
||||
console.log("Listening...");
|
||||
});
|
||||
@ -46,11 +49,20 @@ export default class DiscordController extends EventEmitter {
|
||||
);
|
||||
|
||||
if (channel?.isTextBased()) {
|
||||
// send quote content as message
|
||||
channel.send(interaction.options.getString("content") || "");
|
||||
const content = interaction.options.getString("content") || "";
|
||||
|
||||
interaction.reply({
|
||||
content: "Completed! (only you see this)",
|
||||
// send quote content as message
|
||||
await this.prismaService.client.message.create({
|
||||
data: {
|
||||
content,
|
||||
userName: interaction.user.username,
|
||||
},
|
||||
});
|
||||
|
||||
await channel.send(content);
|
||||
|
||||
await interaction.reply({
|
||||
content: "Completed!",
|
||||
ephemeral: true,
|
||||
});
|
||||
return;
|
||||
|
8
src/Services/prisma.service.ts
Normal file
8
src/Services/prisma.service.ts
Normal file
@ -0,0 +1,8 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
|
||||
export default class PrismaService {
|
||||
client: PrismaClient;
|
||||
constructor() {
|
||||
this.client = new PrismaClient();
|
||||
}
|
||||
}
|
@ -121,6 +121,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e"
|
||||
integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==
|
||||
|
||||
"@types/node-cleanup@^2.1.2":
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/node-cleanup/-/node-cleanup-2.1.2.tgz#545c6909b864df699d46f53ae8d59cabdcb51665"
|
||||
integrity sha512-HTksao/sZs9nqxKD/vWOR3WxSrQsyJlBPEFFCgq9lMmhRsuQF+2p6hy+7FaCYn6lOeiDc3ywI8jDQ2bz5y6m8w==
|
||||
|
||||
"@types/node@*", "@types/node@^18.7.18":
|
||||
version "18.7.18"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.18.tgz#633184f55c322e4fb08612307c274ee6d5ed3154"
|
||||
|
Loading…
x
Reference in New Issue
Block a user