-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db: get started with prisma (schema will need updating)
- Loading branch information
Showing
6 changed files
with
249 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ dist | |
node_modules | ||
|
||
config.ts | ||
.env |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "mongodb" | ||
url = env("DATABASE_URL") | ||
} | ||
|
||
type ClientStorageSchedules { | ||
catchUp Boolean | ||
data ClientStorageSchedulesData | ||
id String | ||
/// Could not determine type: the field only had null or empty values in the sample set. | ||
recurring Json? | ||
running Boolean | ||
taskName String | ||
time DateTime @db.Date | ||
} | ||
|
||
type ClientStorageSchedulesData { | ||
channel String? | ||
channelID String? | ||
content String | ||
user String? | ||
userID String? | ||
} | ||
|
||
type GuildsChannels { | ||
memberlog String? | ||
modlog String? | ||
reminderChannel String? | ||
serverlog String? | ||
} | ||
|
||
type GuildsLogEvents { | ||
channelCreate Boolean? | ||
channelUpdate Boolean? | ||
guildMemberAdd Boolean? | ||
guildMemberRemove Boolean? | ||
messageDelete Boolean? | ||
roleCreate Boolean? | ||
roleUpdate Boolean? | ||
} | ||
|
||
type GuildsModeration { | ||
cases GuildsModerationCases[] | ||
} | ||
|
||
type GuildsModerationCases { | ||
action String | ||
duration String | ||
moderator String | ||
number Int | ||
reason String | ||
target String | ||
task String? | ||
timestamp Float | ||
} | ||
|
||
type GuildsRoleAliases { | ||
alias String | ||
role String | ||
} | ||
|
||
type GuildsRoles { | ||
administrator String? | ||
assignable String[] | ||
deafened String? | ||
dj String? | ||
giveTrustedRoleOn String? | ||
moderator String? | ||
muted String? | ||
private String[] | ||
requireTrustedRoleForSelfAssign Boolean? | ||
restricted String[] | ||
trusted String? | ||
} | ||
|
||
type GuildsSnippets { | ||
content String | ||
embed Boolean? | ||
name String | ||
} | ||
|
||
type GuildsWordBlacklist { | ||
wordList String[] | ||
} | ||
|
||
type UsersPomodoro { | ||
currentSegment String? | ||
longBreakTime Int? | ||
running Boolean | ||
shortBreakTime Int? | ||
workRoundNumber Int | ||
workTime Int? | ||
} | ||
|
||
model clientStorage { | ||
id String @id @default(auto()) @map("_id") @db.ObjectId | ||
/// Could not determine type: the field only had null or empty values in the sample set. | ||
guildBlacklist Json? | ||
id_ String @map("id") | ||
schedules ClientStorageSchedules[] | ||
userBlacklist String[] | ||
wordBlacklist String[] | ||
} | ||
|
||
model guilds { | ||
id String @id @default(auto()) @map("_id") @db.ObjectId | ||
channels GuildsChannels? | ||
deletePinMessages Boolean? | ||
disabledCommands String[] | ||
id_ String @map("id") | ||
ignoredChannels String[] | ||
logEvents GuildsLogEvents? | ||
maxMentions Int? | ||
moderation GuildsModeration? | ||
moderationCases GuildsModerationCases[] | ||
prefix String? | ||
roleAliases GuildsRoleAliases[] | ||
roles GuildsRoles? | ||
snippets GuildsSnippets[] | ||
wordBlacklist GuildsWordBlacklist? | ||
} | ||
|
||
model users { | ||
id String @id @default(auto()) @map("_id") @db.ObjectId | ||
embedColor String? | ||
id_ String @map("id") | ||
pomodoro UsersPomodoro? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { SapphireClient } from "@sapphire/framework"; | ||
import { BotOptions, Tokens } from "#root/config"; | ||
import SteveClient from "#lib/SteveClient"; | ||
import { Tokens } from "#root/config"; | ||
|
||
import "@sapphire/plugin-i18next/register"; | ||
|
||
const steve = new SapphireClient(BotOptions); | ||
const steve = new SteveClient(); | ||
|
||
steve.login(Tokens.BotToken).catch((err) => console.error(err)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { PrismaClient } from "@prisma/client"; | ||
import { SapphireClient, container } from "@sapphire/framework"; | ||
import { GatewayIntentBits } from "discord.js"; | ||
|
||
export default class SteveClient extends SapphireClient { | ||
public constructor() { | ||
super({ | ||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages], | ||
i18n: { | ||
// eslint-disable-next-line @typescript-eslint/require-await | ||
fetchLanguage: async () => { | ||
return "en-US"; | ||
}, | ||
}, | ||
}); | ||
} | ||
|
||
public override async login(token: string) { | ||
// connect to database | ||
container.prisma = new PrismaClient(); | ||
|
||
return super.login(token); | ||
} | ||
} | ||
|
||
declare module "@sapphire/pieces" { | ||
interface Container { | ||
prisma: PrismaClient; | ||
} | ||
} |