diff --git a/.env.example b/.env.example index a71ab58..61f25eb 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ DISCORD_TOKEN='YOUR_TOKEN_HERE' -DISCORD_LOGGING_CHANNEL='YOUR_CHANNEL_HERE' \ No newline at end of file +DISCORD_LOGGING_CHANNEL='YOUR_CHANNEL_HERE' +PORT=3000 \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index cd75ad5..d792f4d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,115 +1,96 @@ { - "extends": "eslint:recommended", + "$schema": "https://json.schemastore.org/eslintrc.json", "env": { - "node": true, - "es6": true + "browser": false, + "es2021": true, + "node": true }, + "extends": [ + "plugin:prettier/recommended" + ], + "plugins": [ + "unused-imports", + "import", + "@typescript-eslint", + "prettier" + ], + "parser": "@typescript-eslint/parser", "parserOptions": { - "sourceType": "module", - "ecmaVersion": "latest" + "ecmaVersion": 12, + "sourceType": "module" }, "rules": { - "arrow-spacing": [ + // "no-console": "warn", + "prettier/prettier": [ "warn", { - "before": true, - "after": true + "tabWidth": 4, + "endOfLine": "auto" } ], - "brace-style": [ - "error", - "stroustrup", + "no-unused-vars": "off", + "unused-imports/no-unused-vars": "off", + "unused-imports/no-unused-imports": "warn", + "@typescript-eslint/no-unused-vars": [ + "warn", { - "allowSingleLine": true + "args": "after-used", + "ignoreRestSiblings": false, + "argsIgnorePattern": "^_.*?$" } ], - "comma-dangle": [ - "error", - "always-multiline" - ], - "comma-spacing": "error", - "comma-style": "error", - "curly": [ - "error", - "multi-line", - "consistent" - ], - "dot-location": [ - "error", - "property" - ], - "handle-callback-err": "off", - "indent": [ - "error", - "tab" - ], - "keyword-spacing": "error", - "max-nested-callbacks": [ - "error", + "import/order": [ + "warn", { - "max": 4 + "groups": [ + "type", + "builtin", + "object", + "external", + "internal", + "parent", + "sibling", + "index" + ], + "pathGroups": [ + { + "pattern": "~/**", + "group": "external", + "position": "after" + } + ], + "newlines-between": "always" } ], - "max-statements-per-line": [ - "error", + "padding-line-between-statements": [ + "warn", { - "max": 2 - } - ], - "no-console": "off", - "no-empty-function": "error", - "no-floating-decimal": "error", - "no-inline-comments": "error", - "no-lonely-if": "error", - "no-multi-spaces": "error", - "no-multiple-empty-lines": [ - "error", + "blankLine": "always", + "prev": "*", + "next": "return" + }, { - "max": 2, - "maxEOF": 1, - "maxBOF": 0 - } - ], - "no-shadow": [ - "error", + "blankLine": "always", + "prev": [ + "const", + "let", + "var" + ], + "next": "*" + }, { - "allow": [ - "err", - "resolve", - "reject" + "blankLine": "any", + "prev": [ + "const", + "let", + "var" + ], + "next": [ + "const", + "let", + "var" ] } - ], - "no-trailing-spaces": [ - "error" - ], - "no-var": "error", - "object-curly-spacing": [ - "error", - "always" - ], - "prefer-const": "error", - "quotes": [ - "error", - "single" - ], - "semi": [ - "error", - "always" - ], - "space-before-blocks": "error", - "space-before-function-paren": [ - "error", - { - "anonymous": "never", - "named": "never", - "asyncArrow": "always" - } - ], - "space-in-parens": "error", - "space-infix-ops": "error", - "space-unary-ops": "error", - "spaced-comment": "error", - "yoda": "error" + ] } } \ No newline at end of file diff --git a/.github/workflows/bun.yml b/.github/workflows/bun.yml deleted file mode 100644 index 9e1b7b3..0000000 --- a/.github/workflows/bun.yml +++ /dev/null @@ -1,30 +0,0 @@ -# https://github.com/dependabot/dependabot-core/issues/6528#issuecomment-2013695799 - -name: 'Dependabot: Update bun.lockb' - -on: - pull_request: - paths: - - "package-lock.json" - -permissions: - contents: write - -jobs: - update-bun-lockb: - name: "Update bun.lockb" - if: github.actor == 'dependabot[bot]' - runs-on: ubuntu-latest - steps: - - uses: oven-sh/setup-bun@v1 - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} - - run: | - bun install - git add bun.lockb - git config --global user.name 'dependabot[bot]' - git config --global user.email 'dependabot[bot]@users.noreply.github.com' - git commit --amend --no-edit - git push --force \ No newline at end of file diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 1aa525b..0d68e3f 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -23,4 +23,4 @@ jobs: run: bun install - name: Run ESLint - run: bunx eslint . \ No newline at end of file + run: bun lint \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b1f221b..d6dd6da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,4 +63,3 @@ jobs: tag_name: v${{ env.NEW_VERSION }} release_name: Release ${{ env.NEW_VERSION }} draft: false - prerelease: false diff --git a/README.md b/README.md index 7599fc0..62703c7 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ [Invite it here](https://discord.com/oauth2/authorize?client_id=1241739031252045935&permissions=268446736&integration_type=0&scope=bot+applications.commands) +> [!WARNING] +> 2.0.0 is in development + # Why use this? - Automatically publishes announcements for you, in case you forget; or a bot sends a message; or you just want to take the easier route @@ -28,6 +31,10 @@ Discord has a rate limit for publishing channels of 10 announcements per server **per hour**. Please do not use this in your server if you exceed this limit +# New in 2.0.0 + +- Upcoming 👀 + # New in 1.1.0 The bot has been restructured - mainly because of the admin permissions and how volatile it could be. Whilst it worked, I wanted to ditch it and make it more secure. You now have more control over what gets published and when it joins a server, will automatically add all needed permissions to it. @@ -37,8 +44,9 @@ _Not all features that were meant to be in 1.1.0 were added in it. That's for 1. The website for the bot is [here](https://autopublish.galvindev.me.uk)! - +# Support + +[Support Discord Server](discord.gg/AppBeYXVNt) # User Integration diff --git a/api/api.ts b/api/api.ts new file mode 100644 index 0000000..95ccaac --- /dev/null +++ b/api/api.ts @@ -0,0 +1,19 @@ +import express, { type Request, type Response, type NextFunction } from 'express'; +import cors from 'cors'; +import path from 'path'; + +const app = express(); +app.use(cors()); +app.use(express.static(path.resolve(__dirname, 'public'))); + +app.get('/', (_req: Request, res: Response) => { + res.sendFile(path.resolve(__dirname, 'public/index.html')); +}); + +app.get('/invite', (_req: Request, res: Response) => { + res.redirect('https://discord.com/oauth2/authorize?client_id=1241739031252045935&permissions=268446736&integration_type=0&scope=bot+applications.commands'); +}); + +app.listen(process.env.PORT, () => { + console.log(`Server running at http://localhost:${process.env.PORT}`); +}); \ No newline at end of file diff --git a/site/demo.mp4 b/api/public/demo.mp4 similarity index 100% rename from site/demo.mp4 rename to api/public/demo.mp4 diff --git a/site/index.html b/api/public/index.html similarity index 66% rename from site/index.html rename to api/public/index.html index f510a61..c35575a 100644 --- a/site/index.html +++ b/api/public/index.html @@ -48,75 +48,14 @@ - +
@@ -159,31 +98,61 @@
- In accordance with Discord's rate limit for 10 published messages per
- hour per server, we allow the bot to be used in any server that
- doesn't exceed these limits. We reserve the right to block the bot
- from your server if it constantly exceeds this limit. Furthermore, the
- server must comply with Discord's Terms of Service and we reserve the
- right to block the bot from your server if we deem that it's
- unacceptable
- Please note that we reserve the right to change these terms at any
- time.
-
- We log every action from the bot so that we are able to identify
- errors and investigate why they happened. We do not log any other
- information, such as the message. Just if a message was published, and
- if an error happened, why
- Starting in 1.1.0, we introduced a new system so you have more control
- over the bot in your server. We use a database to store the guild ID,
- any flags associated with that guild for the bot only, and any paused
- channels from publishing
-