mirror of
https://github.com/xHyroM/roles-bot.git
synced 2024-11-24 17:21:05 +01:00
chore: rewrite
This commit is contained in:
parent
ca85b8fa2c
commit
6afd498fb5
50 changed files with 3457 additions and 11519 deletions
|
@ -1,4 +0,0 @@
|
|||
dist/
|
||||
tests/
|
||||
packages/website/
|
||||
webpack.config.js
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 12
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
"tab"
|
||||
],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"single"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"prefer-const": "error",
|
||||
"@typescript-eslint/no-explicit-any": "off"
|
||||
}
|
||||
}
|
32
.github/actions/avatar-changer/index.js
vendored
32
.github/actions/avatar-changer/index.js
vendored
|
@ -1,32 +0,0 @@
|
|||
const fs = require('fs');
|
||||
const hyttpo = require('hyttpo').default;
|
||||
|
||||
const list = fs.readFileSync('./list.txt', 'utf-8').split('\n');
|
||||
let now = Number(fs.readFileSync('./now.txt', 'utf-8'));
|
||||
|
||||
(async() => {
|
||||
if (now === list.length) now = 0;
|
||||
|
||||
const url = list[now + 1];
|
||||
|
||||
const req = await hyttpo.request({
|
||||
method: 'GET',
|
||||
responseType: 'buffer',
|
||||
url
|
||||
}).catch(e => e)
|
||||
|
||||
const base64 = `data:image/png;base64,${req.data.toString('base64')}`;
|
||||
|
||||
const bot = await hyttpo.request({
|
||||
url: 'https://discord.com/api/v9/applications/745599648110215260',
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Authorization': 'Bot'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
icon: base64
|
||||
})
|
||||
}).catch(e => e)
|
||||
|
||||
console.log(bot)
|
||||
})();
|
6
.github/actions/avatar-changer/list.txt
vendored
6
.github/actions/avatar-changer/list.txt
vendored
|
@ -1,6 +0,0 @@
|
|||
https://izboxo.cz/sources/images/Bucket_of_Cod_JE2_BE2.png
|
||||
https://izboxo.cz/sources/images/Bucket_of_Axolotl_JE1_BE1.png
|
||||
https://izboxo.cz/sources/images/Bucket_of_Pufferfish_JE2_BE2.png
|
||||
https://izboxo.cz/sources/images/Bucket_of_Salmon_JE2_BE2.png
|
||||
https://izboxo.cz/sources/images/Bucket_of_Tadpole_BE1.png
|
||||
https://izboxo.cz/sources/images/Bucket_of_Tropical_Fish_JE3_BE2.png
|
1
.github/actions/avatar-changer/now.txt
vendored
1
.github/actions/avatar-changer/now.txt
vendored
|
@ -1 +0,0 @@
|
|||
0
|
BIN
.github/actions/avatar-changer/out.png
vendored
BIN
.github/actions/avatar-changer/out.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 966 B |
61
.github/actions/avatar-changer/package-lock.json
generated
vendored
61
.github/actions/avatar-changer/package-lock.json
generated
vendored
|
@ -1,61 +0,0 @@
|
|||
{
|
||||
"name": "avatar-changer",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "avatar-changer",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"hyttpo": "^0.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.14.6",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz",
|
||||
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/hyttpo": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/hyttpo/-/hyttpo-0.3.2.tgz",
|
||||
"integrity": "sha512-Y1QJlBXOZtHKhME6AEBdxPrzJrV5xcORZm/+rbHwXGlau2n2OBNAbsiIJ3eiT1ZizJClm+RmwjytDSySOXJcOg==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.x"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"follow-redirects": {
|
||||
"version": "1.14.6",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz",
|
||||
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A=="
|
||||
},
|
||||
"hyttpo": {
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/hyttpo/-/hyttpo-0.3.2.tgz",
|
||||
"integrity": "sha512-Y1QJlBXOZtHKhME6AEBdxPrzJrV5xcORZm/+rbHwXGlau2n2OBNAbsiIJ3eiT1ZizJClm+RmwjytDSySOXJcOg==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.14.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
.github/actions/avatar-changer/package.json
vendored
15
.github/actions/avatar-changer/package.json
vendored
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"name": "avatar-changer",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"hyttpo": "^0.3.2"
|
||||
}
|
||||
}
|
30
.github/workflows/pages.yml
vendored
30
.github/workflows/pages.yml
vendored
|
@ -1,30 +0,0 @@
|
|||
name: Pages Deployment
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
website:
|
||||
name: Website
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd packages/website
|
||||
npm i
|
||||
npm run build
|
||||
npm run export
|
||||
|
||||
- name: Deploy site
|
||||
uses: JamesIves/github-pages-deploy-action@4.1.4
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: packages/website/out
|
5071
package-lock.json
generated
5071
package-lock.json
generated
File diff suppressed because it is too large
Load diff
31
package.json
31
package.json
|
@ -1,25 +1,24 @@
|
|||
{
|
||||
"name": "roles-bot",
|
||||
"version": "1.0.0",
|
||||
"main": "dist/worker.production.js",
|
||||
"main": "dist/worker.mjs",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "webpack ./packages/bot",
|
||||
"dev": "cross-env NODE_ENV=development npm run build"
|
||||
"build": "node scripts/build.mjs",
|
||||
"dev": "miniflare --watch --debug --port 8787",
|
||||
"publish": "cross-env NODE_ENV=production wrangler publish"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"author": "xHyroM",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "^3.3.0",
|
||||
"@types/jest": "^27.0.3",
|
||||
"@types/service-worker-mock": "^2.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.8.1",
|
||||
"discord-api-types": "^0.25.2",
|
||||
"eslint": "^8.6.0",
|
||||
"service-worker-mock": "^2.0.5",
|
||||
"ts-loader": "^9.2.6",
|
||||
"typescript": "^4.5.4",
|
||||
"webpack": "^5.65.0",
|
||||
"webpack-cli": "^4.9.1"
|
||||
"@cloudflare/workers-types": "^3.17.0",
|
||||
"@types/jest": "^29.1.2",
|
||||
"discord-api-types": "^0.37.14",
|
||||
"esbuild": "^0.15.11",
|
||||
"eslint": "^8.25.0",
|
||||
"jest": "^29.2.0",
|
||||
"miniflare": "^2.10.0",
|
||||
"typescript": "^4.8.4"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
import { APIApplicationCommandInteraction, APIMessageComponentInteraction, APIPingInteraction, ApplicationCommandType, ComponentType, InteractionResponseType, InteractionType, MessageFlags, RouteBases, Routes } from 'discord-api-types/v9';
|
||||
import { badFormatting } from './utils/badFormatting';
|
||||
import { isJSON } from './utils/isJson';
|
||||
import { resolveButtonComponents, resolveSelectMenuComponents } from './utils/resolveComponents';
|
||||
import { respond } from './utils/respond';
|
||||
import { verify } from './utils/verify';
|
||||
|
||||
export const handleRequest = async(request: Request): Promise<Response> => {
|
||||
if (!request.headers.get('X-Signature-Ed25519') || !request.headers.get('X-Signature-Timestamp')) return Response.redirect('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
|
||||
if (!await verify(request)) return new Response('', { status: 401 });
|
||||
|
||||
const interaction = await request.json() as APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
|
||||
|
||||
if (interaction.type === InteractionType.Ping)
|
||||
return respond({
|
||||
type: InteractionResponseType.Pong
|
||||
});
|
||||
|
||||
if (interaction.type === InteractionType.ApplicationCommand && interaction.data.type === ApplicationCommandType.ChatInput && interaction.data.name === 'setup') {
|
||||
if ((Number(interaction.member?.permissions) & 0x10) !== 0x10) return respond({
|
||||
type: InteractionResponseType.ChannelMessageWithSource,
|
||||
data: {
|
||||
flags: 64,
|
||||
content: 'Required permissions: `MANAGE_ROLES`'
|
||||
}
|
||||
});
|
||||
|
||||
// @ts-expect-error No typings for value
|
||||
const json = isJSON(interaction.data.options?.[0]?.value) ? JSON.parse(interaction.data.options?.[0]?.value) : null;
|
||||
if (!json) return badFormatting();
|
||||
|
||||
const channelId = json.channel;
|
||||
let message = json.message?.toString();
|
||||
let roles = json.roles;
|
||||
|
||||
if (!channelId) return badFormatting();
|
||||
if (!message) message = '';
|
||||
if (!roles || Object.values(json.roles).filter((role: any) => role.id && role.label).length === 0 || roles.length === 0 || roles.length > 25) return badFormatting(roles.length > 25);
|
||||
|
||||
const finalComponents = json.type === "1" ? resolveButtonComponents(roles) : resolveSelectMenuComponents(roles, json.placeholder?.toString());
|
||||
|
||||
const fetched = await fetch(`${RouteBases.api}/channels/${channelId}/messages`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Authorization': `Bot ${CLIENT_TOKEN}`,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({
|
||||
content: message,
|
||||
components: finalComponents
|
||||
})
|
||||
}).catch(e => e);
|
||||
|
||||
return respond({
|
||||
type: InteractionResponseType.ChannelMessageWithSource,
|
||||
data: {
|
||||
flags: 64,
|
||||
content: fetched?.ok ? 'Done!' : 'Error, bad channel id/missing permissions/invalid emojis.'
|
||||
}
|
||||
});
|
||||
} else if (interaction.type === InteractionType.MessageComponent) {
|
||||
const roleId = interaction.data.component_type === ComponentType.Button ? interaction.data.custom_id : interaction.data.values[0];
|
||||
const url = `${RouteBases.api}${Routes.guildMemberRole(interaction.guild_id || '', interaction.member?.user.id || '', roleId)}`;
|
||||
|
||||
let method = '';
|
||||
let content = '';
|
||||
|
||||
if (!interaction?.member?.roles?.includes(roleId)) {
|
||||
content = `Gave the <@&${roleId}> role!`;
|
||||
method = 'PUT';
|
||||
} else {
|
||||
content = `Removed the <@&${roleId}> role!`;
|
||||
method = 'DELETE';
|
||||
}
|
||||
|
||||
await fetch(url, {
|
||||
method: method,
|
||||
headers: {
|
||||
'Authorization': `Bot ${CLIENT_TOKEN}`
|
||||
}
|
||||
}).catch(e => e);
|
||||
|
||||
return respond({
|
||||
type: InteractionResponseType.ChannelMessageWithSource,
|
||||
data: {
|
||||
flags: MessageFlags.Ephemeral,
|
||||
content: content,
|
||||
allowed_mentions: { parse: [] }
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return respond({
|
||||
type: InteractionResponseType.ChannelMessageWithSource,
|
||||
data: {
|
||||
flags: MessageFlags.Ephemeral,
|
||||
content: 'Beep boop, boop beep?'
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
|
@ -1,5 +0,0 @@
|
|||
import { handleRequest } from './bot';
|
||||
|
||||
addEventListener('fetch', (event) => {
|
||||
event.respondWith(handleRequest(event.request));
|
||||
});
|
2
packages/bot/types.d.ts
vendored
2
packages/bot/types.d.ts
vendored
|
@ -1,2 +0,0 @@
|
|||
declare const CLIENT_PUBLIC_KEY: string;
|
||||
declare const CLIENT_TOKEN: string;
|
|
@ -1,12 +0,0 @@
|
|||
import { InteractionResponseType } from 'discord-api-types/v9';
|
||||
import { respond } from './respond';
|
||||
|
||||
export const badFormatting = (rolesMax?: boolean) => {
|
||||
return respond({
|
||||
type: InteractionResponseType.ChannelMessageWithSource,
|
||||
data: {
|
||||
flags: 64,
|
||||
content: `${rolesMax ? 'You can have maximum 25 buttons. (5x5)' : 'Bad formatting, generate [here](https://xhyrom.github.io/roles-bot)'}`
|
||||
}
|
||||
});
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
export const isJSON = (data: any): boolean => {
|
||||
if (typeof data !== 'string') return false;
|
||||
try {
|
||||
const result = JSON.parse(data);
|
||||
const type = result.toString();
|
||||
|
||||
return type === '[object Object]' || type === '[object Array]';
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
};
|
|
@ -1,73 +0,0 @@
|
|||
import { ButtonStyle, ComponentType, Snowflake } from 'discord-api-types/v9';
|
||||
import { resolvePartialEmoji } from './resolveEmoji';
|
||||
|
||||
interface Role {
|
||||
id: Snowflake;
|
||||
style?: ButtonStyle;
|
||||
label: string;
|
||||
description?: string;
|
||||
emoji: string | null;
|
||||
}
|
||||
|
||||
export const resolveButtonComponents = (roles: Array<Role>) => {
|
||||
roles = roles.map((r: Role) => {
|
||||
const o: any = {
|
||||
type: ComponentType.Button,
|
||||
style: r.style || ButtonStyle.Secondary,
|
||||
label: r.label,
|
||||
custom_id: r.id
|
||||
};
|
||||
|
||||
if (r.emoji) o.emoji = resolvePartialEmoji(r.emoji);
|
||||
|
||||
return o;
|
||||
});
|
||||
|
||||
let finalComponents = [];
|
||||
for (let i = 0; i <= roles.length; i += 5) {
|
||||
const row: any = {
|
||||
type: ComponentType.ActionRow,
|
||||
components: []
|
||||
};
|
||||
|
||||
const btnslice: any = roles.slice(i, i + 5);
|
||||
for (let y = 0; y < btnslice.length; y++) row.components.push(btnslice[y]);
|
||||
|
||||
finalComponents.push(row);
|
||||
}
|
||||
|
||||
finalComponents = finalComponents.filter(a => a.components.length > 0);
|
||||
return finalComponents;
|
||||
}
|
||||
|
||||
export const resolveSelectMenuComponents = (roles: Array<Role>, placeholder?: string) => {
|
||||
roles = roles.map((r: Role) => {
|
||||
const o: any = {
|
||||
label: r.label,
|
||||
value: r.id,
|
||||
description: r.description,
|
||||
};
|
||||
|
||||
if (r.emoji) o.emoji = resolvePartialEmoji(r.emoji);
|
||||
|
||||
return o;
|
||||
});
|
||||
|
||||
const actionRow = [
|
||||
{
|
||||
type: ComponentType.ActionRow,
|
||||
components: [
|
||||
{
|
||||
type: ComponentType.SelectMenu,
|
||||
custom_id: 'role_select',
|
||||
options: roles,
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
// @ts-expect-error No typings
|
||||
if (placeholder) actionRow[0].components[0].placeholder = placeholder;
|
||||
|
||||
return actionRow;
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
/**
|
||||
* https://github.com/discordjs/discord.js/blob/3c0bbac82fa9988af4a62ff00c66d149fbe6b921/packages/discord.js/src/util/Util.js#L292-L311
|
||||
*/
|
||||
|
||||
export const resolvePartialEmoji = (emoji: string) => {
|
||||
if (!emoji) return null;
|
||||
if (typeof emoji === 'string') return /^\d{17,19}$/.test(emoji) ? { id: emoji } : parseEmoji(emoji);
|
||||
const { id, name, animated } = emoji;
|
||||
if (!id && !name) return null;
|
||||
return { id, name, animated: Boolean(animated) };
|
||||
};
|
||||
|
||||
export const parseEmoji = (text: string) => {
|
||||
if (text.includes('%')) text = decodeURIComponent(text);
|
||||
if (!text.includes(':')) return { animated: false, name: text, id: null };
|
||||
|
||||
const match = text.match(/<?(?:(a):)?(\w{2,32}):(\d{17,19})?>?/);
|
||||
return match && { animated: Boolean(match[1]), name: match[2], id: match[3] ?? null };
|
||||
};
|
|
@ -1,3 +0,0 @@
|
|||
import { APIInteractionResponse } from 'discord-api-types/v9';
|
||||
|
||||
export const respond = (response: APIInteractionResponse) => new Response(JSON.stringify(response), {headers: {'content-type': 'application/json'}});
|
|
@ -1,37 +0,0 @@
|
|||
// from https://github.com/advaith1/activities/blob/main/src/verify.ts
|
||||
|
||||
'use strict';
|
||||
|
||||
function hex2bin(hex: string) {
|
||||
const buf = new Uint8Array(Math.ceil(hex.length / 2));
|
||||
for (let i = 0; i < buf.length; i++) {
|
||||
buf[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
const PUBLIC_KEY = crypto.subtle.importKey(
|
||||
'raw',
|
||||
hex2bin(CLIENT_PUBLIC_KEY || ''),
|
||||
{
|
||||
name: 'NODE-ED25519',
|
||||
namedCurve: 'NODE-ED25519',
|
||||
},
|
||||
true,
|
||||
['verify'],
|
||||
);
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
export async function verify(request: Request) {
|
||||
const signature = hex2bin(request.headers.get('X-Signature-Ed25519') || '');
|
||||
const timestamp = request.headers.get('X-Signature-Timestamp');
|
||||
const unknown = await request.clone().text();
|
||||
|
||||
return await crypto.subtle.verify(
|
||||
'NODE-ED25519',
|
||||
await PUBLIC_KEY,
|
||||
signature,
|
||||
encoder.encode(timestamp + unknown),
|
||||
);
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
public/script.js
|
||||
next.config.js
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"extends": "next/core-web-vitals",
|
||||
"rules": {
|
||||
"@next/next/no-sync-scripts": "off"
|
||||
}
|
||||
}
|
37
packages/website/.gitignore
vendored
37
packages/website/.gitignore
vendored
|
@ -1,37 +0,0 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
|
@ -1,34 +0,0 @@
|
|||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
|
||||
|
||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
|
||||
|
||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
5
packages/website/next-env.d.ts
vendored
5
packages/website/next-env.d.ts
vendored
|
@ -1,5 +0,0 @@
|
|||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
|
@ -1,14 +0,0 @@
|
|||
const { createSecureHeaders } = require('next-secure-headers');
|
||||
|
||||
module.exports = {
|
||||
assetPrefix: '/roles-bot/',
|
||||
async headers() {
|
||||
return [{
|
||||
source: '/(.*)',
|
||||
headers: createSecureHeaders({
|
||||
forceHTTPSRedirect: [true, { maxAge: 60 * 60 * 24 * 4, includeSubDomains: true }],
|
||||
referrerPolicy: 'same-origin',
|
||||
}),
|
||||
}];
|
||||
},
|
||||
};
|
5307
packages/website/package-lock.json
generated
5307
packages/website/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"name": "web",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"export": "next export",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "12.1.0",
|
||||
"next-secure-headers": "^2.2.0",
|
||||
"react": "17.0.2",
|
||||
"react-dom": "17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "17.0.2",
|
||||
"@types/react": "17.0.37",
|
||||
"eslint": "8.5.0",
|
||||
"eslint-config-next": "12.0.7",
|
||||
"typescript": "4.5.4"
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
import '../styles/css/style.css';
|
||||
import type { AppProps } from 'next/app';
|
||||
|
||||
export default function MyApp({ Component, pageProps }: AppProps) {
|
||||
return <Component {...pageProps} />;
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
import Head from 'next/head';
|
||||
import Script from 'next/script';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>Roles Bot</title>
|
||||
<link rel="icon" href="logo.ico" />
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css" />
|
||||
|
||||
<script src="https://kit.fontawesome.com/5acf4d9e80.js" crossOrigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script>
|
||||
</Head>
|
||||
<section className="flex-container">
|
||||
<div className="container animate__animated animate__fadeIn">
|
||||
<h1>Generate</h1>
|
||||
<form>
|
||||
<input placeholder="Your Message" name="message" id="message"/><br />
|
||||
<select placeholder="Message Type" name="type" id="type" required>
|
||||
<option value="" disabled={true}>Select a type</option>
|
||||
<option value="1">Buttons</option>
|
||||
<option value="2">Select Menu</option>
|
||||
</select><br />
|
||||
<input placeholder="Channel Id*" name="channel" id="channel" required/>
|
||||
</form>
|
||||
<button id="addRole">Add Role</button>
|
||||
<button id="buttonCopy">Copy</button>
|
||||
<pre className={'hljs language-json copy'} id="jsonPre"><code id="json" className="code"></code></pre>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<Script src="script.js"></Script>
|
||||
<Script id='hljs'>hljs.initHighlightingOnLoad();</Script>
|
||||
</div>
|
||||
);
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
import Head from 'next/head';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>Roles Bot</title>
|
||||
<link rel="icon" href="logo.ico" />
|
||||
</Head>
|
||||
|
||||
<section>
|
||||
<h1>Roles Bot Privacy Policy</h1>
|
||||
<h3>Last updated: April 10, 2022</h3>
|
||||
<hr />
|
||||
|
||||
Roles Bot does not collect any informations.
|
||||
</section>
|
||||
<br/>
|
||||
<section>
|
||||
<h1>Roles Bot Terms Of Services</h1>
|
||||
<h3>Last updated: April 10, 2022</h3>
|
||||
<hr />
|
||||
|
||||
Don't use the bot for bad intentions
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 122 KiB |
|
@ -1,78 +0,0 @@
|
|||
const json = {
|
||||
roles: [],
|
||||
type: "1",
|
||||
};
|
||||
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
|
||||
|
||||
for (const tag of ['input', 'select']) {
|
||||
$(tag).change((e) => {
|
||||
json[e.currentTarget.id] = e.currentTarget.value.replaceAll('\\n', '\n');
|
||||
|
||||
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
|
||||
});
|
||||
}
|
||||
|
||||
$('button[id=addRole]').click((e) => {
|
||||
Swal.fire({
|
||||
title: 'Add Role',
|
||||
html:
|
||||
`<input id="swal-input1" class="swal2-input" placeholder="${json.type === "1" ? 'Button' : 'Option'} Label*" required />` +
|
||||
'<input id="swal-input2" class="swal2-input" placeholder="Role Id*" required />' +
|
||||
'<input id="swal-input3" class="swal2-input" placeholder="Emoji" />' +
|
||||
`${json.type === "2" ? '<input id="swal-input4" class="swal2-input" placeholder="Option Placeholder" />' : ''} ` +
|
||||
`${json.type === "1" ? '<select id="swal-input5" class="swal2-input" style="display: flex;"><option value="" disabled="">Select a style</option><option value="1">Primary</option><option value="2">Secondary</option><option value="3">Success</option><option value="4">Danger</option></select>' : ''}`,
|
||||
preConfirm: function () {
|
||||
return new Promise(function (resolve) {
|
||||
resolve([
|
||||
$('#swal-input1').val(),
|
||||
$('#swal-input2').val(),
|
||||
$('#swal-input3').val(),
|
||||
$('#swal-input4').val(),
|
||||
$('#swal-input5').val()
|
||||
]);
|
||||
});
|
||||
}
|
||||
}).then(function (result) {
|
||||
if (result.value?.[0] && result.value?.[1]) {
|
||||
json.roles.push({
|
||||
id: result.value[1],
|
||||
label: result.value[0],
|
||||
emoji: result.value[2] || null,
|
||||
placeholder: result.value[3] || null,
|
||||
style: parseInt(result.value[4]) || 2
|
||||
});
|
||||
|
||||
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
|
||||
} else Swal.fire('Missing parameters');
|
||||
}).catch(swal.noop);
|
||||
});
|
||||
|
||||
$('pre[id=jsonPre].copy').click((e) => {
|
||||
navigator.clipboard.writeText(e?.currentTarget?.textContent || e.textContent);
|
||||
|
||||
Swal.fire({
|
||||
position: 'top-end',
|
||||
icon: 'success',
|
||||
title: 'Copied!',
|
||||
showConfirmButton: false,
|
||||
timer: 1500
|
||||
});
|
||||
});
|
||||
|
||||
$('button[id=buttonCopy]').click((e) => {
|
||||
const element = $('pre[id=jsonPre].copy')[0];
|
||||
navigator.clipboard.writeText(element?.currentTarget?.textContent || element.textContent);
|
||||
|
||||
Swal.fire({
|
||||
position: 'top-end',
|
||||
icon: 'success',
|
||||
title: 'Copied!',
|
||||
showConfirmButton: false,
|
||||
timer: 1500
|
||||
});
|
||||
});
|
||||
|
||||
$(window).on('load', () => {
|
||||
$('input').toArray().forEach((i) => i.value = '');
|
||||
document.getElementById('json').innerHTML = hljs.highlight(JSON.stringify(json), { language: 'json' }).value;
|
||||
});
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -1,168 +0,0 @@
|
|||
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,500;0,600;0,800;1,300;1,600;1,700&display=swap");
|
||||
html {
|
||||
font-size: 100%;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
-webkit-box-sizing: inherit;
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
line-height: 1.3;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: var(--darkmode);
|
||||
color: white;
|
||||
}
|
||||
|
||||
:root {
|
||||
--hyro: #eeee32;
|
||||
--yellow: #ead800;
|
||||
--yellow-dark: #d8a603;
|
||||
--darkmode: #151515;
|
||||
--codeblock: #242424;
|
||||
}
|
||||
|
||||
.flex-container {
|
||||
height: 100vh;
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: #0e0e0e;
|
||||
-webkit-filter: drop-shadow(0 0 0.75rem #0e0e0e);
|
||||
filter: drop-shadow(0 0 0.75rem #0e0e0e);
|
||||
display: -webkit-box;
|
||||
display: -ms-flexbox;
|
||||
display: flex;
|
||||
-webkit-box-pack: center;
|
||||
-ms-flex-pack: center;
|
||||
justify-content: center;
|
||||
-webkit-box-align: center;
|
||||
-ms-flex-align: center;
|
||||
align-items: center;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
padding: 4rem 8rem;
|
||||
border-radius: 1.2rem;
|
||||
}
|
||||
|
||||
form {
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
-ms-flex-direction: column;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.container {
|
||||
padding: 1rem 1.2rem;
|
||||
border-radius: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 1rem;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: white;
|
||||
font-size: 2rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
a {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
button {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: var(--yellow);
|
||||
border-radius: .2rem;
|
||||
border-style: none;
|
||||
margin-top: .8rem;
|
||||
font-size: 1.2rem;
|
||||
padding: .2rem .8rem;
|
||||
-webkit-filter: drop-shadow(0 0 0.75rem #363636);
|
||||
filter: drop-shadow(0 0 0.75rem #363636);
|
||||
-webkit-transition: .2s;
|
||||
transition: .2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: var(--yellow-dark);
|
||||
}
|
||||
|
||||
input, select {
|
||||
color: white;
|
||||
padding: .2rem .5rem;
|
||||
background-color: var(--codeblock);
|
||||
margin-top: .3rem;
|
||||
font-size: 1.2rem;
|
||||
border-style: none;
|
||||
border-radius: .2rem;
|
||||
}
|
||||
|
||||
.code {
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.copy {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.responsive {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
max-width: 100rem;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
input, select {
|
||||
font-size: 1rem;
|
||||
}
|
||||
button {
|
||||
font-size: 1rem;
|
||||
padding: .1rem .5rem;
|
||||
}
|
||||
.code {
|
||||
max-width: 300px;
|
||||
}
|
||||
}
|
||||
/*# sourceMappingURL=style.css.map */
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"version": 3,
|
||||
"mappings": "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",
|
||||
"sources": [
|
||||
"../scss/style.scss",
|
||||
"../scss/_globals.scss",
|
||||
"../scss/_vars.scss",
|
||||
"../scss/_containers.scss",
|
||||
"../scss/_textstyle.scss",
|
||||
"../scss/_forumstyle.scss"
|
||||
],
|
||||
"names": [],
|
||||
"file": "style.css"
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
.flex-container{
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
//border-style: dashed;
|
||||
//border-color: white;
|
||||
}
|
||||
|
||||
.container {
|
||||
background-color: #0e0e0e;
|
||||
filter: drop-shadow(0 0 0.75rem #0e0e0e);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
padding: 4rem 8rem;
|
||||
border-radius: 1.2rem;
|
||||
//border-style: dashed;
|
||||
//border-color: white;
|
||||
}
|
||||
|
||||
form{
|
||||
flex-direction: column;
|
||||
//border-style: dashed;
|
||||
//border-color: white;
|
||||
}
|
||||
|
||||
@media screen and (max-width:600px) {
|
||||
.container {
|
||||
padding: 1rem 1.2rem;
|
||||
border-radius: 1.2rem;
|
||||
//border-style: dashed;
|
||||
//border-color: white;
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
button {
|
||||
background-color: var(--yellow);
|
||||
border-radius: .2rem;
|
||||
border-style: none;
|
||||
margin-top: .8rem;
|
||||
font-size: 1.2rem;
|
||||
padding: .2rem .8rem;
|
||||
filter: drop-shadow(0 0 0.75rem #363636);
|
||||
transition: .2s;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover{
|
||||
background-color: var(--yellow-dark);
|
||||
}
|
||||
}
|
||||
|
||||
input, select {
|
||||
color: white;
|
||||
padding: .2rem .5rem;
|
||||
background-color: var(--codeblock);
|
||||
margin-top: .3rem;
|
||||
font-size: 1.2rem;
|
||||
border-style: none;
|
||||
border-radius: .2rem;
|
||||
}
|
||||
|
||||
.code{
|
||||
max-width: 900px;
|
||||
}
|
||||
|
||||
.copy {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.responsive {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
max-width: 100rem;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
@media screen and (max-width:600px) {
|
||||
input, select {
|
||||
font-size: 1rem;
|
||||
}
|
||||
button {
|
||||
font-size: 1rem;
|
||||
padding: .1rem .5rem;
|
||||
}
|
||||
.code{
|
||||
max-width: 300px;
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
html {
|
||||
font-size: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: inherit;
|
||||
}
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
line-height: 1.3;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: var(--darkmode);
|
||||
color: white;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
p {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
//color: white;
|
||||
font-size: 1rem;
|
||||
font-weight: 200;
|
||||
}
|
||||
h1{
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: white;
|
||||
font-size: 2rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
a{
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
}
|
||||
button {
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
text-decoration: none;
|
||||
font-weight: 400;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
:root {
|
||||
--hyro: #eeee32;
|
||||
--yellow: #ead800;
|
||||
--yellow-dark: #d8a603;
|
||||
--darkmode: #151515;
|
||||
--codeblock: #242424;
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
@import "globals";
|
||||
@import "vars";
|
||||
@import "containers";
|
||||
@import "textstyle";
|
||||
@import "forumstyle";
|
||||
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,500;0,600;0,800;1,300;1,600;1,700&display=swap'); //font-family: 'Open Sans', sans-serif;
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
3390
pnpm-lock.yaml
Normal file
3390
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load diff
34
scripts/build.mjs
Normal file
34
scripts/build.mjs
Normal file
|
@ -0,0 +1,34 @@
|
|||
import esbuild from 'esbuild';
|
||||
import { rmSync, existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||
|
||||
if (existsSync(join(__dirname, '..', 'dist')))
|
||||
rmSync(join(__dirname, '..', 'dist'), { recursive: true });
|
||||
|
||||
const watch = process.argv.includes('--watch');
|
||||
const dev = process.argv.includes('--dev');
|
||||
|
||||
Promise.all([
|
||||
esbuild.build({
|
||||
bundle: true,
|
||||
logLevel: 'info',
|
||||
format: 'esm',
|
||||
mainFields: ['browser', 'module', 'main'],
|
||||
platform: 'neutral',
|
||||
target: 'es2020',
|
||||
entryPoints: ['./src/index.ts'],
|
||||
outfile: './dist/worker.mjs',
|
||||
sourcemap: dev,
|
||||
charset: 'utf8',
|
||||
minify: !dev,
|
||||
watch: watch
|
||||
})
|
||||
]).catch(err => {
|
||||
console.error('Roles Bot failed to build');
|
||||
console.error(err.message);
|
||||
}).then(() =>{
|
||||
console.log(watch ? 'Waiting for your changes...' : 'Roles Bot has been built');
|
||||
});
|
6
src/index.ts
Normal file
6
src/index.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export default {
|
||||
fetch: (request: Request) => {
|
||||
console.log(request);
|
||||
return new Response('asda');
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
module.exports = {
|
||||
'message': 'lol',
|
||||
'channel': '862700556438732851',
|
||||
'roles': [
|
||||
{'id': '777805077825060867','label':'Bots','emoji':'😦'},
|
||||
{'id':'922762668841009152','label':'Ping','emoji':'🤩'}
|
||||
]
|
||||
};
|
|
@ -1,21 +1,11 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"module": "commonjs",
|
||||
"target": "esnext",
|
||||
"lib": ["esnext"],
|
||||
"alwaysStrict": true,
|
||||
"strict": true,
|
||||
"preserveConstEnums": true,
|
||||
"moduleResolution": "node",
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"types": [
|
||||
"@cloudflare/workers-types",
|
||||
"@types/jest",
|
||||
"@types/service-worker-mock"
|
||||
]
|
||||
},
|
||||
"include": ["src", "packages/bot"],
|
||||
"exclude": ["node_modules", "dist", "test"]
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"lib": ["esnext", "webworker"],
|
||||
"strict": true,
|
||||
"moduleResolution": "node",
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"types": ["@cloudflare/workers-types", "jest"]
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
const path = require('path');
|
||||
|
||||
const mode = process.env.NODE_ENV || 'production';
|
||||
|
||||
module.exports = {
|
||||
output: {
|
||||
filename: `worker.${mode}.js`,
|
||||
path: path.join(__dirname, 'dist'),
|
||||
},
|
||||
mode,
|
||||
resolve: {
|
||||
extensions: ['.ts', '.tsx', '.js'],
|
||||
plugins: [],
|
||||
fallback: { util: false }
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
transpileOnly: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
|
@ -2,12 +2,9 @@ name = "roles-bot"
|
|||
type = "javascript"
|
||||
account_id = ""
|
||||
workers_dev = true
|
||||
route = ""
|
||||
zone_id = ""
|
||||
webpack_config = "webpack.config.js"
|
||||
compatibility_date = "2022-04-08"
|
||||
|
||||
[build]
|
||||
command = "npm install && npm run build"
|
||||
command = "pnpm build"
|
||||
[build.upload]
|
||||
format = "service-worker"
|
||||
format = "modules"
|
||||
main = "./worker.mjs"
|
Loading…
Reference in a new issue