-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
152 additions
and
78 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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,4 @@ | ||
-- AlterTable | ||
ALTER TABLE "User" ALTER COLUMN "levelCard" SET DEFAULT 'https://cdn.mikn.dev/mikan-bg.png', | ||
ALTER COLUMN "rankColor" SET DEFAULT '#FF7700', | ||
ALTER COLUMN "mdUID" SET DEFAULT 'unlinked'; |
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,12 @@ | ||
/* | ||
Warnings: | ||
- Changed the type of `level` on the `guildLvl` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. | ||
- Changed the type of `xp` on the `guildLvl` table. No cast exists, the column would be dropped and recreated, which cannot be done if there is data, since the column is required. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "guildLvl" DROP COLUMN "level", | ||
ADD COLUMN "level" INTEGER NOT NULL, | ||
DROP COLUMN "xp", | ||
ADD COLUMN "xp" INTEGER NOT NULL; |
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,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "guildLvl" ADD COLUMN "cooldown" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; |
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 |
---|---|---|
@@ -1,24 +1,51 @@ | ||
import { Elysia } from "elysia"; | ||
import { dmUser } from ".."; | ||
|
||
const app = new Elysia(); | ||
|
||
app.post("/accLink", async ({ query, body }) => { | ||
const key = query.key | ||
const json = body | ||
const key = query.key; | ||
const json = body as { uid: string; acc: string }; | ||
|
||
const uid = json.uid | ||
const acc = json.acc | ||
const uid = json.uid; | ||
const acc = json.acc; | ||
|
||
if(!key) return { status: 400, message: "No key provided" } | ||
if(!uid) return { status: 400, message: "No uid provided" } | ||
if(!acc) return { status: 400, message: "No acc provided" } | ||
if (!key) return new Response("No key provided", { status: 400 }); | ||
if (!uid || !acc) | ||
return new Response("Missing uid or account information", { | ||
status: 400, | ||
}); | ||
|
||
if(key !== process.env.API_SIGNING_KEY) return { status: 401, message: "Invalid key" } | ||
if (key !== process.env.API_SIGNING_KEY) | ||
return new Response("Invalid key", { status: 401 }); | ||
}); | ||
|
||
}) | ||
app.post("/dm", async ({ query, body }) => { | ||
const key = query.key; | ||
const json = body as { provider: string; uid: string; message: string }; | ||
|
||
export function start () { | ||
if (!json) return new Response("No JSON body provided", { status: 400 }); | ||
|
||
const provider = json.provider; | ||
const uid = json.uid; | ||
const message = json.message; | ||
|
||
if (!key) return new Response("No key provided", { status: 400 }); | ||
if (key !== process.env.API_SIGNING_KEY) | ||
return new Response("Invalid key", { status: 401 }); | ||
if (!provider || !uid || !message) | ||
return new Response("Missing provider, uid, or message", { | ||
status: 400, | ||
}); | ||
|
||
const response = await dmUser(uid, provider, message); | ||
if (response instanceof Error) | ||
return { status: 500, message: response.message }; | ||
return new Response("Message sent", { status: 200 }); | ||
}); | ||
|
||
export function start() { | ||
app.listen(process.env.API_PORT || 3000, () => { | ||
console.log(`Server started on port ${process.env.API_PORT || 3000}`) | ||
}) | ||
} | ||
console.log(`Server started on port ${process.env.API_PORT || 3000}`); | ||
}); | ||
} |
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
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