Merge pull request #459 from VermiumSifell/dev-2022.11.01

Dev 2022.11.01
This commit is contained in:
Axel Olausson Holtenäs 2022-10-23 19:22:26 +02:00 committed by GitHub
commit f60669b29b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 13730 additions and 1759 deletions

View file

@ -1,30 +1,30 @@
# THIS FILE SHOULD BE INSIDE OF build/
# Do not use "around your text" ("")
# Discord
DISCORD_TOKEN=""
DISCORD_CLIENT_ID=""
DISCORD_GUILD_ID=""
DISCORD_TOKEN=
DISCORD_CLIENT_ID=
DISCORD_GUILD_ID=
# Database
DATABASE_URL="file:./production.db"
DATABASE_URL=mysql://username:password@mariadb:3306/database
# Encryption
ENCRYPTION_ALGORITHM="aes-256-ctr"
ENCRYPTION_SECRET="A RANDOM STRING WITH LENGTH OF 32"
ENCRYPTION_ALGORITHM=aes-256-ctr
ENCRYPTION_SECRET=RANDOM STRING WITH STRICTLY 32 IN LENGTH
#Embed
EMBED_COLOR_SUCCESS="#22bb33"
EMBED_COLOR_WAIT="#f0ad4e"
EMBED_COLOR_ERROR="#bb2124"
EMBED_FOOTER_TEXT="https://github.com/ZynerOrg/xyter"
EMBED_FOOTER_ICON="https://github.com/ZynerOrg.png"
EMBED_COLOR_SUCCESS=#22bb33
EMBED_COLOR_WAIT=#f0ad4e
EMBED_COLOR_ERROR=#bb2124
EMBED_FOOTER_TEXT=https://github.com/ZynerOrg/xyter
EMBED_FOOTER_ICON=https://github.com/ZynerOrg.png
# Log
LOG_LEVEL="silly"
LOG_LEVEL=info
# Reputation
REPUTATION_TIMEOUT="86400"
REPUTATION_TIMEOUT=86400
# Bot Hoster
BOT_HOSTER_NAME="Zyner"
BOT_HOSTER_URL="https://xyter.zyner.org/customization/change-hoster"
BOT_HOSTER_NAME=Zyner
BOT_HOSTER_URL=https://xyter.zyner.org/customization/change-hoster

51
.github/workflows/docker-image.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: Docker Image CI
on:
schedule:
- cron: "0 10 * * *"
push:
branches:
- "**"
tags:
- "v*.*.*"
pull_request:
branches:
- "main"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
zyner/xyter
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

5
.gitignore vendored
View file

@ -1,10 +1,7 @@
json.sqlite
node_modules
.env
config.json
package-lock.json
src/config/
db/
# Build
build/

View file

