Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
Joey0980 committed Jun 15, 2023
1 parent 6e352c4 commit 2af938c
Show file tree
Hide file tree
Showing 36 changed files with 948 additions and 582 deletions.
20 changes: 13 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# THIS FILE IS A TEMPLATE FOR WHICH ENV VARS ARE USED
# VALUES IN THIS FILE SHOULD NOT BE EDITED
# THIS FILE WILL BE COMMITED!
# !! THIS FILE IS A TEMPLATE FOR WHICH ENV VARS ARE USED
# !! VALUES IN THIS FILE SHOULD NOT BE EDITED
# !! THIS FILE WILL BE COMMITED!

# The Discord bot token to login with (REQUIRED)
TOKEN=

# The URL of the Postgres server to use as database
DATABASE_URL=
# The URL of the Postgres server to use as database (REQUIRED)
DATABASE_URL=""

# The bot user ID for slash command deployment
# The bot user ID for slash command deployment (REQUIRED)
CLIENT_ID=

# The server ID to deploy commands to
# The server ID to deploy commands to (Recommended for quick deployment)
GUILD_ID=

# The id of the bot owner (Not required)
OWNER_ID=

# Cooldown time in ms (set to 0 to disable)
COOLDOWN_TIME=2000
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ node_modules
/.idea
/.vscode
/.fleet

# dev files
/src/buttons/UniversalNoButton.ts
/src/commands/say.ts
/src/commands/eval.ts
62 changes: 20 additions & 42 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dispenser23",
"version": "1.0.0",
"name": "dispenser",
"version": "3.0.0",
"description": "Dispenser",
"main": "./dist/index.js",
"type": "module",
Expand All @@ -13,7 +13,7 @@
"clean": "node -e \"fs.rm('dist',{recursive:true},()=>{});\"",
"deploy": "npm run node -- --loader ts-node/esm src/deployCmds.ts",
"validate": "prisma validate",
"push": "prisma db push && prisma generate"
"push": "prisma db push"
},
"author": "Joey",
"license": "MIT",
Expand All @@ -22,16 +22,14 @@
"@types/node": "^18.11.18",
"@types/perfy": "^1.1.0",
"inquirer": "^9.1.4",
"prisma": "^4.11.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
"dependencies": {
"@discordjs/rest": "^1.6.0",
"@prisma/client": "^4.14.0",
"@prisma/client": "^4.15.0",
"discord.js": "^14.8.0",
"dotenv": "^16.0.3",
"nanospinner": "^1.1.0",
"perfy": "^1.1.5"
"prisma": "^4.15.0"
}
}
53 changes: 28 additions & 25 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,25 @@ model server {
}

model domainGroup {
groupId String @id @default(uuid())
createdAt DateTime? @default(now())
createdBy String?
updatedAt DateTime? @updatedAt
updatedBy String?
server server @relation(fields: [serverId], references: [serverId], onDelete: Cascade)
serverId String
domains domain[]
buttonEmoji String?
buttonLabel String?
buttonType BUTTON?
groupId String @id @default(uuid())
createdAt DateTime? @default(now())
createdBy String?
updatedAt DateTime? @updatedAt
updatedBy String?
server server @relation(fields: [serverId], references: [serverId], onDelete: Cascade)
serverId String
domains domain[]
buttonEmoji String?
buttonLabel String?
buttonType BUTTON?
requiredRoleId String?
@@index([serverId, groupId])
}

model domain {
domainName String @id
id String @default(uuid())
domainName String
id String @id @default(uuid())
createdAt DateTime? @default(now())
createdBy String?
updatedAt DateTime? @updatedAt
Expand All @@ -55,32 +56,34 @@ model serverSettings {
server server @relation(fields: [serverId], references: [serverId], onDelete: Cascade)
serverId String @id @unique
logsWebhookUrl String?
logsEnabled Boolean @default(false)
logsEnabled Boolean @default(false) // Implement later
reportsWebhookUrl String?
reportsEnabled Boolean @default(false)
reportsEnabled Boolean @default(false) // also implement later
usagePerUser Int @default(1)
}

model user {
userId String @id
createdAt DateTime @default(now())
userId String
id String @id @default(uuid())
createdAt DateTime? @default(now())
createdBy String?
updatedAt DateTime @updatedAt
server server @relation(fields: [serverId], references: [serverId], onDelete: Cascade)
updatedAt DateTime? @updatedAt
server server @relation(fields: [serverId], references: [serverId], onDelete: Cascade)
serverId String
usedDomains String[]
usageCount Int @default(0)
banned Boolean? @default(false)
usageCount Int @default(0)
banned Boolean? @default(false)
}

model role {
roleId String @id @unique
createdAt DateTime @default(now())
roleId String @id @unique
createdAt DateTime? @default(now())
createdBy String?
updatedAt DateTime @updatedAt
server server @relation(fields: [serverId], references: [serverId], onDelete: Cascade)
updatedAt DateTime? @updatedAt
server server @relation(fields: [serverId], references: [serverId], onDelete: Cascade)
serverId String
specialLimit Int?
adminRole Boolean? @default(false)
}

enum BUTTON {
Expand Down
8 changes: 7 additions & 1 deletion src/buttons/Config_EditUsage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Bot } from "../classes/Bot";
import {Button, Bot, CommandPermissions} from "../classes/Bot";
import { ButtonInteraction, ButtonStyle, ButtonBuilder } from "discord.js";

export default class extends Button {
Expand All @@ -17,4 +17,10 @@ export default class extends Button {
await interaction.showModal(await bot.getModal("configeditusagemdl")!.build([interaction.guild!.id]));
}

override permissions(): CommandPermissions {
return {
adminRole: true
}
}

}
8 changes: 7 additions & 1 deletion src/buttons/Config_EditWebhookUrls.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, Bot } from "../classes/Bot";
import {Button, Bot, CommandPermissions} from "../classes/Bot";
import { ButtonInteraction, ButtonStyle, ButtonBuilder } from "discord.js";

export default class extends Button {
Expand All @@ -17,4 +17,10 @@ export default class extends Button {
await interaction.showModal(await bot.getModal("configeditwebhookmdl")!.build([interaction.guild!.id]));
}

override permissions(): CommandPermissions {
return {
adminRole: true
}
}

}
Loading

0 comments on commit 2af938c

Please sign in to comment.