Skip to content

Commit 944abb5

Browse files
authored
Update package and configuration files for version 2.0.0 (#69)
* Update package and configuration files for version 2.0.0 - Changed package name to @minesa-org/kaeru and updated version to 2.0.0 in package.json and package-lock.json. - Updated dependencies and devDependencies in package.json for improved functionality. - Modified tsconfig.json to target ES2022 and adjusted module resolution settings. - Added old_src/ to .gitignore and removed unnecessary files from the src directory, including index.ts and several AI command files. - Cleaned up the project structure by removing unused assets and commands. * Refactor emoji handling in announce command - Updated emoji reactions to align with new IDs and names. - Improved overall structure and readability of the announce command code.
1 parent 3c5906a commit 944abb5

File tree

97 files changed

+921
-8803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+921
-8803
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ dist/
2121
.cache/
2222

2323
# Test files
24-
test.js
24+
test.js
25+
old_src/

api/discord-oauth-callback.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { MiniDatabase } from "@minesa-org/mini-interaction";
2+
import { mini } from "./interactions.js";
3+
import { updateDiscordMetadata } from "../src/utils/database.js";
4+
5+
const database = MiniDatabase.fromEnv();
6+
const failedPage = mini.failedOAuthPage("public/pages/failed.html");
7+
8+
export default mini.discordOAuthCallback({
9+
templates: {
10+
success: mini.connectedOAuthPage("public/pages/connected.html"),
11+
missingCode: failedPage,
12+
oauthError: failedPage,
13+
invalidState: failedPage,
14+
serverError: failedPage,
15+
},
16+
async onAuthorize({ user, tokens }: { user: any; tokens: any }) {
17+
await database.set(user.id, {
18+
accessToken: tokens.access_token,
19+
refreshToken: tokens.refresh_token,
20+
expiresAt: tokens.expires_at,
21+
scope: tokens.scope,
22+
});
23+
24+
await updateDiscordMetadata(user.id, tokens.access_token);
25+
},
26+
});

api/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { mini } from "./interactions.js";
2+
3+
export default mini.discordOAuthVerificationPage({
4+
htmlFile: "index.html",
5+
});

api/interactions.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { MiniInteraction } from "@minesa-org/mini-interaction";
2+
3+
export const mini = new MiniInteraction();
4+
5+
export default mini.createNodeHandler({
6+
waitUntil: async (promise) => {
7+
try {
8+
const { waitUntil } = await import("@vercel/functions");
9+
waitUntil(promise);
10+
} catch (e) {
11+
console.log(e);
12+
}
13+
},
14+
});

index.html

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Linked Roles Redirect</title>
7+
</head>
8+
<body
9+
style="
10+
background: url(&quot;https://media.discordapp.net/attachments/736571695170584576/1226985772033249372/background.png?format=webp&quality=lossless&width=940&height=740&quot;)
11+
top left repeat;
12+
background-color: rgb(49, 48, 48);
13+
color: #cbcbcb;
14+
font-family:
15+
system-ui,
16+
-apple-system,
17+
BlinkMacSystemFont,
18+
&quot;Segoe UI&quot;,
19+
Roboto,
20+
Oxygen,
21+
Ubuntu,
22+
Cantarell,
23+
&quot;Open Sans&quot;,
24+
&quot;Helvetica Neue&quot;,
25+
sans-serif;
26+
letter-spacing: -1.2%;
27+
width: 100vw;
28+
height: 100vh;
29+
display: flex;
30+
justify-content: center;
31+
align-items: center;
32+
flex-direction: column;
33+
overflow: hidden;
34+
"
35+
>
36+
<div style="display: flex; align-items: center">
37+
<!-- Discord Logo -->
38+
<svg
39+
fill="none"
40+
height="88"
41+
viewBox="0 0 77 88"
42+
width="77"
43+
xmlns="http://www.w3.org/2000/svg"
44+
style="width: 88px; height: 88px"
45+
>
46+
<path
47+
clip-rule="evenodd"
48+
d="m65.2166 19.7044c-5.0656-2.3394-10.4047-3.9856-15.8822-4.9213-.7468 1.3552-1.4319 2.743-2.0363 4.1631-5.8278-.8716-11.7672-.8716-17.5989 0-.6198-1.4201-1.3011-2.8079-2.0479-4.1471-5.4968.9361-10.8358 2.5819-15.9015 4.9217-10.0698 14.958-12.78733 29.5608-11.420825 43.9377 5.893285 4.3727 12.483225 7.6967 19.488925 9.8266 1.5744-2.1299 2.9717-4.4048 4.165-6.7771-2.2749-.8551-4.4805-1.9038-6.5784-3.1625.5581-.4031 1.097-.8067 1.6205-1.2587 12.3409 5.8414 26.6063 5.8414 38.9511 0 .5235.436 1.0624.8556 1.6013 1.2587-2.094 1.2426-4.3035 2.3074-6.5746 3.1625 1.2087 2.3723 2.5905 4.6312 4.1611 6.7611 7.0057-2.1299 13.5958-5.4539 19.4891-9.8266h.0191c1.6013-16.6522-2.7329-31.11-11.4555-43.9381zm-39.5092 35.1085c-3.7993 0-6.9287-3.5015-6.9287-7.7612 0-4.2598 3.0524-7.7613 6.9287-7.7613 3.8762 0 6.9865 3.5015 6.9249 7.7613 0 4.2597-3.0679 7.7612-6.9249 7.7612zm25.5748 0c-3.7993 0-6.9288-3.5015-6.9288-7.7612 0-4.2598 3.0679-7.7613 6.9288-7.7613 3.857 0 6.9864 3.5015 6.9248 7.7613 0 4.2597-3.0678 7.7612-6.9248 7.7612z"
49+
fill="#fff"
50+
fill-rule="evenodd"
51+
/>
52+
</svg>
53+
54+
<!-- Plus Icon -->
55+
<svg
56+
height="28"
57+
viewBox="0 0 28 28"
58+
width="28"
59+
xmlns="http://www.w3.org/2000/svg"
60+
style="width: 28px; height: 28px; margin: 1em 37px"
61+
>
62+
<path
63+
d="m138 42h-10.008756c-1.091346 0-1.991244.8954305-1.991244 2 0 1.1122704.89151 2 1.991244 2h10.008756v10.0087557c0 1.0913468.895431 1.9912443 2 1.9912443 1.11227 0 2-.8915104 2-1.9912443v-10.0087557h10.008756c1.091346 0 1.991244-.8954305 1.991244-2 0-1.1122704-.89151-2-1.991244-2h-10.008756v-10.0087557c0-1.0913468-.895431-1.9912443-2-1.9912443-1.11227 0-2 .8915104-2 1.9912443z"
64+
fill="#949cf7"
65+
fill-rule="evenodd"
66+
transform="translate(-126 -30)"
67+
/>
68+
</svg>
69+
70+
<!-- Logo Placeholder -->
71+
<div
72+
style="
73+
width: 88px;
74+
height: 88px;
75+
border-radius: 100%;
76+
border: 3px solid #949494;
77+
border-style: dashed;
78+
background: #1d1d1d;
79+
display: flex;
80+
align-items: center;
81+
justify-content: center;
82+
"
83+
></div>
84+
</div>
85+
86+
<div style="margin-top: 16px; color: hsl(0 0% 100%); text-align: center">
87+
Redirecting to <strong>Discord</strong> to verify your linked roles
88+
</div>
89+
90+
<div style="margin-top: 16px; font-size: 16px; color: hsl(214 8.1% 61.2%); text-align: center">
91+
This only takes a moment.
92+
</div>
93+
94+
<script>
95+
const oauthUrl = "{{OAUTH_URL_RAW}}";
96+
const isPlaceholder =
97+
typeof oauthUrl !== "string" || !oauthUrl.length || oauthUrl.includes("{{");
98+
99+
if (!isPlaceholder) {
100+
window.location.replace(oauthUrl);
101+
} else {
102+
document.querySelector("div:nth-of-type(2)").innerHTML = "<strong>ERROR</strong>";
103+
}
104+
</script>
105+
</body>
106+
</html>

0 commit comments

Comments
 (0)