@ -1,19 +1,25 @@
FROM node:19
FROM node:19 AS builder
LABEL maintainer="xyter@zyner.org"
# Create app directory
WORKDIR /app
WORKDIR /build
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./
COPY prisma ./prisma/
COPY package* .
# Install app dependencies
RUN npm install
COPY . .
RUN npx -y tsc
RUN npm run build
WORKDIR /app
FROM node:19
RUN cp -r /build/build/* .
RUN cp -r /build/node_modules .
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
CMD [ "node", "." ]
CMD [ "npm", "run", "start:migrate:prod" ]

View file

@ -1,39 +1,28 @@
version: "3"
version: "3.7"
services:
app:
image: zyner/xyter:latest
container_name: app
image: zyner/xyter:dev
restart: unless-stopped
# build: .
stdin_open: true
tty: true
env_file:
- .env
volumes:
- ./logs:/app/logs
environment:
- DISCORD_TOKEN=DISCORD_TOKEN
- DISCORD_CLIENT_ID=DISCORD_CLIENT_ID
- DISCORD_GUILD_ID=DISCORD_GUILD_ID
- MONGO_URL=mongodb://MONGO_USER:MONGO_PASS@mongodb:27017/admin?retryWrites=true&w=majority
- ENCRYPTION_ALGORITHM=ENCRYPTION_ALGORITHM
- ENCRYPTION_SECRET=ENCRYPTION_SECRET
- EMEBD_COLOR_SUCCESS=EMEBD_COLOR_SUCCESS
- EMBED_COLOR_WAIT=EMBED_COLOR_WAIT
- EMBED_COLOR_ERROR=EMBED_COLOR_ERROR
- EMBED_FOOTER_TEXT=EMBED_FOOTER_TEXT
- EMBED_FOOTER_ICON=EMBED_FOOTER_ICON
- LOG_LEVEL=LOG_LEVEL
- REPUTATION_TIMEOUT=REPUTATION_TIMEOUT
- BOT_HOSTER_NAME=BOT_HOSTER_NAME
- BOT_HOSTER_URL=BOT_HOSTER_URL
- NODE_ENV=production
depends_on:
- mongodb
- ./logs:/logs
mongodb:
image: mongo:latest
mariadb:
container_name: mariadb
image: lscr.io/linuxserver/mariadb:latest
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: MONGO_USER
MONGO_INITDB_ROOT_PASSWORD: MONGO_PASS
- PUID=1000
- PGID=1000
- TZ=Region/City
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=database
- MYSQL_USER=username
- MYSQL_PASSWORD=password
volumes:
- ./database:/data/db
- ./db:/config
ports:
- 3306:3306

13381
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -2,13 +2,16 @@
"name": "xyter",
"version": "3.1.0",
"description": "Earn credits while chatting! And more",
"main": "src/index.ts",
"main": "dist/index.js",
"scripts": {
"dev": "tsc --watch & nodemon dist",
"build": "tsc -p .",
"prisma:generate": "prisma generate",
"test": "jest",
"start": "nodemon src/index.ts",
"start": "node dist",
"start:migrate:prod": "prisma migrate deploy && npm run start",
"prettier-format": "prettier \"src/**/*.ts\" --write",
"lint": "eslint ./src --ext .ts",
"prepare": "husky install"
"lint": "eslint ./src --ext .ts"
},
"keywords": [
"Zyner",

View file

@ -1,29 +0,0 @@
-- CreateTable
CREATE TABLE "Guild" (
"id" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL
);
-- CreateTable
CREATE TABLE "GuildMember" (
"userId" TEXT NOT NULL,
"guildId" TEXT NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
-- CreateIndex
CREATE UNIQUE INDEX "User_id_key" ON "User" ("id");
-- CreateIndex
CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId");

View file

@ -1,26 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_GuildMember" (
"userId" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
CONSTRAINT "GuildMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildMember_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildMember" ("guildId", "userId")
SELECT
"guildId",
"userId"
FROM
"GuildMember";
DROP TABLE "GuildMember";
ALTER TABLE "new_GuildMember" RENAME TO "GuildMember";
CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,71 +0,0 @@
-- AlterTable
ALTER TABLE "GuildMember"
ADD COLUMN "creditsEarned" INTEGER;
ALTER TABLE "GuildMember"
ADD COLUMN "pointsEarned" INTEGER;
-- CreateTable
CREATE TABLE "GuildCounter" (
"guildId" TEXT NOT NULL,
"channelId" TEXT NOT NULL,
"word" TEXT NOT NULL,
"counter" INTEGER NOT NULL DEFAULT 0,
CONSTRAINT "GuildCounter_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE
);
INSERT INTO "new_Guild" ("id")
SELECT
"id"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
CREATE TABLE "new_User" (
"id" TEXT NOT NULL,
"reputationsEarned" INTEGER NOT NULL DEFAULT 0
);
INSERT INTO "new_User" ("id")
SELECT
"id"
FROM
"User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_id_key" ON "User" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;
-- CreateIndex
CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("guildId", "channelId");

View file

@ -1,35 +0,0 @@
/*
Warnings:
- You are about to drop the column `counter` on the `GuildCounter` table. All the data in the column will be lost.
- You are about to drop the column `word` on the `GuildCounter` table. All the data in the column will be lost.
- Added the required column `triggerWord` to the `GuildCounter` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_GuildCounter" (
"guildId" TEXT NOT NULL,
"channelId" TEXT NOT NULL,
"triggerWord" TEXT NOT NULL,
"count" INTEGER NOT NULL DEFAULT 0,
CONSTRAINT "GuildCounter_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildCounter" ("channelId", "guildId")
SELECT
"channelId",
"guildId"
FROM
"GuildCounter";
DROP TABLE "GuildCounter";
ALTER TABLE "new_GuildCounter" RENAME TO "GuildCounter";
CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("guildId", "channelId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,43 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE
);
INSERT INTO "new_Guild" ("countersEnabled", "creditsEnabled", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "id", "pointsEnabled", "pointsRate", "pointsTimeout", "reputationsEnabled")
SELECT
"countersEnabled",
"creditsEnabled",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"id",
"pointsEnabled",
"pointsRate",
"pointsTimeout",
"reputationsEnabled"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,45 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE
);
INSERT INTO "new_Guild" ("countersEnabled", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "id", "pointsEnabled", "pointsRate", "pointsTimeout", "reputationsEnabled")
SELECT
"countersEnabled",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"id",
"pointsEnabled",
"pointsRate",
"pointsTimeout",
"reputationsEnabled"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,30 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_GuildMember" (
"userId" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"creditsEarned" INTEGER NOT NULL DEFAULT 0,
"pointsEarned" INTEGER NOT NULL DEFAULT 0,
CONSTRAINT "GuildMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildMember_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildMember" ("creditsEarned", "guildId", "pointsEarned", "userId")
SELECT
coalesce("creditsEarned", 0) AS "creditsEarned",
"guildId",
coalesce("pointsEarned", 0) AS "pointsEarned",
"userId"
FROM
"GuildMember";
DROP TABLE "GuildMember";
ALTER TABLE "new_GuildMember" RENAME TO "GuildMember";
CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,13 +0,0 @@
-- CreateTable
CREATE TABLE "Cooldown" (
"guildId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"cooldown" INTEGER NOT NULL,
"timeoutId" TEXT NOT NULL,
CONSTRAINT "Cooldown_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Cooldown_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId");

View file

@ -1,155 +0,0 @@
/*
Warnings:
- Added the required column `updatedAt` to the `Guild` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `Cooldown` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `GuildCounter` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `User` table without a default value. This is not possible if the table is not empty.
- Added the required column `updatedAt` to the `GuildMember` table without a default value. This is not possible if the table is not empty.
*/
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("countersEnabled", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled")
SELECT
"countersEnabled",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
CREATE TABLE "new_Cooldown" (
"guildId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"cooldown" INTEGER NOT NULL,
"timeoutId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "Cooldown_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Cooldown_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Cooldown" ("cooldown", "guildId", "timeoutId", "userId")
SELECT
"cooldown",
"guildId",
"timeoutId",
"userId"
FROM
"Cooldown";
DROP TABLE "Cooldown";
ALTER TABLE "new_Cooldown" RENAME TO "Cooldown";
CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId");
CREATE TABLE "new_GuildCounter" (
"guildId" TEXT NOT NULL,
"channelId" TEXT NOT NULL,
"triggerWord" TEXT NOT NULL,
"count" INTEGER NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildCounter_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildCounter" ("channelId", "count", "guildId", "triggerWord")
SELECT
"channelId",
"count",
"guildId",
"triggerWord"
FROM
"GuildCounter";
DROP TABLE "GuildCounter";
ALTER TABLE "new_GuildCounter" RENAME TO "GuildCounter";
CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("guildId", "channelId");
CREATE TABLE "new_User" (
"id" TEXT NOT NULL,
"reputationsEarned" INTEGER NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_User" ("id", "reputationsEarned")
SELECT
"id",
"reputationsEarned"
FROM
"User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_id_key" ON "User" ("id");
CREATE TABLE "new_GuildMember" (
"userId" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"creditsEarned" INTEGER NOT NULL DEFAULT 0,
"pointsEarned" INTEGER NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildMember_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildMember" ("creditsEarned", "guildId", "pointsEarned", "userId")
SELECT
"creditsEarned",
"guildId",
"pointsEarned",
"userId"
FROM
"GuildMember";
DROP TABLE "GuildMember";
ALTER TABLE "new_GuildMember" RENAME TO "GuildMember";
CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,55 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33',
"embedColorWait" TEXT NOT NULL DEFAULT '#f0ad4e',
"embedColorError" TEXT NOT NULL DEFAULT '#bb2124',
"embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
"embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "updatedAt")
SELECT
"countersEnabled",
"createdAt",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled",
"updatedAt"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,12 +0,0 @@
-- AlterTable
ALTER TABLE "Guild"
ADD COLUMN "apiCpggTokenContent" TEXT;
ALTER TABLE "Guild"
ADD COLUMN "apiCpggTokenIv" TEXT;
ALTER TABLE "Guild"
ADD COLUMN "apiCpggUrlContent" TEXT;
ALTER TABLE "Guild"
ADD COLUMN "apiCpggUrlIv" TEXT;

View file

@ -1,34 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Cooldown" (
"guildId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"cooldown" TEXT NOT NULL,
"timeoutId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "Cooldown_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Cooldown_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Cooldown" ("cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId")
SELECT
"cooldown",
"createdAt",
"guildId",
"timeoutId",
"updatedAt",
"userId"
FROM
"Cooldown";
DROP TABLE "Cooldown";
ALTER TABLE "new_Cooldown" RENAME TO "Cooldown";
CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,40 +0,0 @@
/*
Warnings:
- You are about to alter the column `cooldown` on the `Cooldown` table. The data in that column could be lost. The data in that column will be cast from `String` to `Int`.
*/
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Cooldown" (
"guildId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"cooldown" INTEGER NOT NULL,
"timeoutId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "Cooldown_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Cooldown_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Cooldown" ("cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId")
SELECT
"cooldown",
"createdAt",
"guildId",
"timeoutId",
"updatedAt",
"userId"
FROM
"Cooldown";
DROP TABLE "Cooldown";
ALTER TABLE "new_Cooldown" RENAME TO "Cooldown";
CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,70 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33',
"embedColorWait" TEXT NOT NULL DEFAULT '#f0ad4e',
"embedColorError" TEXT NOT NULL DEFAULT '#bb2124',
"embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
"embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"apiCpggUrlIv" TEXT,
"apiCpggUrlContent" TEXT,
"apiCpggTokenIv" TEXT,
"apiCpggTokenContent" TEXT,
"auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"auditsChannelId" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "updatedAt")
SELECT
"apiCpggTokenContent",
"apiCpggTokenIv",
"apiCpggUrlContent",
"apiCpggUrlIv",
"countersEnabled",
"createdAt",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"embedColorError",
"embedColorSuccess",
"embedColorWait",
"embedFooterIcon",
"embedFooterText",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled",
"updatedAt"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,74 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33',
"embedColorWait" TEXT NOT NULL DEFAULT '#f0ad4e',
"embedColorError" TEXT NOT NULL DEFAULT '#bb2124',
"embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
"embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"apiCpggUrlIv" TEXT,
"apiCpggUrlContent" TEXT,
"apiCpggTokenIv" TEXT,
"apiCpggTokenContent" TEXT,
"auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"auditsChannelId" TEXT,
"shopRolesEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"shopRolesPricePerHour" INTEGER NOT NULL DEFAULT 5,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "updatedAt")
SELECT
"apiCpggTokenContent",
"apiCpggTokenIv",
"apiCpggUrlContent",
"apiCpggUrlIv",
"auditsChannelId",
"auditsEnabled",
"countersEnabled",
"createdAt",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"embedColorError",
"embedColorSuccess",
"embedColorWait",
"embedFooterIcon",
"embedFooterText",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled",
"updatedAt"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,79 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33',
"embedColorWait" TEXT NOT NULL DEFAULT '#f0ad4e',
"embedColorError" TEXT NOT NULL DEFAULT '#bb2124',
"embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
"embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"apiCpggUrlIv" TEXT,
"apiCpggUrlContent" TEXT,
"apiCpggTokenIv" TEXT,
"apiCpggTokenContent" TEXT,
"auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"auditsChannelId" TEXT,
"shopRolesEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"shopRolesPricePerHour" INTEGER NOT NULL DEFAULT 5,
"welcomeEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"welcomeJoinChannelId" TEXT,
"welcomejoinChannelMessahe" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt")
SELECT
"apiCpggTokenContent",
"apiCpggTokenIv",
"apiCpggUrlContent",
"apiCpggUrlIv",
"auditsChannelId",
"auditsEnabled",
"countersEnabled",
"createdAt",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"embedColorError",
"embedColorSuccess",
"embedColorWait",
"embedFooterIcon",
"embedFooterText",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled",
"shopRolesEnabled",
"shopRolesPricePerHour",
"updatedAt"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,89 +0,0 @@
/*
Warnings:
- You are about to drop the column `welcomejoinChannelMessahe` on the `Guild` table. All the data in the column will be lost.
*/
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33',
"embedColorWait" TEXT NOT NULL DEFAULT '#f0ad4e',
"embedColorError" TEXT NOT NULL DEFAULT '#bb2124',
"embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
"embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"apiCpggUrlIv" TEXT,
"apiCpggUrlContent" TEXT,
"apiCpggTokenIv" TEXT,
"apiCpggTokenContent" TEXT,
"auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"auditsChannelId" TEXT,
"shopRolesEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"shopRolesPricePerHour" INTEGER NOT NULL DEFAULT 5,
"welcomeEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"welcomeJoinChannelId" TEXT,
"welcomeJoinChannelMessahe" TEXT,
"welcomeLeaveChannelId" TEXT,
"welcomeLeaveChannelMessage" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId")
SELECT
"apiCpggTokenContent",
"apiCpggTokenIv",
"apiCpggUrlContent",
"apiCpggUrlIv",
"auditsChannelId",
"auditsEnabled",
"countersEnabled",
"createdAt",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"embedColorError",
"embedColorSuccess",
"embedColorWait",
"embedFooterIcon",
"embedFooterText",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled",
"shopRolesEnabled",
"shopRolesPricePerHour",
"updatedAt",
"welcomeEnabled",
"welcomeJoinChannelId"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,91 +0,0 @@
/*
Warnings:
- You are about to drop the column `welcomeJoinChannelMessahe` on the `Guild` table. All the data in the column will be lost.
*/
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33',
"embedColorWait" TEXT NOT NULL DEFAULT '#f0ad4e',
"embedColorError" TEXT NOT NULL DEFAULT '#bb2124',
"embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
"embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"apiCpggUrlIv" TEXT,
"apiCpggUrlContent" TEXT,
"apiCpggTokenIv" TEXT,
"apiCpggTokenContent" TEXT,
"auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"auditsChannelId" TEXT,
"shopRolesEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"shopRolesPricePerHour" INTEGER NOT NULL DEFAULT 5,
"welcomeEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"welcomeJoinChannelId" TEXT,
"welcomeJoinChannelMessage" TEXT,
"welcomeLeaveChannelId" TEXT,
"welcomeLeaveChannelMessage" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage")
SELECT
"apiCpggTokenContent",
"apiCpggTokenIv",
"apiCpggUrlContent",
"apiCpggUrlIv",
"auditsChannelId",
"auditsEnabled",
"countersEnabled",
"createdAt",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"embedColorError",
"embedColorSuccess",
"embedColorWait",
"embedFooterIcon",
"embedFooterText",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled",
"shopRolesEnabled",
"shopRolesPricePerHour",
"updatedAt",
"welcomeEnabled",
"welcomeJoinChannelId",
"welcomeLeaveChannelId",
"welcomeLeaveChannelMessage"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,17 +0,0 @@
-- CreateTable
CREATE TABLE "GuildShopRoles" (
"guildId" TEXT NOT NULL,
"channelId" TEXT NOT NULL,
"roleId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"pricePerHour" INTEGER NOT NULL DEFAULT 5,
"lastPayed" DATETIME NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "GuildShopRoles_guildId_channelId_key" ON "GuildShopRoles" ("guildId", "channelId");

View file

@ -1,42 +0,0 @@
/*
Warnings:
- You are about to drop the column `channelId` on the `GuildShopRoles` table. All the data in the column will be lost.
*/
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_GuildShopRoles" (
"guildId" TEXT NOT NULL,
"roleId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"pricePerHour" INTEGER NOT NULL DEFAULT 5,
"lastPayed" DATETIME NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId")
SELECT
"createdAt",
"guildId",
"lastPayed",
"pricePerHour",
"roleId",
"updatedAt",
"userId"
FROM
"GuildShopRoles";
DROP TABLE "GuildShopRoles";
ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles";
CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,39 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_GuildShopRoles" (
"guildId" TEXT NOT NULL,
"roleId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"pricePerHour" INTEGER NOT NULL DEFAULT 5,
"lastPayed" DATETIME NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_guildId_userId_fkey" FOREIGN KEY ("guildId",
"userId") REFERENCES "GuildMember" ("guildId",
"userId") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId")
SELECT
"createdAt",
"guildId",
"lastPayed",
"pricePerHour",
"roleId",
"updatedAt",
"userId"
FROM
"GuildShopRoles";
DROP TABLE "GuildShopRoles";
ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles";
CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,39 +0,0 @@
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_GuildShopRoles" (
"guildId" TEXT NOT NULL,
"roleId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"pricePerHour" INTEGER NOT NULL DEFAULT 5,
"lastPayed" DATETIME NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId",
"guildId") REFERENCES "GuildMember" ("userId",
"guildId") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId")
SELECT
"createdAt",
"guildId",
"lastPayed",
"pricePerHour",
"roleId",
"updatedAt",
"userId"
FROM
"GuildShopRoles";
DROP TABLE "GuildShopRoles";
ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles";
CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,244 +0,0 @@
/*
Warnings:
- You are about to alter the column `count` on the `GuildCounter` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `creditsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `pointsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `pricePerHour` on the `GuildShopRoles` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `cooldown` on the `Cooldown` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `creditsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `creditsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `creditsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `creditsWorkRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `creditsWorkTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `pointsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `pointsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `pointsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `shopRolesPricePerHour` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
- You are about to alter the column `reputationsEarned` on the `User` table. The data in that column could be lost. The data in that column will be cast from `Int` to `BigInt`.
*/
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_GuildCounter" (
"guildId" TEXT NOT NULL,
"channelId" TEXT NOT NULL,
"triggerWord" TEXT NOT NULL,
"count" BIGINT NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildCounter_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildCounter" ("channelId", "count", "createdAt", "guildId", "triggerWord", "updatedAt")
SELECT
"channelId",
"count",
"createdAt",
"guildId",
"triggerWord",
"updatedAt"
FROM
"GuildCounter";
DROP TABLE "GuildCounter";
ALTER TABLE "new_GuildCounter" RENAME TO "GuildCounter";
CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("guildId", "channelId");
CREATE TABLE "new_GuildMember" (
"userId" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"creditsEarned" BIGINT NOT NULL DEFAULT 0,
"pointsEarned" BIGINT NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildMember_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildMember" ("createdAt", "creditsEarned", "guildId", "pointsEarned", "updatedAt", "userId")
SELECT
"createdAt",
"creditsEarned",
"guildId",
"pointsEarned",
"updatedAt",
"userId"
FROM
"GuildMember";
DROP TABLE "GuildMember";
ALTER TABLE "new_GuildMember" RENAME TO "GuildMember";
CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId");
CREATE TABLE "new_GuildShopRoles" (
"guildId" TEXT NOT NULL,
"roleId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"pricePerHour" BIGINT NOT NULL DEFAULT 5,
"lastPayed" DATETIME NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId",
"guildId") REFERENCES "GuildMember" ("userId",
"guildId") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId")
SELECT
"createdAt",
"guildId",
"lastPayed",
"pricePerHour",
"roleId",
"updatedAt",
"userId"
FROM
"GuildShopRoles";
DROP TABLE "GuildShopRoles";
ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles";
CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId");
CREATE TABLE "new_Cooldown" (
"guildId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"cooldown" BIGINT NOT NULL,
"timeoutId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "Cooldown_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Cooldown_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Cooldown" ("cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId")
SELECT
"cooldown",
"createdAt",
"guildId",
"timeoutId",
"updatedAt",
"userId"
FROM
"Cooldown";
DROP TABLE "Cooldown";
ALTER TABLE "new_Cooldown" RENAME TO "Cooldown";
CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId");
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33',
"embedColorWait" TEXT NOT NULL DEFAULT '#f0ad4e',
"embedColorError" TEXT NOT NULL DEFAULT '#bb2124',
"embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
"embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" BIGINT NOT NULL DEFAULT 1,
"creditsTimeout" BIGINT NOT NULL DEFAULT 5,
"creditsWorkRate" BIGINT NOT NULL DEFAULT 25,
"creditsWorkTimeout" BIGINT NOT NULL DEFAULT 86400,
"creditsMinimumLength" BIGINT NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" BIGINT NOT NULL DEFAULT 1,
"pointsTimeout" BIGINT NOT NULL DEFAULT 5,
"pointsMinimumLength" BIGINT NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"apiCpggUrlIv" TEXT,
"apiCpggUrlContent" TEXT,
"apiCpggTokenIv" TEXT,
"apiCpggTokenContent" TEXT,
"auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"auditsChannelId" TEXT,
"shopRolesEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"shopRolesPricePerHour" BIGINT NOT NULL DEFAULT 5,
"welcomeEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"welcomeJoinChannelId" TEXT,
"welcomeJoinChannelMessage" TEXT,
"welcomeLeaveChannelId" TEXT,
"welcomeLeaveChannelMessage" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeJoinChannelMessage", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage")
SELECT
"apiCpggTokenContent",
"apiCpggTokenIv",
"apiCpggUrlContent",
"apiCpggUrlIv",
"auditsChannelId",
"auditsEnabled",
"countersEnabled",
"createdAt",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"embedColorError",
"embedColorSuccess",
"embedColorWait",
"embedFooterIcon",
"embedFooterText",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled",
"shopRolesEnabled",
"shopRolesPricePerHour",
"updatedAt",
"welcomeEnabled",
"welcomeJoinChannelId",
"welcomeJoinChannelMessage",
"welcomeLeaveChannelId",
"welcomeLeaveChannelMessage"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
CREATE TABLE "new_User" (
"id" TEXT NOT NULL,
"reputationsEarned" BIGINT NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_User" ("createdAt", "id", "reputationsEarned", "updatedAt")
SELECT
"createdAt",
"id",
"reputationsEarned",
"updatedAt"
FROM
"User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_id_key" ON "User" ("id");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -1,244 +0,0 @@
/*
Warnings:
- You are about to alter the column `reputationsEarned` on the `User` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `count` on the `GuildCounter` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `creditsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `pointsEarned` on the `GuildMember` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `pricePerHour` on the `GuildShopRoles` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `creditsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `creditsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `creditsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `creditsWorkRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `creditsWorkTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `pointsMinimumLength` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `pointsRate` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `pointsTimeout` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `shopRolesPricePerHour` on the `Guild` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
- You are about to alter the column `cooldown` on the `Cooldown` table. The data in that column could be lost. The data in that column will be cast from `BigInt` to `Int`.
*/
-- RedefineTables
PRAGMA foreign_keys = OFF;
CREATE TABLE "new_User" (
"id" TEXT NOT NULL,
"reputationsEarned" INTEGER NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_User" ("createdAt", "id", "reputationsEarned", "updatedAt")
SELECT
"createdAt",
"id",
"reputationsEarned",
"updatedAt"
FROM
"User";
DROP TABLE "User";
ALTER TABLE "new_User" RENAME TO "User";
CREATE UNIQUE INDEX "User_id_key" ON "User" ("id");
CREATE TABLE "new_GuildCounter" (
"guildId" TEXT NOT NULL,
"channelId" TEXT NOT NULL,
"triggerWord" TEXT NOT NULL,
"count" INTEGER NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildCounter_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildCounter" ("channelId", "count", "createdAt", "guildId", "triggerWord", "updatedAt")
SELECT
"channelId",
"count",
"createdAt",
"guildId",
"triggerWord",
"updatedAt"
FROM
"GuildCounter";
DROP TABLE "GuildCounter";
ALTER TABLE "new_GuildCounter" RENAME TO "GuildCounter";
CREATE UNIQUE INDEX "GuildCounter_guildId_channelId_key" ON "GuildCounter" ("guildId", "channelId");
CREATE TABLE "new_GuildMember" (
"userId" TEXT NOT NULL,
"guildId" TEXT NOT NULL,
"creditsEarned" INTEGER NOT NULL DEFAULT 0,
"pointsEarned" INTEGER NOT NULL DEFAULT 0,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildMember_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildMember" ("createdAt", "creditsEarned", "guildId", "pointsEarned", "updatedAt", "userId")
SELECT
"createdAt",
"creditsEarned",
"guildId",
"pointsEarned",
"updatedAt",
"userId"
FROM
"GuildMember";
DROP TABLE "GuildMember";
ALTER TABLE "new_GuildMember" RENAME TO "GuildMember";
CREATE UNIQUE INDEX "GuildMember_userId_guildId_key" ON "GuildMember" ("userId", "guildId");
CREATE TABLE "new_GuildShopRoles" (
"guildId" TEXT NOT NULL,
"roleId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"pricePerHour" INTEGER NOT NULL DEFAULT 5,
"lastPayed" DATETIME NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "GuildShopRoles_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "GuildShopRoles_userId_guildId_fkey" FOREIGN KEY ("userId",
"guildId") REFERENCES "GuildMember" ("userId",
"guildId") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_GuildShopRoles" ("createdAt", "guildId", "lastPayed", "pricePerHour", "roleId", "updatedAt", "userId")
SELECT
"createdAt",
"guildId",
"lastPayed",
"pricePerHour",
"roleId",
"updatedAt",
"userId"
FROM
"GuildShopRoles";
DROP TABLE "GuildShopRoles";
ALTER TABLE "new_GuildShopRoles" RENAME TO "GuildShopRoles";
CREATE UNIQUE INDEX "GuildShopRoles_guildId_userId_roleId_key" ON "GuildShopRoles" ("guildId", "userId", "roleId");
CREATE TABLE "new_Guild" (
"id" TEXT NOT NULL,
"embedColorSuccess" TEXT NOT NULL DEFAULT '#22bb33',
"embedColorWait" TEXT NOT NULL DEFAULT '#f0ad4e',
"embedColorError" TEXT NOT NULL DEFAULT '#bb2124',
"embedFooterText" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
"embedFooterIcon" TEXT NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
"creditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"creditsRate" INTEGER NOT NULL DEFAULT 1,
"creditsTimeout" INTEGER NOT NULL DEFAULT 5,
"creditsWorkRate" INTEGER NOT NULL DEFAULT 25,
"creditsWorkTimeout" INTEGER NOT NULL DEFAULT 86400,
"creditsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"pointsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"pointsRate" INTEGER NOT NULL DEFAULT 1,
"pointsTimeout" INTEGER NOT NULL DEFAULT 5,
"pointsMinimumLength" INTEGER NOT NULL DEFAULT 5,
"reputationsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"countersEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"apiCpggUrlIv" TEXT,
"apiCpggUrlContent" TEXT,
"apiCpggTokenIv" TEXT,
"apiCpggTokenContent" TEXT,
"auditsEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"auditsChannelId" TEXT,
"shopRolesEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"shopRolesPricePerHour" INTEGER NOT NULL DEFAULT 5,
"welcomeEnabled" BOOLEAN NOT NULL DEFAULT FALSE,
"welcomeJoinChannelId" TEXT,
"welcomeJoinChannelMessage" TEXT,
"welcomeLeaveChannelId" TEXT,
"welcomeLeaveChannelMessage" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Guild" ("apiCpggTokenContent", "apiCpggTokenIv", "apiCpggUrlContent", "apiCpggUrlIv", "auditsChannelId", "auditsEnabled", "countersEnabled", "createdAt", "creditsEnabled", "creditsMinimumLength", "creditsRate", "creditsTimeout", "creditsWorkRate", "creditsWorkTimeout", "embedColorError", "embedColorSuccess", "embedColorWait", "embedFooterIcon", "embedFooterText", "id", "pointsEnabled", "pointsMinimumLength", "pointsRate", "pointsTimeout", "reputationsEnabled", "shopRolesEnabled", "shopRolesPricePerHour", "updatedAt", "welcomeEnabled", "welcomeJoinChannelId", "welcomeJoinChannelMessage", "welcomeLeaveChannelId", "welcomeLeaveChannelMessage")
SELECT
"apiCpggTokenContent",
"apiCpggTokenIv",
"apiCpggUrlContent",
"apiCpggUrlIv",
"auditsChannelId",
"auditsEnabled",
"countersEnabled",
"createdAt",
"creditsEnabled",
"creditsMinimumLength",
"creditsRate",
"creditsTimeout",
"creditsWorkRate",
"creditsWorkTimeout",
"embedColorError",
"embedColorSuccess",
"embedColorWait",
"embedFooterIcon",
"embedFooterText",
"id",
"pointsEnabled",
"pointsMinimumLength",
"pointsRate",
"pointsTimeout",
"reputationsEnabled",
"shopRolesEnabled",
"shopRolesPricePerHour",
"updatedAt",
"welcomeEnabled",
"welcomeJoinChannelId",
"welcomeJoinChannelMessage",
"welcomeLeaveChannelId",
"welcomeLeaveChannelMessage"
FROM
"Guild";
DROP TABLE "Guild";
ALTER TABLE "new_Guild" RENAME TO "Guild";
CREATE UNIQUE INDEX "Guild_id_key" ON "Guild" ("id");
CREATE TABLE "new_Cooldown" (
"guildId" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"cooldown" INTEGER NOT NULL,
"timeoutId" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "Cooldown_guildId_fkey" FOREIGN KEY ("guildId") REFERENCES "Guild" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "Cooldown_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
INSERT INTO "new_Cooldown" ("cooldown", "createdAt", "guildId", "timeoutId", "updatedAt", "userId")
SELECT
"cooldown",
"createdAt",
"guildId",
"timeoutId",
"updatedAt",
"userId"
FROM
"Cooldown";
DROP TABLE "Cooldown";
ALTER TABLE "new_Cooldown" RENAME TO "Cooldown";
CREATE UNIQUE INDEX "Cooldown_guildId_userId_timeoutId_key" ON "Cooldown" ("guildId", "userId", "timeoutId");
PRAGMA foreign_key_check;
PRAGMA foreign_keys = ON;

View file

@ -0,0 +1,158 @@
-- CreateTable
CREATE TABLE `Guild` (
`id` VARCHAR(191) NOT NULL,
`embedColorSuccess` VARCHAR(191) NOT NULL DEFAULT '#22bb33',
`embedColorWait` VARCHAR(191) NOT NULL DEFAULT '#f0ad4e',
`embedColorError` VARCHAR(191) NOT NULL DEFAULT '#bb2124',
`embedFooterText` VARCHAR(191) NOT NULL DEFAULT 'https://github.com/ZynerOrg/xyter',
`embedFooterIcon` VARCHAR(191) NOT NULL DEFAULT 'https://github.com/ZynerOrg.png',
`creditsEnabled` BOOLEAN NOT NULL DEFAULT FALSE,
`creditsRate` INTEGER NOT NULL DEFAULT 1,
`creditsTimeout` INTEGER NOT NULL DEFAULT 5,
`creditsWorkRate` INTEGER NOT NULL DEFAULT 25,
`creditsWorkTimeout` INTEGER NOT NULL DEFAULT 86400,
`creditsMinimumLength` INTEGER NOT NULL DEFAULT 5,
`pointsEnabled` BOOLEAN NOT NULL DEFAULT FALSE,
`pointsRate` INTEGER NOT NULL DEFAULT 1,
`pointsTimeout` INTEGER NOT NULL DEFAULT 5,
`pointsMinimumLength` INTEGER NOT NULL DEFAULT 5,
`reputationsEnabled` BOOLEAN NOT NULL DEFAULT FALSE,
`countersEnabled` BOOLEAN NOT NULL DEFAULT FALSE,
`apiCpggUrlIv` VARCHAR(191) NULL,
`apiCpggUrlContent` VARCHAR(191) NULL,
`apiCpggTokenIv` VARCHAR(191) NULL,
`apiCpggTokenContent` VARCHAR(191) NULL,
`auditsEnabled` BOOLEAN NOT NULL DEFAULT FALSE,
`auditsChannelId` VARCHAR(191) NULL,
`shopRolesEnabled` BOOLEAN NOT NULL DEFAULT FALSE,
`shopRolesPricePerHour` INTEGER NOT NULL DEFAULT 5,
`welcomeEnabled` BOOLEAN NOT NULL DEFAULT FALSE,
`welcomeJoinChannelId` VARCHAR(191) NULL,
`welcomeJoinChannelMessage` VARCHAR(191) NULL,
`welcomeLeaveChannelId` VARCHAR(191) NULL,
`welcomeLeaveChannelMessage` VARCHAR(191) NULL,
`createdAt` DATETIME (3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME (3) NOT NULL,
UNIQUE INDEX `Guild_id_key` (`id`))
DEFAULT CHARACTER
SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `User` (
`id` VARCHAR(191) NOT NULL,
`reputationsEarned` INTEGER NOT NULL DEFAULT 0,
`createdAt` DATETIME (3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME (3) NOT NULL,
UNIQUE INDEX `User_id_key` (`id`))
DEFAULT CHARACTER
SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `GuildMember` (
`userId` VARCHAR(191) NOT NULL,
`guildId` VARCHAR(191) NOT NULL,
`creditsEarned` INTEGER NOT NULL DEFAULT 0,
`pointsEarned` INTEGER NOT NULL DEFAULT 0,
`createdAt` DATETIME (3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME (3) NOT NULL,
UNIQUE INDEX `GuildMember_userId_guildId_key` (`userId`, `guildId`))
DEFAULT CHARACTER
SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `GuildCounter` (
`guildId` VARCHAR(191) NOT NULL,
`channelId` VARCHAR(191) NOT NULL,
`triggerWord` VARCHAR(191) NOT NULL,
`count` INTEGER NOT NULL DEFAULT 0,
`createdAt` DATETIME (3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME (3) NOT NULL,
UNIQUE INDEX `GuildCounter_guildId_channelId_key` (`guildId`, `channelId`))
DEFAULT CHARACTER
SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `Cooldown` (
`guildId` VARCHAR(191) NOT NULL,
`userId` VARCHAR(191) NOT NULL,
`cooldown` INTEGER NOT NULL,
`timeoutId` VARCHAR(191) NOT NULL,
`createdAt` DATETIME (3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME (3) NOT NULL,
UNIQUE INDEX `Cooldown_guildId_userId_timeoutId_key` (`guildId`, `userId`, `timeoutId`))
DEFAULT CHARACTER
SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `GuildShopRoles` (
`guildId` VARCHAR(191) NOT NULL,
`roleId` VARCHAR(191) NOT NULL,
`userId` VARCHAR(191) NOT NULL,
`pricePerHour` INTEGER NOT NULL DEFAULT 5,
`lastPayed` DATETIME (3) NOT NULL,
`createdAt` DATETIME (3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME (3) NOT NULL,
UNIQUE INDEX `GuildShopRoles_guildId_userId_roleId_key` (`guildId`, `userId`, `roleId`))
DEFAULT CHARACTER
SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `GuildMember`
ADD CONSTRAINT `GuildMember_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE RESTRICT ON
UPDATE
CASCADE;
-- AddForeignKey
ALTER TABLE `GuildMember`
ADD CONSTRAINT `GuildMember_guildId_fkey` FOREIGN KEY (`guildId`) REFERENCES `Guild` (`id`) ON DELETE RESTRICT ON
UPDATE
CASCADE;
-- AddForeignKey
ALTER TABLE `GuildCounter`
ADD CONSTRAINT `GuildCounter_guildId_fkey` FOREIGN KEY (`guildId`) REFERENCES `Guild` (`id`) ON DELETE RESTRICT ON
UPDATE
CASCADE;
-- AddForeignKey
ALTER TABLE `Cooldown`
ADD CONSTRAINT `Cooldown_guildId_fkey` FOREIGN KEY (`guildId`) REFERENCES `Guild` (`id`) ON DELETE RESTRICT ON
UPDATE
CASCADE;
-- AddForeignKey
ALTER TABLE `Cooldown`
ADD CONSTRAINT `Cooldown_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE RESTRICT ON
UPDATE
CASCADE;
-- AddForeignKey
ALTER TABLE `GuildShopRoles`
ADD CONSTRAINT `GuildShopRoles_guildId_fkey` FOREIGN KEY (`guildId`) REFERENCES `Guild` (`id`) ON DELETE RESTRICT ON
UPDATE
CASCADE;
-- AddForeignKey
ALTER TABLE `GuildShopRoles`
ADD CONSTRAINT `GuildShopRoles_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE RESTRICT ON
UPDATE
CASCADE;
-- AddForeignKey
ALTER TABLE `GuildShopRoles`
ADD CONSTRAINT `GuildShopRoles_userId_guildId_fkey` FOREIGN KEY (`userId`, `guildId`) REFERENCES `GuildMember` (`userId`, `guildId`) ON DELETE RESTRICT ON
UPDATE
CASCADE;

View file

@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"
provider = "mysql"

View file

@ -7,7 +7,7 @@ generator client {
}
datasource db {
provider = "sqlite"
provider = "mysql"
url = env("DATABASE_URL")
}

View file

@ -1,22 +1,22 @@
import { SlashCommandBuilder } from "@discordjs/builders";
import { ChatInputCommandInteraction } from "discord.js";
import { ChatInputCommandInteraction, SlashCommandBuilder } from "discord.js";
// Modules
import moduleView from "./modules/view";
import { builder as ViewBuilder, execute as ViewExecute } from "./modules/view";
//
export const builder = new SlashCommandBuilder()
.setName("counters")
.setDescription("View guild counters")
.setDMPermission(false)
// Modules
.addSubcommand(moduleView.builder);
.addSubcommand(ViewBuilder);
// Execute function
export const execute = async (interaction: ChatInputCommandInteraction) => {
switch (interaction.options.getSubcommand()) {
case "view":
await moduleView.execute(interaction);
await ViewExecute(interaction);
break;
default:
throw new Error("No module found for that command.");

View file

@ -1,67 +1,63 @@
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { ChannelType } from "discord-api-types/v10";
import { ChatInputCommandInteraction, EmbedBuilder } from "discord.js";
import {
ChannelType,
ChatInputCommandInteraction,
SlashCommandSubcommandBuilder,
} from "discord.js";
import prisma from "../../../../handlers/database";
import deferReply from "../../../../handlers/deferReply";
import getEmbedConfig from "../../../../helpers/getEmbedData";
import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds";
export default {
builder: (command: SlashCommandSubcommandBuilder) => {
return command
.setName("view")
.setDescription(`View a guild counter`)
.addChannelOption((option) =>
option
.setName("channel")
.setDescription(
`The channel that contains the counter you want to view`
)
.setRequired(true)
.addChannelTypes(ChannelType.GuildText)
);
},
execute: async (interaction: ChatInputCommandInteraction) => {
await deferReply(interaction, false);
const { successColor, footerText, footerIcon } = await getEmbedConfig(
interaction.guild
// 1. Create builder function.
export const builder = (command: SlashCommandSubcommandBuilder) => {
return command
.setName("view")
.setDescription(`View a guild counter`)
.addChannelOption((option) =>
option
.setName("channel")
.setDescription(
`The channel that contains the counter you want to view`
)
.setRequired(true)
.addChannelTypes(ChannelType.GuildText)
);
const { options, guild } = interaction;
const discordChannel = options.getChannel("channel");
if (!guild) throw new Error(`Guild not found`);
if (!discordChannel) throw new Error(`Channel not found`);
const embed = new EmbedBuilder()
.setTitle("[:1234:] Counters (View)")
.setTimestamp(new Date())
.setFooter({
text: footerText,
iconURL: footerIcon,
});
const channelCounter = await prisma.guildCounter.findUnique({
where: {
guildId_channelId: {
guildId: guild.id,
channelId: discordChannel.id,
},
},
});
if (!channelCounter) throw new Error("No counter found for channel");
await interaction.editReply({
embeds: [
embed
.setDescription(
`Viewing counter for channel ${discordChannel}: ${channelCounter.count}!`
)
.setColor(successColor),
],
});
return;
},
};
// 2. Create execute function.
export const execute = async (interaction: ChatInputCommandInteraction) => {
// 1. Defer reply as permanent.
await deferReply(interaction, false);
// 2. Destructure interaction object
const { options, guild } = interaction;
if (!guild) throw new Error(`Guild not found`);
if (!options) throw new Error(`Options not found`);
// 3. Get options
const discordChannel = options.getChannel("channel");
if (!discordChannel) throw new Error(`Channel not found`);
// 4. Create base embeds.
const EmbedSuccess = await BaseEmbedSuccess(guild, "[:1234:] View");
// 5. Get counter from database.
const channelCounter = await prisma.guildCounter.findUnique({
where: {
guildId_channelId: {
guildId: guild.id,
channelId: discordChannel.id,
},
},
});
if (!channelCounter) throw new Error("No counter found for channel");
// 6. Send embed.
await interaction.editReply({
embeds: [
EmbedSuccess.setDescription(
`Viewing counter for channel ${discordChannel}: ${channelCounter.count}!`
),
],
});
};

View file

@ -5,7 +5,7 @@ import {
import deferReply from "../../../../handlers/deferReply";
import { success as BaseEmbedSuccess } from "../../../../helpers/baseEmbeds";
import transferCredits from "../../../../helpers/transferCredits";
import { transfer as CreditsTransfer } from "../../../../helpers/credits";
// 1. Export a builder function.
export const builder = (command: SlashCommandSubcommandBuilder) => {
@ -55,7 +55,7 @@ export const execute = async (interaction: ChatInputCommandInteraction) => {
const EmbedSuccess = await BaseEmbedSuccess(guild, "[:dollar:] Gift");
// 5. Start an transaction of the credits.
await transferCredits(guild, user, target, credits);
await CreditsTransfer(guild, user, target, credits);
// 6. Tell the target that they have been gifted credits.
await target.send({

View file

@ -6,7 +6,7 @@ import {
EmbedBuilder,
PermissionsBitField,
} from "discord.js";
import transferCredits from "../../../../../../helpers/transferCredits";
import { transfer as CreditsTransfer } from "../../../../../../helpers/credits";
// Configurations
import deferReply from "../../../../../../handlers/deferReply";
import checkPermission from "../../../../../../helpers/checkPermission";
@ -65,7 +65,7 @@ export default {
if (!optionToUser)
throw new Error("You must provide a user to transfer to.");
await transferCredits(guild, optionFromUser, optionToUser, optionAmount);
await CreditsTransfer(guild, optionFromUser, optionToUser, optionAmount);
return interaction?.editReply({
embeds: [

View file

@ -22,7 +22,7 @@ export default {
},
});
if (!channelCounter) throw new Error("No counters found in channel.");
if (!channelCounter) return logger.debug("No counters found in channel.");
if (
lastMessage?.author.id === author.id &&

View file

@ -20,7 +20,7 @@ export default async (message: Message) => {
},
});
if (!channelCounter) throw new Error("No counters found in channel.");
if (!channelCounter) return logger.debug("No counters found in channel.");
if (content === channelCounter.triggerWord)
return logger?.silly(

View file

@ -2,6 +2,6 @@ import fs from "fs";
const fsPromises = fs.promises;
export default async (path: string) => {
const result = await fsPromises.readdir(path);
const result = await fsPromises.readdir(`${__dirname}/../../${path}`);
return result;
};

View file

@ -1,7 +1,13 @@
import { Guild, User } from "discord.js";
import prisma from "../../handlers/database";
export default async (guild: Guild, from: User, to: User, amount: number) => {
// Start an transaction between two users in a guild.
export const transfer = async (
guild: Guild,
from: User,
to: User,
amount: number
) => {
return await prisma.$transaction(async (tx) => {
// 1. Decrement amount from the sender.
const sender = await tx.guildMember.upsert({

View file

@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es2022",
"target": "es6",
"module": "CommonJS",
"allowJs": true,
"skipLibCheck": true,
@ -11,9 +11,9 @@
"noFallthroughCasesInSwitch": true,
"moduleResolution": "node",
"isolatedModules": true,
"outDir": "./build",
"outDir": "./dist",
"rootDir": "./src",
"resolveJsonModule": true,
"baseUrl": "./src",
"typeRoots": ["/types/common", "./node_modules/@types"]
},
"include": ["./src"],