diff --git a/.dockerignore b/.dockerignore
index 1fbb8a3..94e404f 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,4 +1,4 @@
-**/node_modules
-**/build
-**/logs
+**/node_modules
+**/build
+**/logs
**/data
\ No newline at end of file
diff --git a/.editorconfig b/.editorconfig
index 0f3bb61..13505ca 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,3 +1,3 @@
-[*.js]
-indent_style = space
-indent_size = 2
+[*.js]
+indent_style = space
+indent_size = 2
diff --git a/.env.example b/.env.example
index 8ece7e8..bc38ade 100644
--- a/.env.example
+++ b/.env.example
@@ -1,54 +1,54 @@
-############
-# Required #
-############
-
-# Put environment type here (development, staging, or production)
-NODE_ENV=development
-
-# Put Discord bot token here, you can get it from https://discord.com/developers/applications
-TOKEN=
-
-# Put the database connection URL here
-# Example for SQLite:
-DB=sqlite://data.sqlite
-# Example for PostgreSQL:
-# DB=postgresql://esmbot:verycoolpass100@localhost:5432/esmbot
-
-# Put snowflake ID of bot owner here (obtainable by going into Discord settings -> Appearance and enabling Developer Mode,
-# then right clicking on your profile picture and selecting Copy ID)
-OWNER=
-
-# Put default classic command prefix here
-PREFIX=&
-
-############
-# Optional #
-############
-
-# Set this to true if you want the bot to stay in voice chats after sound effects and music have stopped
-# (you can still make the bot leave using the stop command)
-STAYVC=false
-# Set this to true to disable music playback from YouTube
-YT_DISABLED=false
-
-# Put Tenor API key here (used for obtaining raw tenor GIF urls)
-TENOR=
-
-# Put HTML help page output location here, leave blank to disable
-OUTPUT=
-# Put temporary image dir here (make sure it's accessible via a web server), leave blank to disable
-TEMPDIR=
-# Put temporary image web server domain
-TMP_DOMAIN=
-# Threshold where optional space saving methods will be performed
-THRESHOLD=
-# Port for serving metrics. Metrics served are compatible with Prometheus.
-METRICS=
-
-# The image API type to be used
-# Set this to `none` to process all images locally
-# Set this to `ws` if you want to use the external image API script, located in api/index.js
-API_TYPE=none
-
-# Put ID of server to limit owner-only commands to
+############
+# Required #
+############
+
+# Put environment type here (development, staging, or production)
+NODE_ENV=development
+
+# Put Discord bot token here, you can get it from https://discord.com/developers/applications
+TOKEN=
+
+# Put the database connection URL here
+# Example for SQLite:
+DB=sqlite://data.sqlite
+# Example for PostgreSQL:
+# DB=postgresql://esmbot:verycoolpass100@localhost:5432/esmbot
+
+# Put snowflake ID of bot owner here (obtainable by going into Discord settings -> Appearance and enabling Developer Mode,
+# then right clicking on your profile picture and selecting Copy ID)
+OWNER=
+
+# Put default classic command prefix here
+PREFIX=&
+
+############
+# Optional #
+############
+
+# Set this to true if you want the bot to stay in voice chats after sound effects and music have stopped
+# (you can still make the bot leave using the stop command)
+STAYVC=false
+# Set this to true to disable music playback from YouTube
+YT_DISABLED=false
+
+# Put Tenor API key here (used for obtaining raw tenor GIF urls)
+TENOR=
+
+# Put HTML help page output location here, leave blank to disable
+OUTPUT=
+# Put temporary image dir here (make sure it's accessible via a web server), leave blank to disable
+TEMPDIR=
+# Put temporary image web server domain
+TMP_DOMAIN=
+# Threshold where optional space saving methods will be performed
+THRESHOLD=
+# Port for serving metrics. Metrics served are compatible with Prometheus.
+METRICS=
+
+# The image API type to be used
+# Set this to `none` to process all images locally
+# Set this to `ws` if you want to use the external image API script, located in api/index.js
+API_TYPE=none
+
+# Put ID of server to limit owner-only commands to
ADMIN_SERVER=
\ No newline at end of file
diff --git a/.eslintrc.json b/.eslintrc.json
index 5ba7ee8..27588c9 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -1,69 +1,69 @@
-{
- "env": {
- "es2020": true,
- "node": true
- },
- "extends": ["eslint:recommended"],
- "parser": "@babel/eslint-parser",
- "parserOptions": {
- "sourceType": "module",
- "ecmaVersion": 12,
- "requireConfigFile": false,
- "babelOptions": {
- "plugins": [
- "@babel/plugin-proposal-class-properties"
- ]
- }
- },
- "plugins": ["@babel", "unicorn"],
- "rules": {
- "no-console": "off",
- "indent": [
- "error",
- 2,
- {
- "SwitchCase": 1
- }
- ],
- "linebreak-style": [
- "error",
- "unix"
- ],
- "unicorn/prefer-module": "error",
- "quotes": [
- "warn",
- "double"
- ],
- "semi": [
- "warn",
- "always"
- ],
- "keyword-spacing": [
- "error", {
- "before": true,
- "after": true
- }
- ],
- "space-before-blocks": [
- "error", {
- "functions": "always",
- "keywords": "always",
- "classes": "always"
- }
- ],
- "space-before-function-paren": [
- "error", {
- "anonymous": "never",
- "named": "never",
- "asyncArrow": "always"
- }
- ],
- "prefer-const": [
- "error", {
- "destructuring": "any",
- "ignoreReadBeforeAssign": false
- }
- ],
- "prefer-template": "error"
- }
-}
+{
+ "env": {
+ "es2020": true,
+ "node": true
+ },
+ "extends": ["eslint:recommended"],
+ "parser": "@babel/eslint-parser",
+ "parserOptions": {
+ "sourceType": "module",
+ "ecmaVersion": 12,
+ "requireConfigFile": false,
+ "babelOptions": {
+ "plugins": [
+ "@babel/plugin-proposal-class-properties"
+ ]
+ }
+ },
+ "plugins": ["@babel", "unicorn"],
+ "rules": {
+ "no-console": "off",
+ "indent": [
+ "error",
+ 2,
+ {
+ "SwitchCase": 1
+ }
+ ],
+ "linebreak-style": [
+ "error",
+ "unix"
+ ],
+ "unicorn/prefer-module": "error",
+ "quotes": [
+ "warn",
+ "double"
+ ],
+ "semi": [
+ "warn",
+ "always"
+ ],
+ "keyword-spacing": [
+ "error", {
+ "before": true,
+ "after": true
+ }
+ ],
+ "space-before-blocks": [
+ "error", {
+ "functions": "always",
+ "keywords": "always",
+ "classes": "always"
+ }
+ ],
+ "space-before-function-paren": [
+ "error", {
+ "anonymous": "never",
+ "named": "never",
+ "asyncArrow": "always"
+ }
+ ],
+ "prefer-const": [
+ "error", {
+ "destructuring": "any",
+ "ignoreReadBeforeAssign": false
+ }
+ ],
+ "prefer-template": "error"
+ }
+}
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 08c46cb..3df709f 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,2 +1,2 @@
-patreon: TheEssem
+patreon: TheEssem
ko_fi: TheEssem
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index c30b02a..a27c1d8 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -1,54 +1,54 @@
-name: Bug Report
-description: Report an issue with the bot that didn't result in an error file
-labels: [bug]
-body:
- - type: textarea
- id: describe
- attributes:
- label: Describe the bug
- description: A clear and concise description of what the bug is.
- validations:
- required: true
- - type: textarea
- id: reproduce
- attributes:
- label: Steps to reproduce
- description: Steps to reproduce the behavior.
- value: |
- 1. Go to '...'
- 2. Click on '....'
- 3. Scroll down to '....'
- 4. See error
- validations:
- required: false
- - type: textarea
- id: expected
- attributes:
- label: Expected behavior
- description: A clear and concise description of what you expected to happen.
- validations:
- required: false
- - type: textarea
- id: screenshots
- attributes:
- label: Screenshots
- description: If applicable, add screenshots to help explain your problem.
- validations:
- required: false
- - type: dropdown
- id: self-hosted
- attributes:
- label: Self-hosted instance?
- description: Did the error occur on a self-hosted instance (e.g. not the main esmBot or esmBot Dev instances)?
- options:
- - "Yes"
- - "No"
- validations:
- required: true
- - type: textarea
- id: context
- attributes:
- label: Additional context
- description: Add any other context about the problem here.
- validations:
- required: false
+name: Bug Report
+description: Report an issue with the bot that didn't result in an error file
+labels: [bug]
+body:
+ - type: textarea
+ id: describe
+ attributes:
+ label: Describe the bug
+ description: A clear and concise description of what the bug is.
+ validations:
+ required: true
+ - type: textarea
+ id: reproduce
+ attributes:
+ label: Steps to reproduce
+ description: Steps to reproduce the behavior.
+ value: |
+ 1. Go to '...'
+ 2. Click on '....'
+ 3. Scroll down to '....'
+ 4. See error
+ validations:
+ required: false
+ - type: textarea
+ id: expected
+ attributes:
+ label: Expected behavior
+ description: A clear and concise description of what you expected to happen.
+ validations:
+ required: false
+ - type: textarea
+ id: screenshots
+ attributes:
+ label: Screenshots
+ description: If applicable, add screenshots to help explain your problem.
+ validations:
+ required: false
+ - type: dropdown
+ id: self-hosted
+ attributes:
+ label: Self-hosted instance?
+ description: Did the error occur on a self-hosted instance (e.g. not the main esmBot or esmBot Dev instances)?
+ options:
+ - "Yes"
+ - "No"
+ validations:
+ required: true
+ - type: textarea
+ id: context
+ attributes:
+ label: Additional context
+ description: Add any other context about the problem here.
+ validations:
+ required: false
diff --git a/.github/ISSUE_TEMPLATE/error-report.yml b/.github/ISSUE_TEMPLATE/error-report.yml
index 20c1a7d..58024f9 100644
--- a/.github/ISSUE_TEMPLATE/error-report.yml
+++ b/.github/ISSUE_TEMPLATE/error-report.yml
@@ -1,58 +1,58 @@
-name: Error Report
-description: Report an error that the bot posted in chat
-labels: [bug]
-body:
- - type: input
- id: command
- attributes:
- label: Command that caused the error
- description: Post the exact command that caused the error.
- validations:
- required: true
- - type: input
- id: image
- attributes:
- label: Image that caused the error
- description: If the error is regarding an image command, please post a direct link to the image here.
- validations:
- required: false
- - type: textarea
- id: reproduce
- attributes:
- label: Steps to reproduce
- description: Steps to reproduce the behavior.
- value: |
- 1. Go to '...'
- 2. Click on '....'
- 3. Scroll down to '....'
- 4. See error
- validations:
- required: false
- - type: dropdown
- id: self-hosted
- attributes:
- label: Self-hosted instance?
- description: Did the error occur on a self-hosted instance (e.g. not the main esmBot or esmBot Dev instances)?
- options:
- - "Yes"
- - "No"
- validations:
- required: true
- - type: textarea
- id: error
- attributes:
- label: Error file
- description: Post the contents of the error file in between the backticks.
- value: |
- ```
-
- ```
- validations:
- required: true
- - type: textarea
- id: context
- attributes:
- label: Additional context
- description: Add any other context about the problem here.
- validations:
+name: Error Report
+description: Report an error that the bot posted in chat
+labels: [bug]
+body:
+ - type: input
+ id: command
+ attributes:
+ label: Command that caused the error
+ description: Post the exact command that caused the error.
+ validations:
+ required: true
+ - type: input
+ id: image
+ attributes:
+ label: Image that caused the error
+ description: If the error is regarding an image command, please post a direct link to the image here.
+ validations:
+ required: false
+ - type: textarea
+ id: reproduce
+ attributes:
+ label: Steps to reproduce
+ description: Steps to reproduce the behavior.
+ value: |
+ 1. Go to '...'
+ 2. Click on '....'
+ 3. Scroll down to '....'
+ 4. See error
+ validations:
+ required: false
+ - type: dropdown
+ id: self-hosted
+ attributes:
+ label: Self-hosted instance?
+ description: Did the error occur on a self-hosted instance (e.g. not the main esmBot or esmBot Dev instances)?
+ options:
+ - "Yes"
+ - "No"
+ validations:
+ required: true
+ - type: textarea
+ id: error
+ attributes:
+ label: Error file
+ description: Post the contents of the error file in between the backticks.
+ value: |
+ ```
+
+ ```
+ validations:
+ required: true
+ - type: textarea
+ id: context
+ attributes:
+ label: Additional context
+ description: Add any other context about the problem here.
+ validations:
required: false
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml
index 063c59a..0e7bb64 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.yml
+++ b/.github/ISSUE_TEMPLATE/feature_request.yml
@@ -1,25 +1,25 @@
-name: Feature Request
-description: Suggest an idea for this project
-labels: [enhancement]
-body:
- - type: textarea
- id: describe
- attributes:
- label: Describe the request
- description: What do you want to be added to the bot?
- validations:
- required: true
- - type: textarea
- id: problem
- attributes:
- label: Is your feature request related to a problem? Please describe.
- description: A clear and concise description of what the problem is (if applicable). Ex. I'm always frustrated when [...]
- validations:
- required: false
- - type: textarea
- id: context
- attributes:
- label: Additional context
- description: Add any other context or screenshots about the feature request here.
- validations:
+name: Feature Request
+description: Suggest an idea for this project
+labels: [enhancement]
+body:
+ - type: textarea
+ id: describe
+ attributes:
+ label: Describe the request
+ description: What do you want to be added to the bot?
+ validations:
+ required: true
+ - type: textarea
+ id: problem
+ attributes:
+ label: Is your feature request related to a problem? Please describe.
+ description: A clear and concise description of what the problem is (if applicable). Ex. I'm always frustrated when [...]
+ validations:
+ required: false
+ - type: textarea
+ id: context
+ attributes:
+ label: Additional context
+ description: Add any other context or screenshots about the feature request here.
+ validations:
required: false
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 196314b..be5f356 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,43 +1,43 @@
-name: Build Test
-
-on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
-
-env:
- BUILD_TYPE: Release
-
-jobs:
- linux:
- runs-on: ubuntu-22.04
- steps:
- - name: Checkout
- uses: actions/checkout@v1
- - name: Setup pnpm
- uses: pnpm/action-setup@v2.2.2
- with:
- version: 7
- - name: Setup Node.js environment
- uses: actions/setup-node@v2.1.2
- with:
- node-version: 18
- cache: pnpm
- - name: Install dependencies
- run: sudo apt update && sudo apt install -y cmake libvips-dev libmagick++-dev
- - name: Build
- run: pnpm install --frozen-lockfile && pnpm run build
-
- darwin:
- runs-on: macos-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- - name: Install dependencies
- run: |
- brew install imagemagick vips node pnpm npm
- pnpm install --config.strict-peer-dependencies=false
- - name: Build
- run: pnpm run build
-
+name: Build Test
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+env:
+ BUILD_TYPE: Release
+
+jobs:
+ linux:
+ runs-on: ubuntu-22.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v1
+ - name: Setup pnpm
+ uses: pnpm/action-setup@v2.2.2
+ with:
+ version: 7
+ - name: Setup Node.js environment
+ uses: actions/setup-node@v2.1.2
+ with:
+ node-version: 18
+ cache: pnpm
+ - name: Install dependencies
+ run: sudo apt update && sudo apt install -y cmake libvips-dev libmagick++-dev
+ - name: Build
+ run: pnpm install --frozen-lockfile && pnpm run build
+
+ darwin:
+ runs-on: macos-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ - name: Install dependencies
+ run: |
+ brew install imagemagick vips node pnpm npm
+ pnpm install --config.strict-peer-dependencies=false
+ - name: Build
+ run: pnpm run build
+
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index f85d4b5..d74e361 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -1,67 +1,67 @@
-# For most projects, this workflow file will not need changing; you simply need
-# to commit it to your repository.
-#
-# You may wish to alter this file to override the set of languages analyzed,
-# or to provide custom queries or build logic.
-#
-# ******** NOTE ********
-# We have attempted to detect the languages in your repository. Please check
-# the `language` matrix defined below to confirm you have the correct set of
-# supported CodeQL languages.
-#
-name: "CodeQL"
-
-on:
- push:
- branches: [ master ]
- pull_request:
- # The branches below must be a subset of the branches above
- branches: [ master ]
- schedule:
- - cron: '35 2 * * 0'
-
-jobs:
- analyze:
- name: Analyze
- runs-on: ubuntu-latest
-
- strategy:
- fail-fast: false
- matrix:
- language: [ 'javascript' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
- # Learn more:
- # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
-
- - name: Setup Node.js environment
- uses: actions/setup-node@v2.1.2
- #with:
- # Set always-auth in npmrc
- #always-auth: # optional, default is false
- # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
- #node-version: # optional
- # Set this option if you want the action to check for the latest available version that satisfies the version spec
- #check-latest: # optional
- # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN
- #registry-url: # optional
- # Optional scope for authenticating against scoped registries
- #scope: # optional
- # Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user.
- #token: # optional, default is ${{ github.token }}
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v2
- with:
- languages: ${{ matrix.language }}
- # If you wish to specify custom queries, you can do so here or in a config file.
- # By default, queries listed here will override any specified in a config file.
- # Prefix the list here with "+" to use these queries and those in the config file.
- # queries: ./path/to/local/query, your-org/your-repo/queries@main
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ master ]
+ schedule:
+ - cron: '35 2 * * 0'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'javascript' ]
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
+ # Learn more:
+ # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Setup Node.js environment
+ uses: actions/setup-node@v2.1.2
+ #with:
+ # Set always-auth in npmrc
+ #always-auth: # optional, default is false
+ # Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0
+ #node-version: # optional
+ # Set this option if you want the action to check for the latest available version that satisfies the version spec
+ #check-latest: # optional
+ # Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN
+ #registry-url: # optional
+ # Optional scope for authenticating against scoped registries
+ #scope: # optional
+ # Used to pull node distributions from node-versions. Since there's a default, this is typically not supplied by the user.
+ #token: # optional, default is ${{ github.token }}
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml
index 10f7bc5..e3bcc49 100644
--- a/.github/workflows/mkdocs.yml
+++ b/.github/workflows/mkdocs.yml
@@ -1,21 +1,21 @@
-name: Publish docs via GitHub Pages
-on:
- push:
- branches:
- - master
- paths:
- - 'docs/**'
-
-jobs:
- build:
- name: Deploy docs
- runs-on: ubuntu-latest
- steps:
- - name: Checkout main
- uses: actions/checkout@v2
-
- - name: Deploy docs
- uses: mhausenblas/mkdocs-deploy-gh-pages@master
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- REQUIREMENTS: docs/requirements.txt
+name: Publish docs via GitHub Pages
+on:
+ push:
+ branches:
+ - master
+ paths:
+ - 'docs/**'
+
+jobs:
+ build:
+ name: Deploy docs
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout main
+ uses: actions/checkout@v2
+
+ - name: Deploy docs
+ uses: mhausenblas/mkdocs-deploy-gh-pages@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ REQUIREMENTS: docs/requirements.txt
diff --git a/.gitignore b/.gitignore
index 0b0ad31..d79dcf6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,121 +1,121 @@
-# Logs
-logs
-*.log
-*.log.gz
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
-lerna-debug.log*
-.pnpm-debug.log*
-
-# Diagnostic reports (https://nodejs.org/api/report.html)
-report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
-
-# Runtime data
-pids
-*.pid
-*.seed
-*.pid.lock
-
-# node-waf configuration
-.lock-wscript
-
-# Compiled binary addons (https://nodejs.org/api/addons.html)
-build/
-
-# Dependency directories
-node_modules/
-jspm_packages/
-libvips/
-
-# Optional npm cache directory
-.npm
-
-# Optional eslint cache
-.eslintcache
-
-# Optional stylelint cache
-.stylelintcache
-
-# Microbundle cache
-.rpt2_cache/
-.rts2_cache_cjs/
-.rts2_cache_es/
-.rts2_cache_umd/
-
-# Optional REPL history
-.node_repl_history
-
-# Output of 'npm pack'
-*.tgz
-
-# Yarn Integrity file
-.yarn-integrity
-
-# dotenv environment variable files
-.env
-.env.development.local
-.env.test.local
-.env.production.local
-.env.local
-
-# Gatsby files
-.cache/
-# Comment in the public line in if your project uses Gatsby and not Next.js
-# https://nextjs.org/blog/next-9-1#public-directory-support
-# public
-
-# vuepress v2.x temp and cache directory
-.temp
-.cache
-
-# Stores VSCode versions used for testing VSCode extensions
-.vscode-test
-
-# yarn v2
-.yarn/cache
-.yarn/unplugged
-.yarn/build-state.yml
-.yarn/install-state.gz
-.pnp.*
-
-# Prerequisites
-*.d
-
-# Compiled Object files
-*.slo
-*.lo
-*.o
-*.obj
-
-# Precompiled Headers
-*.gch
-*.pch
-
-# Compiled Dynamic libraries
-*.so
-*.dylib
-*.dll
-
-# Compiled Static libraries
-*.lai
-*.la
-*.a
-*.lib
-
-# Executables
-*.exe
-*.out
-*.app
-
-# Debugging
-*.heap
-*.out.*
-
-# vscode stuff
-.vscode
-*.code-workspace
-
-# Databases
-data/
+# Logs
+logs
+*.log
+*.log.gz
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+.pnpm-debug.log*
+
+# Diagnostic reports (https://nodejs.org/api/report.html)
+report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/
+
+# Dependency directories
+node_modules/
+jspm_packages/
+libvips/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional stylelint cache
+.stylelintcache
+
+# Microbundle cache
+.rpt2_cache/
+.rts2_cache_cjs/
+.rts2_cache_es/
+.rts2_cache_umd/
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variable files
+.env
+.env.development.local
+.env.test.local
+.env.production.local
+.env.local
+
+# Gatsby files
+.cache/
+# Comment in the public line in if your project uses Gatsby and not Next.js
+# https://nextjs.org/blog/next-9-1#public-directory-support
+# public
+
+# vuepress v2.x temp and cache directory
+.temp
+.cache
+
+# Stores VSCode versions used for testing VSCode extensions
+.vscode-test
+
+# yarn v2
+.yarn/cache
+.yarn/unplugged
+.yarn/build-state.yml
+.yarn/install-state.gz
+.pnp.*
+
+# Prerequisites
+*.d
+
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Precompiled Headers
+*.gch
+*.pch
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
+
+# Debugging
+*.heap
+*.out.*
+
+# vscode stuff
+.vscode
+*.code-workspace
+
+# Databases
+data/
*.sqlite
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
index d73eae3..b01e750 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
-[submodule "assets/images/region-flags"]
- path = assets/images/region-flags
- url = https://github.com/fonttools/region-flags
+[submodule "assets/images/region-flags"]
+ path = assets/images/region-flags
+ url = https://github.com/fonttools/region-flags
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb8fc66..77ed27b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,47 +1,47 @@
-cmake_minimum_required(VERSION 3.15)
-cmake_policy(SET CMP0091 NEW)
-cmake_policy(SET CMP0042 NEW)
-project(image)
-
-file(GLOB SOURCE_FILES "natives/*.cc" "natives/*.h")
-
-if (CMAKE_JS_VERSION)
- include_directories(${CMAKE_JS_INC})
- add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC} natives/node/image.cc)
- set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
- target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB})
-else()
- add_executable(${PROJECT_NAME} ${SOURCE_FILES} natives/cli/image.cc)
-endif()
-
-target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
-
-if(MSVC) # todo: change flags for more parity with GCC/clang, I don't know much about MSVC so pull requests are open
- set(CMAKE_CXX_FLAGS "/Wall /EHsc /GS")
- set(CMAKE_CXX_FLAGS_DEBUG "/Zi")
- set(CMAKE_CXX_FLAGS_RELEASE "/Ox")
- set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
- set(BUILD_SHARED_LIBS TRUE)
-else()
- set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror=format-security -Wno-cast-function-type -fexceptions -D_GLIBCXX_ASSERTIONS -fstack-clash-protection -pedantic -D_GLIBCXX_USE_CXX11_ABI=1")
- set(CMAKE_CXX_FLAGS_DEBUG "-g")
- set(CMAKE_CXX_FLAGS_RELEASE "-O2")
-endif()
-
-set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
-
-find_package(ImageMagick REQUIRED COMPONENTS Magick++ MagickCore)
-add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16)
-add_definitions(-DMAGICKCORE_HDRI_ENABLE=0)
-include_directories(${ImageMagick_INCLUDE_DIRS})
-target_link_libraries(${PROJECT_NAME} ${ImageMagick_LIBRARIES})
-
-pkg_check_modules(VIPS REQUIRED vips-cpp)
-include_directories(${VIPS_INCLUDE_DIRS})
-link_directories(${VIPS_LIBRARY_DIRS})
-target_link_libraries(${PROJECT_NAME} ${VIPS_LDFLAGS})
-
-if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET AND CMAKE_JS_VERSION)
- # Generate node.lib
- execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
-endif()
+cmake_minimum_required(VERSION 3.15)
+cmake_policy(SET CMP0091 NEW)
+cmake_policy(SET CMP0042 NEW)
+project(image)
+
+file(GLOB SOURCE_FILES "natives/*.cc" "natives/*.h")
+
+if (CMAKE_JS_VERSION)
+ include_directories(${CMAKE_JS_INC})
+ add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC} natives/node/image.cc)
+ set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
+ target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB})
+else()
+ add_executable(${PROJECT_NAME} ${SOURCE_FILES} natives/cli/image.cc)
+endif()
+
+target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
+
+if(MSVC) # todo: change flags for more parity with GCC/clang, I don't know much about MSVC so pull requests are open
+ set(CMAKE_CXX_FLAGS "/Wall /EHsc /GS")
+ set(CMAKE_CXX_FLAGS_DEBUG "/Zi")
+ set(CMAKE_CXX_FLAGS_RELEASE "/Ox")
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+ set(BUILD_SHARED_LIBS TRUE)
+else()
+ set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror=format-security -Wno-cast-function-type -fexceptions -D_GLIBCXX_ASSERTIONS -fstack-clash-protection -pedantic -D_GLIBCXX_USE_CXX11_ABI=1")
+ set(CMAKE_CXX_FLAGS_DEBUG "-g")
+ set(CMAKE_CXX_FLAGS_RELEASE "-O2")
+endif()
+
+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+find_package(ImageMagick REQUIRED COMPONENTS Magick++ MagickCore)
+add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16)
+add_definitions(-DMAGICKCORE_HDRI_ENABLE=0)
+include_directories(${ImageMagick_INCLUDE_DIRS})
+target_link_libraries(${PROJECT_NAME} ${ImageMagick_LIBRARIES})
+
+pkg_check_modules(VIPS REQUIRED vips-cpp)
+include_directories(${VIPS_INCLUDE_DIRS})
+link_directories(${VIPS_LIBRARY_DIRS})
+target_link_libraries(${PROJECT_NAME} ${VIPS_LDFLAGS})
+
+if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET AND CMAKE_JS_VERSION)
+ # Generate node.lib
+ execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
+endif()
diff --git a/Dockerfile b/Dockerfile
index 2e53068..31c1aa9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,70 +1,70 @@
-# Docker/Kubernetes file for running the bot
-#FROM node:alpine
-FROM alpine:edge
-
-RUN apk --no-cache upgrade
-RUN apk add --no-cache git cmake msttcorefonts-installer python3 alpine-sdk ffmpeg wget rpm2cpio \
- zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev fontconfig-dev \
- libtool libwebp-dev libxml2-dev freetype fontconfig \
- vips vips-dev grep libc6-compat nodejs-current nodejs-current-dev npm
-
-# install pnpm
-RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
- npm install -g pnpm@6.27.1
-
-# liblqr needs to be built manually for magick to work
-# and because alpine doesn't have it in their repos
-RUN git clone https://github.com/carlobaldassi/liblqr \
- && cd liblqr \
- && ./configure \
- && make \
- && make install
-
-# install imagemagick from source rather than using the package
-# since the alpine package does not include liblqr support.
-RUN git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick \
- && cd ImageMagick \
- && ./configure \
- --prefix=/usr \
- --sysconfdir=/etc \
- --mandir=/usr/share/man \
- --infodir=/usr/share/info \
- --enable-static \
- --disable-openmp \
- --with-threads \
- --with-png \
- --with-webp \
- --with-modules \
- --with-pango \
- --without-hdri \
- --with-lqr \
- && make \
- && make install
-
-RUN update-ms-fonts && fc-cache -f
-
-RUN adduser esmBot -s /bin/sh -D
-USER esmBot
-
-WORKDIR /home/esmBot/.internal
-
-COPY --chown=esmBot:esmBot ./package.json package.json
-COPY --chown=esmBot:esmBot ./pnpm-lock.yaml pnpm-lock.yaml
-RUN pnpm install
-COPY . .
-RUN rm .env
-RUN pnpm run build
-
-RUN mkdir /home/esmBot/help \
- && chown esmBot:esmBot /home/esmBot/help \
- && chmod 777 /home/esmBot/help
-
-RUN mkdir /home/esmBot/temp \
- && chown esmBot:esmBot /home/esmBot/temp \
- && chmod 777 /home/esmBot/temp
-
-RUN mkdir /home/esmBot/.internal/logs \
- && chown esmBot:esmBot /home/esmBot/.internal/logs \
- && chmod 777 /home/esmBot/.internal/logs
-
-ENTRYPOINT ["node", "app.js"]
+# Docker/Kubernetes file for running the bot
+#FROM node:alpine
+FROM alpine:edge
+
+RUN apk --no-cache upgrade
+RUN apk add --no-cache git cmake msttcorefonts-installer python3 alpine-sdk ffmpeg wget rpm2cpio \
+ zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev fontconfig-dev \
+ libtool libwebp-dev libxml2-dev freetype fontconfig \
+ vips vips-dev grep libc6-compat nodejs-current nodejs-current-dev npm
+
+# install pnpm
+RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
+ npm install -g pnpm@6.27.1
+
+# liblqr needs to be built manually for magick to work
+# and because alpine doesn't have it in their repos
+RUN git clone https://github.com/carlobaldassi/liblqr \
+ && cd liblqr \
+ && ./configure \
+ && make \
+ && make install
+
+# install imagemagick from source rather than using the package
+# since the alpine package does not include liblqr support.
+RUN git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick \
+ && cd ImageMagick \
+ && ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --infodir=/usr/share/info \
+ --enable-static \
+ --disable-openmp \
+ --with-threads \
+ --with-png \
+ --with-webp \
+ --with-modules \
+ --with-pango \
+ --without-hdri \
+ --with-lqr \
+ && make \
+ && make install
+
+RUN update-ms-fonts && fc-cache -f
+
+RUN adduser esmBot -s /bin/sh -D
+USER esmBot
+
+WORKDIR /home/esmBot/.internal
+
+COPY --chown=esmBot:esmBot ./package.json package.json
+COPY --chown=esmBot:esmBot ./pnpm-lock.yaml pnpm-lock.yaml
+RUN pnpm install
+COPY . .
+RUN rm .env
+RUN pnpm run build
+
+RUN mkdir /home/esmBot/help \
+ && chown esmBot:esmBot /home/esmBot/help \
+ && chmod 777 /home/esmBot/help
+
+RUN mkdir /home/esmBot/temp \
+ && chown esmBot:esmBot /home/esmBot/temp \
+ && chmod 777 /home/esmBot/temp
+
+RUN mkdir /home/esmBot/.internal/logs \
+ && chown esmBot:esmBot /home/esmBot/.internal/logs \
+ && chmod 777 /home/esmBot/.internal/logs
+
+ENTRYPOINT ["node", "app.js"]
diff --git a/LICENSE b/LICENSE
index 2b01000..c08f23c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,21 +1,21 @@
-MIT License
-
-Copyright (c) 2023 Essem
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+MIT License
+
+Copyright (c) 2023 Essem
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/PRIVACY.md b/PRIVACY.md
index f9fa103..128f492 100644
--- a/PRIVACY.md
+++ b/PRIVACY.md
@@ -1,24 +1,24 @@
-# esmBot and Privacy
-First things first: **esmBot does not and is incapable of collecting IP addresses, emails, or any other sensitive personal/private info.** This info is not accessible via Discord's API [except for emails](https://discord.com/developers/docs/resources/user#user-object), which require the email OAuth2 scope to access. esmBot does not use OAuth2 to link to a user account, therefore it does not have access to this info.
-
-Whenever a command is run using esmBot, a command count number is increased. **This counter is completely anonymous and is used only for statistical purposes.** Users can check this info at any time using the count and help commands.
-
-esmBot uses the following user-related info:
-+ User IDs (needed for many reasons such as the tag commands and replying to users)
-+ Avatars (needed for some embeds and the avatar command)
-+ Usernames (for embeds and avatar command)
-+ Permissions (for checking if a user has perms to run some commands)
-+ Whether the user is a bot (needed to prevent other bots from running commands)
-
-Out of these, **only user IDs are stored in the database**, and they are used only with the tag system for checking the owner of a tag.
-
-esmBot uses the following guild-related info:
-+ Guild IDs (for guild-specific settings)
-+ Guild channel IDs (for getting where to send a message, storing disabled channels)
-+ List of members (for getting permissions and obtaining user objects by ID)
-
-Out of these, **only guild and channel IDs are stored in the database** for configuration info and storing disabled channels/commands, prefixes, and tags.
-
-If you want this data removed on the main instance, you can DM me on Discord (Essem#9261) or email me at [data@esmbot.net](mailto:data@esmbot.net).
-
-Hopefully this document is clear enough to help understand what esmBot does and doesn't use. If you have any further questions, please contact me via the [esmBot Support](https://esmbot.net/support) server.
+# esmBot and Privacy
+First things first: **esmBot does not and is incapable of collecting IP addresses, emails, or any other sensitive personal/private info.** This info is not accessible via Discord's API [except for emails](https://discord.com/developers/docs/resources/user#user-object), which require the email OAuth2 scope to access. esmBot does not use OAuth2 to link to a user account, therefore it does not have access to this info.
+
+Whenever a command is run using esmBot, a command count number is increased. **This counter is completely anonymous and is used only for statistical purposes.** Users can check this info at any time using the count and help commands.
+
+esmBot uses the following user-related info:
++ User IDs (needed for many reasons such as the tag commands and replying to users)
++ Avatars (needed for some embeds and the avatar command)
++ Usernames (for embeds and avatar command)
++ Permissions (for checking if a user has perms to run some commands)
++ Whether the user is a bot (needed to prevent other bots from running commands)
+
+Out of these, **only user IDs are stored in the database**, and they are used only with the tag system for checking the owner of a tag.
+
+esmBot uses the following guild-related info:
++ Guild IDs (for guild-specific settings)
++ Guild channel IDs (for getting where to send a message, storing disabled channels)
++ List of members (for getting permissions and obtaining user objects by ID)
+
+Out of these, **only guild and channel IDs are stored in the database** for configuration info and storing disabled channels/commands, prefixes, and tags.
+
+If you want this data removed on the main instance, you can DM me on Discord (Essem#9261) or email me at [data@esmbot.net](mailto:data@esmbot.net).
+
+Hopefully this document is clear enough to help understand what esmBot does and doesn't use. If you have any further questions, please contact me via the [esmBot Support](https://esmbot.net/support) server.
diff --git a/README.md b/README.md
index 430d683..93c0f6d 100644
--- a/README.md
+++ b/README.md
@@ -1,29 +1,29 @@
-# esmBot
-[![esmBot Support](https://discordapp.com/api/guilds/592399417676529688/embed.png)](https://discord.gg/esmbot) ![GitHub license](https://img.shields.io/github/license/esmBot/esmBot.svg)
-
-
-esmBot is a free and open-source Discord bot designed to entertain your server. It's made using [Oceanic](https://oceanic.ws) and comes with image, music, and utility commands out of the box.
-
-## Features
-- Powerful, efficient, and performant image processing powered by [libvips](https://github.com/libvips/libvips)
-- Lots of image manipulation and processing commands out of the box
-- Handling of output images larger than 8MB via a local web server
-- Optional WebSocket/HTTP-based external image API with load balancing
-- Music and sound playback from many different configurable sources via [Lavalink](https://github.com/freyacodes/Lavalink)
-- Server tags system for saving/retrieving content
-- Low RAM and CPU usage when idle
-- Support for slash/application commands and classic, prefix-based message commands
-- Support for multiple database backends (PostgreSQL and SQLite backends included)
-- [PM2](https://pm2.keymetrics.io)-based cluster/shard handling
-- Flexible command handler allowing you to create new commands by adding script files
-
-## Usage
-You can invite the main instance of esmBot to your server using this link: https://esmbot.net/invite
-
-A command list can be found [here](https://esmbot.net/help.html).
-
-If you want to self-host the bot, a guide can be found [here](https://docs.esmbot.net/setup).
-
-## Credits
-Icon by [Steel](https://twitter.com/MintBurrow).
-All images, sounds, and fonts are copyright of their respective owners.
+# esmBot
+[![esmBot Support](https://discordapp.com/api/guilds/592399417676529688/embed.png)](https://discord.gg/esmbot) ![GitHub license](https://img.shields.io/github/license/esmBot/esmBot.svg)
+
+
+esmBot is a free and open-source Discord bot designed to entertain your server. It's made using [Oceanic](https://oceanic.ws) and comes with image, music, and utility commands out of the box.
+
+## Features
+- Powerful, efficient, and performant image processing powered by [libvips](https://github.com/libvips/libvips)
+- Lots of image manipulation and processing commands out of the box
+- Handling of output images larger than 8MB via a local web server
+- Optional WebSocket/HTTP-based external image API with load balancing
+- Music and sound playback from many different configurable sources via [Lavalink](https://github.com/freyacodes/Lavalink)
+- Server tags system for saving/retrieving content
+- Low RAM and CPU usage when idle
+- Support for slash/application commands and classic, prefix-based message commands
+- Support for multiple database backends (PostgreSQL and SQLite backends included)
+- [PM2](https://pm2.keymetrics.io)-based cluster/shard handling
+- Flexible command handler allowing you to create new commands by adding script files
+
+## Usage
+You can invite the main instance of esmBot to your server using this link: https://esmbot.net/invite
+
+A command list can be found [here](https://esmbot.net/help.html).
+
+If you want to self-host the bot, a guide can be found [here](https://docs.esmbot.net/setup).
+
+## Credits
+Icon by [Steel](https://twitter.com/MintBurrow).
+All images, sounds, and fonts are copyright of their respective owners.
diff --git a/api/IMPLEMENTATION.md b/api/IMPLEMENTATION.md
index 82344f4..b72b9d4 100644
--- a/api/IMPLEMENTATION.md
+++ b/api/IMPLEMENTATION.md
@@ -1,51 +1,51 @@
-# esmBot Image API
-The esmBot image API is a combined HTTP and WebSocket API. The default port to access the API is 3762. The API supports very basic authentication, which is defined on the server via the PASS environment variable and is sent from the client via the Authentication header in both HTTP and WS requests.
-
-## HTTP
-
-### GET `/image/?id=`
-Get image data after job is finished running. The Content-Type header is properly set.
-
-### GET `/count`
-Get the current amount of running jobs. Response is a plaintext number value.
-
-## WebSockets
-A client sends *requests* (T-messages) to a server, which subsequently *replies* (R-messages) to the client.
-### Message IDs
-- Rerror 0x01
-- Tqueue 0x02
-- Rqueue 0x03
-- Tcancel 0x04
-- Rcancel 0x05
-- Twait 0x06
-- Rwait 0x07
-- Rinit 0x08
-
-### Messages
-[n] means n bytes.
-[s] means a string that goes until the end of the message.
-[j] means JSON data that goes until the end of the message.
-`tag` is used to identify a request/response pair, like `lock` in the original API. `jid` is used to identify a job. `job` is a job object.
-- Rerror tag[2] error[s]
-- Tqueue tag[2] jid[8] job[j]
-- Rqueue tag[2]
-- Tcancel tag[2] jid[8]
-- Rcancel tag[2]
-- Twait tag[2] jid[8]
-- Rwait tag[2]
-- Rinit tag[2] max_jobs[2] running_jobs[2] formats[j]
-
-### Job Object
-The job object is formatted like this:
-```js
-{
- "cmd": string, // name of internal image command, e.g. caption
- "path": string, // canonical image URL, used for getting the actual image
- "url": string, // original image URL, used for message filtering
- "params": { // content varies depending on the command, some common parameters are listed here
- "type": string, // mime type of output, should usually be the same as input
- ...
- },
- "name": string // filename of the image, without extension
-}
-```
+# esmBot Image API
+The esmBot image API is a combined HTTP and WebSocket API. The default port to access the API is 3762. The API supports very basic authentication, which is defined on the server via the PASS environment variable and is sent from the client via the Authentication header in both HTTP and WS requests.
+
+## HTTP
+
+### GET `/image/?id=`
+Get image data after job is finished running. The Content-Type header is properly set.
+
+### GET `/count`
+Get the current amount of running jobs. Response is a plaintext number value.
+
+## WebSockets
+A client sends *requests* (T-messages) to a server, which subsequently *replies* (R-messages) to the client.
+### Message IDs
+- Rerror 0x01
+- Tqueue 0x02
+- Rqueue 0x03
+- Tcancel 0x04
+- Rcancel 0x05
+- Twait 0x06
+- Rwait 0x07
+- Rinit 0x08
+
+### Messages
+[n] means n bytes.
+[s] means a string that goes until the end of the message.
+[j] means JSON data that goes until the end of the message.
+`tag` is used to identify a request/response pair, like `lock` in the original API. `jid` is used to identify a job. `job` is a job object.
+- Rerror tag[2] error[s]
+- Tqueue tag[2] jid[8] job[j]
+- Rqueue tag[2]
+- Tcancel tag[2] jid[8]
+- Rcancel tag[2]
+- Twait tag[2] jid[8]
+- Rwait tag[2]
+- Rinit tag[2] max_jobs[2] running_jobs[2] formats[j]
+
+### Job Object
+The job object is formatted like this:
+```js
+{
+ "cmd": string, // name of internal image command, e.g. caption
+ "path": string, // canonical image URL, used for getting the actual image
+ "url": string, // original image URL, used for message filtering
+ "params": { // content varies depending on the command, some common parameters are listed here
+ "type": string, // mime type of output, should usually be the same as input
+ ...
+ },
+ "name": string // filename of the image, without extension
+}
+```
diff --git a/api/index.js b/api/index.js
index 7103031..b24e2e6 100644
--- a/api/index.js
+++ b/api/index.js
@@ -1,290 +1,290 @@
-import { config } from "dotenv";
-config();
-import { cpus } from "os";
-import { Worker } from "worker_threads";
-import { join } from "path";
-import { createServer } from "http";
-import { WebSocketServer } from "ws";
-import { fileURLToPath } from "url";
-import { dirname } from "path";
-import { createRequire } from "module";
-import EventEmitter from "events";
-
-const nodeRequire = createRequire(import.meta.url);
-const img = nodeRequire(`../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`);
-
-const Rerror = 0x01;
-const Tqueue = 0x02;
-const Rqueue = 0x03;
-const Tcancel = 0x04;
-const Rcancel = 0x05;
-const Twait = 0x06;
-const Rwait = 0x07;
-const Rinit = 0x08;
-
-const start = process.hrtime();
-const log = (msg, jobNum) => {
- console.log(`[${process.hrtime(start)[1] / 1000000}${jobNum ? `:${jobNum}` : ""}]\t ${msg}`);
-};
-const error = (msg, jobNum) => {
- console.error(`[${process.hrtime(start)[1] / 1000000}${jobNum ? `:${jobNum}` : ""}]\t ${msg}`);
-};
-
-class JobCache extends Map {
- set(key, value) {
- super.set(key, value);
- setTimeout(() => {
- if (super.has(key) && this.get(key) === value && value.data) super.delete(key);
- }, 300000); // delete jobs if not requested after 5 minutes
- }
-}
-
-const jobs = new JobCache();
-// Should look like ID : { msg: "request", num: }
-const queue = [];
-// Array of IDs
-
-const MAX_JOBS = process.env.JOBS ? parseInt(process.env.JOBS) : cpus().length * 4; // Completely arbitrary, should usually be some multiple of your amount of cores
-const PASS = process.env.PASS ? process.env.PASS : undefined;
-let jobAmount = 0;
-
-const acceptJob = (id, sock) => {
- jobAmount++;
- queue.shift();
- const job = jobs.get(id);
- return runJob({
- id: id,
- msg: job.msg,
- num: job.num
- }, sock).then(() => {
- log(`Job ${id} has finished`);
- }).catch((err) => {
- error(`Error on job ${id}: ${err}`, job.num);
- const newJob = jobs.get(id);
- if (!newJob.tag) {
- newJob.error = err.message;
- jobs.set(id, newJob);
- return;
- }
- jobs.delete(id);
- sock.send(Buffer.concat([Buffer.from([Rerror]), newJob.tag, Buffer.from(err.message)]));
- }).finally(() => {
- jobAmount--;
- if (queue.length > 0) {
- acceptJob(queue[0], sock);
- }
- });
-};
-
-const waitForVerify = (event) => {
- return new Promise((resolve, reject) => {
- event.once("end", (r) => resolve(r));
- event.once("error", (e) => reject(e));
- });
-};
-
-const wss = new WebSocketServer({ clientTracking: true, noServer: true });
-
-wss.on("connection", (ws, request) => {
- log(`WS client ${request.socket.remoteAddress}:${request.socket.remotePort} has connected`);
- const num = Buffer.alloc(2);
- num.writeUInt16LE(MAX_JOBS);
- const cur = Buffer.alloc(2);
- cur.writeUInt16LE(jobAmount);
- const formats = {};
- for (const cmd of img.funcs) {
- formats[cmd] = ["image/png", "image/gif", "image/jpeg", "image/webp"];
- }
- const init = Buffer.concat([Buffer.from([Rinit]), Buffer.from([0x00, 0x00]), num, cur, Buffer.from(JSON.stringify(formats))]);
- ws.send(init);
-
- ws.on("error", (err) => {
- error(err);
- });
-
- ws.on("message", (msg) => {
- const opcode = msg.readUint8(0);
- const tag = msg.slice(1, 3);
- const req = msg.toString().slice(3);
- if (opcode == Tqueue) {
- const id = msg.readBigInt64LE(3);
- const obj = msg.slice(11);
- const job = { msg: obj, num: jobAmount, verifyEvent: new EventEmitter() };
- jobs.set(id, job);
- queue.push(id);
-
- const newBuffer = Buffer.concat([Buffer.from([Rqueue]), tag]);
- ws.send(newBuffer);
-
- if (jobAmount < MAX_JOBS) {
- log(`Got WS request for job ${job.msg} with id ${id}`, job.num);
- acceptJob(id, ws);
- } else {
- log(`Got WS request for job ${job.msg} with id ${id}, queued in position ${queue.indexOf(id)}`, job.num);
- }
- } else if (opcode == Tcancel) {
- delete queue[queue.indexOf(req) - 1];
- jobs.delete(req);
- const cancelResponse = Buffer.concat([Buffer.from([Rcancel]), tag]);
- ws.send(cancelResponse);
- } else if (opcode == Twait) {
- const id = msg.readBigUInt64LE(3);
- const job = jobs.get(id);
- if (!job) {
- const errorResponse = Buffer.concat([Buffer.from([Rerror]), tag, Buffer.from("Invalid job ID")]);
- ws.send(errorResponse);
- return;
- }
- if (job.error) {
- job.verifyEvent.emit("error", job.error);
- jobs.delete(id);
- const errorResponse = Buffer.concat([Buffer.from([Rerror]), tag, Buffer.from(job.error)]);
- ws.send(errorResponse);
- return;
- }
- job.verifyEvent.emit("end", tag);
- job.tag = tag;
- jobs.set(id, job);
- //const waitResponse = Buffer.concat([Buffer.from([Rwait]), tag]);
- //ws.send(waitResponse);
- } else {
- log("Could not parse WS message");
- }
- });
-
- ws.on("close", () => {
- log(`WS client ${request.socket.remoteAddress}:${request.socket.remotePort} has disconnected`);
- });
-});
-
-wss.on("error", (err) => {
- error("A WS error occurred: ", err);
-});
-
-const httpServer = createServer();
-
-httpServer.on("request", async (req, res) => {
- if (req.method !== "GET") {
- res.statusCode = 405;
- return res.end("405 Method Not Allowed");
- }
- if (PASS && req.headers.authentication !== PASS) {
- res.statusCode = 401;
- return res.end("401 Unauthorized");
- }
- const reqUrl = new URL(req.url, `http://${req.headers.host}`);
- if (reqUrl.pathname === "/image" && req.method === "GET") {
- if (!reqUrl.searchParams.has("id")) {
- res.statusCode = 400;
- return res.end("400 Bad Request");
- }
- const id = BigInt(reqUrl.searchParams.get("id"));
- if (!jobs.has(id)) {
- res.statusCode = 410;
- return res.end("410 Gone");
- }
- log(`Sending image data for job ${id} to ${req.socket.remoteAddress}:${req.socket.remotePort} via HTTP`);
- const ext = jobs.get(id).ext;
- let contentType;
- switch (ext) {
- case "gif":
- contentType = "image/gif";
- break;
- case "png":
- contentType = "image/png";
- break;
- case "jpeg":
- case "jpg":
- contentType = "image/jpeg";
- break;
- case "webp":
- contentType = "image/webp";
- break;
- }
- if (contentType) res.setHeader("Content-Type", contentType);
- else res.setHeader("Content-Type", ext);
- const data = jobs.get(id).data;
- jobs.delete(id);
- return res.end(data, (err) => {
- if (err) error(err);
- });
- } else if (reqUrl.pathname === "/count" && req.method === "GET") {
- log(`Sending job count to ${req.socket.remoteAddress}:${req.socket.remotePort} via HTTP`);
- return res.end(jobAmount.toString(), (err) => {
- if (err) error(err);
- });
- } else {
- res.statusCode = 404;
- return res.end("404 Not Found");
- }
-});
-
-httpServer.on("upgrade", (req, sock, head) => {
- const reqUrl = new URL(req.url, `http://${req.headers.host}`);
-
- if (PASS && req.headers.authentication !== PASS) {
- sock.write("HTTP/1.1 401 Unauthorized\r\n\r\n");
- sock.destroy();
- return;
- }
-
- if (reqUrl.pathname === "/sock") {
- wss.handleUpgrade(req, sock, head, (ws) => {
- wss.emit("connection", ws, req);
- });
- } else {
- sock.destroy();
- }
-});
-
-httpServer.on("error", (e) => {
- error("An HTTP error occurred: ", e);
-});
-const port = parseInt(process.env.PORT) || 3762;
-httpServer.listen(port, () => {
- log("HTTP and WS listening on port 3762");
-});
-
-const runJob = (job, ws) => {
- return new Promise((resolve, reject) => {
- log(`Job ${job.id} starting...`, job.num);
-
- const object = JSON.parse(job.msg);
- // If the image has a path, it must also have a type
- if (object.path && !object.params.type) {
- reject(new TypeError("Unknown image type"));
- }
-
- const worker = new Worker(join(dirname(fileURLToPath(import.meta.url)), "../utils/image-runner.js"), {
- workerData: object
- });
- const timeout = setTimeout(() => {
- worker.terminate();
- reject(new Error("Job timed out"));
- }, 900000);
- log(`Job ${job.id} started`, job.num);
- worker.once("message", (data) => {
- clearTimeout(timeout);
- log(`Sending result of job ${job.id} back to the bot`, job.num);
- const jobObject = jobs.get(job.id);
- jobObject.data = data.buffer;
- jobObject.ext = data.fileExtension;
- let verifyPromise;
- if (!jobObject.tag) {
- verifyPromise = waitForVerify(jobObject.verifyEvent);
- } else {
- verifyPromise = Promise.resolve(jobObject.tag);
- }
- verifyPromise.then(tag => {
- jobs.set(job.id, jobObject);
- const waitResponse = Buffer.concat([Buffer.from([Rwait]), tag]);
- ws.send(waitResponse);
- resolve();
- });
- });
- worker.once("error", (e) => {
- clearTimeout(timeout);
- reject(e);
- });
- });
-};
+import { config } from "dotenv";
+config();
+import { cpus } from "os";
+import { Worker } from "worker_threads";
+import { join } from "path";
+import { createServer } from "http";
+import { WebSocketServer } from "ws";
+import { fileURLToPath } from "url";
+import { dirname } from "path";
+import { createRequire } from "module";
+import EventEmitter from "events";
+
+const nodeRequire = createRequire(import.meta.url);
+const img = nodeRequire(`../build/${process.env.DEBUG && process.env.DEBUG === "true" ? "Debug" : "Release"}/image.node`);
+
+const Rerror = 0x01;
+const Tqueue = 0x02;
+const Rqueue = 0x03;
+const Tcancel = 0x04;
+const Rcancel = 0x05;
+const Twait = 0x06;
+const Rwait = 0x07;
+const Rinit = 0x08;
+
+const start = process.hrtime();
+const log = (msg, jobNum) => {
+ console.log(`[${process.hrtime(start)[1] / 1000000}${jobNum ? `:${jobNum}` : ""}]\t ${msg}`);
+};
+const error = (msg, jobNum) => {
+ console.error(`[${process.hrtime(start)[1] / 1000000}${jobNum ? `:${jobNum}` : ""}]\t ${msg}`);
+};
+
+class JobCache extends Map {
+ set(key, value) {
+ super.set(key, value);
+ setTimeout(() => {
+ if (super.has(key) && this.get(key) === value && value.data) super.delete(key);
+ }, 300000); // delete jobs if not requested after 5 minutes
+ }
+}
+
+const jobs = new JobCache();
+// Should look like ID : { msg: "request", num: }
+const queue = [];
+// Array of IDs
+
+const MAX_JOBS = process.env.JOBS ? parseInt(process.env.JOBS) : cpus().length * 4; // Completely arbitrary, should usually be some multiple of your amount of cores
+const PASS = process.env.PASS ? process.env.PASS : undefined;
+let jobAmount = 0;
+
+const acceptJob = (id, sock) => {
+ jobAmount++;
+ queue.shift();
+ const job = jobs.get(id);
+ return runJob({
+ id: id,
+ msg: job.msg,
+ num: job.num
+ }, sock).then(() => {
+ log(`Job ${id} has finished`);
+ }).catch((err) => {
+ error(`Error on job ${id}: ${err}`, job.num);
+ const newJob = jobs.get(id);
+ if (!newJob.tag) {
+ newJob.error = err.message;
+ jobs.set(id, newJob);
+ return;
+ }
+ jobs.delete(id);
+ sock.send(Buffer.concat([Buffer.from([Rerror]), newJob.tag, Buffer.from(err.message)]));
+ }).finally(() => {
+ jobAmount--;
+ if (queue.length > 0) {
+ acceptJob(queue[0], sock);
+ }
+ });
+};
+
+const waitForVerify = (event) => {
+ return new Promise((resolve, reject) => {
+ event.once("end", (r) => resolve(r));
+ event.once("error", (e) => reject(e));
+ });
+};
+
+const wss = new WebSocketServer({ clientTracking: true, noServer: true });
+
+wss.on("connection", (ws, request) => {
+ log(`WS client ${request.socket.remoteAddress}:${request.socket.remotePort} has connected`);
+ const num = Buffer.alloc(2);
+ num.writeUInt16LE(MAX_JOBS);
+ const cur = Buffer.alloc(2);
+ cur.writeUInt16LE(jobAmount);
+ const formats = {};
+ for (const cmd of img.funcs) {
+ formats[cmd] = ["image/png", "image/gif", "image/jpeg", "image/webp"];
+ }
+ const init = Buffer.concat([Buffer.from([Rinit]), Buffer.from([0x00, 0x00]), num, cur, Buffer.from(JSON.stringify(formats))]);
+ ws.send(init);
+
+ ws.on("error", (err) => {
+ error(err);
+ });
+
+ ws.on("message", (msg) => {
+ const opcode = msg.readUint8(0);
+ const tag = msg.slice(1, 3);
+ const req = msg.toString().slice(3);
+ if (opcode == Tqueue) {
+ const id = msg.readBigInt64LE(3);
+ const obj = msg.slice(11);
+ const job = { msg: obj, num: jobAmount, verifyEvent: new EventEmitter() };
+ jobs.set(id, job);
+ queue.push(id);
+
+ const newBuffer = Buffer.concat([Buffer.from([Rqueue]), tag]);
+ ws.send(newBuffer);
+
+ if (jobAmount < MAX_JOBS) {
+ log(`Got WS request for job ${job.msg} with id ${id}`, job.num);
+ acceptJob(id, ws);
+ } else {
+ log(`Got WS request for job ${job.msg} with id ${id}, queued in position ${queue.indexOf(id)}`, job.num);
+ }
+ } else if (opcode == Tcancel) {
+ delete queue[queue.indexOf(req) - 1];
+ jobs.delete(req);
+ const cancelResponse = Buffer.concat([Buffer.from([Rcancel]), tag]);
+ ws.send(cancelResponse);
+ } else if (opcode == Twait) {
+ const id = msg.readBigUInt64LE(3);
+ const job = jobs.get(id);
+ if (!job) {
+ const errorResponse = Buffer.concat([Buffer.from([Rerror]), tag, Buffer.from("Invalid job ID")]);
+ ws.send(errorResponse);
+ return;
+ }
+ if (job.error) {
+ job.verifyEvent.emit("error", job.error);
+ jobs.delete(id);
+ const errorResponse = Buffer.concat([Buffer.from([Rerror]), tag, Buffer.from(job.error)]);
+ ws.send(errorResponse);
+ return;
+ }
+ job.verifyEvent.emit("end", tag);
+ job.tag = tag;
+ jobs.set(id, job);
+ //const waitResponse = Buffer.concat([Buffer.from([Rwait]), tag]);
+ //ws.send(waitResponse);
+ } else {
+ log("Could not parse WS message");
+ }
+ });
+
+ ws.on("close", () => {
+ log(`WS client ${request.socket.remoteAddress}:${request.socket.remotePort} has disconnected`);
+ });
+});
+
+wss.on("error", (err) => {
+ error("A WS error occurred: ", err);
+});
+
+const httpServer = createServer();
+
+httpServer.on("request", async (req, res) => {
+ if (req.method !== "GET") {
+ res.statusCode = 405;
+ return res.end("405 Method Not Allowed");
+ }
+ if (PASS && req.headers.authentication !== PASS) {
+ res.statusCode = 401;
+ return res.end("401 Unauthorized");
+ }
+ const reqUrl = new URL(req.url, `http://${req.headers.host}`);
+ if (reqUrl.pathname === "/image" && req.method === "GET") {
+ if (!reqUrl.searchParams.has("id")) {
+ res.statusCode = 400;
+ return res.end("400 Bad Request");
+ }
+ const id = BigInt(reqUrl.searchParams.get("id"));
+ if (!jobs.has(id)) {
+ res.statusCode = 410;
+ return res.end("410 Gone");
+ }
+ log(`Sending image data for job ${id} to ${req.socket.remoteAddress}:${req.socket.remotePort} via HTTP`);
+ const ext = jobs.get(id).ext;
+ let contentType;
+ switch (ext) {
+ case "gif":
+ contentType = "image/gif";
+ break;
+ case "png":
+ contentType = "image/png";
+ break;
+ case "jpeg":
+ case "jpg":
+ contentType = "image/jpeg";
+ break;
+ case "webp":
+ contentType = "image/webp";
+ break;
+ }
+ if (contentType) res.setHeader("Content-Type", contentType);
+ else res.setHeader("Content-Type", ext);
+ const data = jobs.get(id).data;
+ jobs.delete(id);
+ return res.end(data, (err) => {
+ if (err) error(err);
+ });
+ } else if (reqUrl.pathname === "/count" && req.method === "GET") {
+ log(`Sending job count to ${req.socket.remoteAddress}:${req.socket.remotePort} via HTTP`);
+ return res.end(jobAmount.toString(), (err) => {
+ if (err) error(err);
+ });
+ } else {
+ res.statusCode = 404;
+ return res.end("404 Not Found");
+ }
+});
+
+httpServer.on("upgrade", (req, sock, head) => {
+ const reqUrl = new URL(req.url, `http://${req.headers.host}`);
+
+ if (PASS && req.headers.authentication !== PASS) {
+ sock.write("HTTP/1.1 401 Unauthorized\r\n\r\n");
+ sock.destroy();
+ return;
+ }
+
+ if (reqUrl.pathname === "/sock") {
+ wss.handleUpgrade(req, sock, head, (ws) => {
+ wss.emit("connection", ws, req);
+ });
+ } else {
+ sock.destroy();
+ }
+});
+
+httpServer.on("error", (e) => {
+ error("An HTTP error occurred: ", e);
+});
+const port = parseInt(process.env.PORT) || 3762;
+httpServer.listen(port, () => {
+ log("HTTP and WS listening on port 3762");
+});
+
+const runJob = (job, ws) => {
+ return new Promise((resolve, reject) => {
+ log(`Job ${job.id} starting...`, job.num);
+
+ const object = JSON.parse(job.msg);
+ // If the image has a path, it must also have a type
+ if (object.path && !object.params.type) {
+ reject(new TypeError("Unknown image type"));
+ }
+
+ const worker = new Worker(join(dirname(fileURLToPath(import.meta.url)), "../utils/image-runner.js"), {
+ workerData: object
+ });
+ const timeout = setTimeout(() => {
+ worker.terminate();
+ reject(new Error("Job timed out"));
+ }, 900000);
+ log(`Job ${job.id} started`, job.num);
+ worker.once("message", (data) => {
+ clearTimeout(timeout);
+ log(`Sending result of job ${job.id} back to the bot`, job.num);
+ const jobObject = jobs.get(job.id);
+ jobObject.data = data.buffer;
+ jobObject.ext = data.fileExtension;
+ let verifyPromise;
+ if (!jobObject.tag) {
+ verifyPromise = waitForVerify(jobObject.verifyEvent);
+ } else {
+ verifyPromise = Promise.resolve(jobObject.tag);
+ }
+ verifyPromise.then(tag => {
+ jobs.set(job.id, jobObject);
+ const waitResponse = Buffer.concat([Buffer.from([Rwait]), tag]);
+ ws.send(waitResponse);
+ resolve();
+ });
+ });
+ worker.once("error", (e) => {
+ clearTimeout(timeout);
+ reject(e);
+ });
+ });
+};
diff --git a/app.js b/app.js
index 9cce4ac..d712148 100644
--- a/app.js
+++ b/app.js
@@ -1,228 +1,190 @@
-if (process.versions.node.split(".")[0] < 16) {
- console.error(`You are currently running Node.js version ${process.version}.
-esmBot requires Node.js version 16 or above.
-Please refer to step 3 of the setup guide.`);
- process.exit(1);
-}
-if (process.platform === "win32") {
- console.error("\x1b[1m\x1b[31m\x1b[40m" + `WINDOWS IS NOT OFFICIALLY SUPPORTED!
-Although there's a (very) slim chance of it working, multiple aspects of the bot are built with UNIX-like systems in mind and could break on Win32-based systems. If you want to run the bot on Windows, using Windows Subsystem for Linux is highly recommended.
-The bot will continue to run past this message in 5 seconds, but keep in mind that it could break at any time. Continue running at your own risk; alternatively, stop the bot using Ctrl+C and install WSL.` + "\x1b[0m");
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 5000);
-}
-
-// load config from .env file
-import { resolve, dirname } from "path";
-import { fileURLToPath } from "url";
-import { config } from "dotenv";
-config({ path: resolve(dirname(fileURLToPath(import.meta.url)), ".env") });
-
-import { reloadImageConnections } from "./utils/image.js";
-
-// main services
-import { Client } from "oceanic.js";
-import pm2 from "pm2";
-// some utils
-import { promises, readFileSync } from "fs";
-import { logger } from "./utils/logger.js";
-import { exec as baseExec } from "child_process";
-import { promisify } from "util";
-const exec = promisify(baseExec);
-// initialize command loader
-import { load } from "./utils/handler.js";
-// command collections
-import { paths } from "./utils/collections.js";
-// database stuff
-import database from "./utils/database.js";
-// lavalink stuff
-import { reload, connect, connected } from "./utils/soundplayer.js";
-// events
-import { endBroadcast, startBroadcast } from "./utils/misc.js";
-import { parseThreshold } from "./utils/tempimages.js";
-
-const { types } = JSON.parse(readFileSync(new URL("./config/commands.json", import.meta.url)));
-const esmBotVersion = JSON.parse(readFileSync(new URL("./package.json", import.meta.url))).version;
-process.env.ESMBOT_VER = esmBotVersion;
-
-const intents = [
- "GUILD_VOICE_STATES",
- "DIRECT_MESSAGES",
- "GUILDS"
-];
-if (types.classic) {
- intents.push("GUILD_MESSAGES");
- intents.push("MESSAGE_CONTENT");
-}
-
-async function* getFiles(dir) {
- const dirents = await promises.readdir(dir, { withFileTypes: true });
- for (const dirent of dirents) {
- const name = dir + (dir.charAt(dir.length - 1) !== "/" ? "/" : "") + dirent.name;
- if (dirent.isDirectory()) {
- yield* getFiles(name);
- } else if (dirent.name.endsWith(".js")) {
- yield name;
- }
- }
-}
-
-async function init() {
- await exec("git rev-parse HEAD").then(output => output.stdout.substring(0, 7), () => "unknown commit").then(o => process.env.GIT_REV = o);
- console.log(`
- ,*\`$ z\`"v
- F zBw\`% A ,W "W
- ,\` ,EBBBWp"%. ,-=~~==-,+* 4BBE T
- M BBBBBBBB* ,w=####Wpw 4BBBBB# 1
- F BBBBBBBMwBBBBBBBBBBBBB#wXBBBBBH E
- F BBBBBBkBBBBBBBBBBBBBBBBBBBBE4BL k
- # BFBBBBBBBBBBBBF" "RBBBW F
- V ' 4BBBBBBBBBBM TBBL F
- F BBBBBBBBBBF JBB L
- F FBBBBBBBEB BBL 4
- E [BB4BBBBEBL BBL 4
- I #BBBBBBBEB 4BBH *w
- A 4BBBBBBBBBEW, ,BBBB W [
-.A ,k 4BBBBBBBBBBBEBW####BBBBBBM BF F
-k {
- if (err) {
- logger.error(err);
- return;
- }
- pm2.list((err, list) => {
- if (err) {
- logger.error(err);
- return;
- }
- const managerProc = list.filter((v) => v.name === "esmBot-manager")[0];
- pm2Bus.on("process:msg", async (packet) => {
- switch (packet.data?.type) {
- case "reload":
- var path = paths.get(packet.data.message);
- await load(client, path, true);
- break;
- case "soundreload":
- await reload(client);
- break;
- case "imagereload":
- await reloadImageConnections();
- break;
- case "broadcastStart":
- startBroadcast(client, packet.data.message);
- break;
- case "broadcastEnd":
- endBroadcast(client);
- break;
- case "serverCounts":
- pm2.sendDataToProcessId(managerProc.pm_id, {
- id: managerProc.pm_id,
- type: "process:msg",
- data: {
- type: "serverCounts",
- guilds: client.guilds.size,
- shards: client.shards.size
- },
- topic: true
- }, (err) => {
- if (err) logger.error(err);
- });
- break;
- }
- });
- });
- });
- }
-
- // connect to lavalink
- if (!connected) connect(client);
-
- client.connect();
-}
-
+if (process.versions.node.split(".")[0] < 16) {
+ console.error(`You are currently running Node.js version ${process.version}.
+esmBot requires Node.js version 16 or above.
+Please refer to step 3 of the setup guide.`);
+ process.exit(1);
+}
+if (process.platform === "win32") {
+ console.error("\x1b[1m\x1b[31m\x1b[40m" + `WINDOWS IS NOT OFFICIALLY SUPPORTED!
+Although there's a (very) slim chance of it working, multiple aspects of the bot are built with UNIX-like systems in mind and could break on Win32-based systems. If you want to run the bot on Windows, using Windows Subsystem for Linux is highly recommended.
+The bot will continue to run past this message in 5 seconds, but keep in mind that it could break at any time. Continue running at your own risk; alternatively, stop the bot using Ctrl+C and install WSL.` + "\x1b[0m");
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 5000);
+}
+
+// load config from .env file
+import { resolve, dirname } from "path";
+import { fileURLToPath } from "url";
+import { config } from "dotenv";
+config({ path: resolve(dirname(fileURLToPath(import.meta.url)), ".env") });
+
+import { reloadImageConnections } from "./utils/image.js";
+
+// main services
+// import { Client } from "oceanic.js";
+import * as sdk from "matrix-js-sdk";
+const AutojoinRoomsMixin = sdk.AutojoinRoomsMixin;
+
+
+
+
+import pm2 from "pm2";
+// some utils
+import { promises, readFileSync } from "fs";
+import { logger } from "./utils/logger.js";
+import { exec as baseExec } from "child_process";
+import { promisify } from "util";
+const exec = promisify(baseExec);
+// initialize command loader
+import { load } from "./utils/handler.js";
+// command collections
+import { paths } from "./utils/collections.js";
+// database stuff
+import database from "./utils/database.js";
+// lavalink stuff
+import { reload, connect, connected } from "./utils/soundplayer.js";
+// events
+import { endBroadcast, startBroadcast } from "./utils/misc.js";
+import { parseThreshold } from "./utils/tempimages.js";
+
+const { types } = JSON.parse(readFileSync(new URL("./config/commands.json", import.meta.url)));
+const esmBotVersion = JSON.parse(readFileSync(new URL("./package.json", import.meta.url))).version;
+process.env.ESMBOT_VER = esmBotVersion;
+
+// const intents = [
+// "GUILD_VOICE_STATES",
+// "DIRECT_MESSAGES",
+// "GUILDS"
+// ];
+// if (types.classic) {
+// intents.push("GUILD_MESSAGES");
+// intents.push("MESSAGE_CONTENT");
+// }
+
+async function* getFiles(dir) {
+ const dirents = await promises.readdir(dir, { withFileTypes: true });
+ for (const dirent of dirents) {
+ const name = dir + (dir.charAt(dir.length - 1) !== "/" ? "/" : "") + dirent.name;
+ if (dirent.isDirectory()) {
+ yield* getFiles(name);
+ } else if (dirent.name.endsWith(".js")) {
+ yield name;
+ }
+ }
+}
+
+async function init() {
+ await exec("git rev-parse HEAD").then(output => output.stdout.substring(0, 7), () => "unknown commit").then(o => process.env.GIT_REV = o);
+ console.log(`
+ ,*\`$ z\`"v
+ F zBw\`% A ,W "W
+ ,\` ,EBBBWp"%. ,-=~~==-,+* 4BBE T
+ M BBBBBBBB* ,w=####Wpw 4BBBBB# 1
+ F BBBBBBBMwBBBBBBBBBBBBB#wXBBBBBH E
+ F BBBBBBkBBBBBBBBBBBBBBBBBBBBE4BL k
+ # BFBBBBBBBBBBBBF" "RBBBW F
+ V ' 4BBBBBBBBBBM TBBL F
+ F BBBBBBBBBBF JBB L
+ F FBBBBBBBEB BBL 4
+ E [BB4BBBBEBL BBL 4
+ I #BBBBBBBEB 4BBH *w
+ A 4BBBBBBBBBEW, ,BBBB W [
+.A ,k 4BBBBBBBBBBBEBW####BBBBBBM BF F
+k logger.log("info", "Client started!"));
+}
+
init();
\ No newline at end of file
diff --git a/application.yml b/application.yml
index 96c4464..23173ce 100644
--- a/application.yml
+++ b/application.yml
@@ -1,72 +1,72 @@
-server: # REST and WS server
- port: 2333
- address: 0.0.0.0
-lavalink:
- server:
- password: "youshallnotpass"
- sources:
- youtube: true
- bandcamp: true
- soundcloud: true
- twitch: true
- vimeo: true
- mixer: true
- http: true
- local: true
- bufferDurationMs: 400
- youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
- playerUpdateInterval: 1
- youtubeSearchEnabled: true
- soundcloudSearchEnabled: true
- gc-warnings: true
- #ratelimit:
- #ipBlocks: ["1.0.0.0/8", "..."] # list of ip blocks
- #excludedIps: ["...", "..."] # ips which should be explicit excluded from usage by lavalink
- #strategy: "RotateOnBan" # RotateOnBan | LoadBalance | NanoSwitch | RotatingNanoSwitch
- #searchTriggersFail: true # Whether a search 429 should trigger marking the ip as failing
- #retryLimit: -1 # -1 = use default lavaplayer value | 0 = infinity | >0 = retry will happen this numbers times
- plugins:
- - dependency: "com.github.esmBot:lava-xm-plugin:v0.2.1"
- repository: "https://jitpack.io"
- - dependency: "com.github.TopiSenpai.LavaSrc:lavasrc-plugin:3.2.0"
- repository: "https://jitpack.io"
-
-plugins:
- lavasrc:
- providers:
- - "ytsearch:\"%ISRC%\""
- - "ytsearch:%QUERY%"
- sources:
- spotify: false
- applemusic: true
- deezer: false
- spotify:
- clientId: "your client id"
- clientSecret: "your client secret"
- countryCode: "US"
- applemusic:
- countryCode: "US"
- deezer:
- masterDecryptionKey: "go looking for this somewhere"
-
-metrics:
- prometheus:
- enabled: false
- endpoint: /metrics
-
-sentry:
- dsn: ""
-# tags:
-# some_key: some_value
-# another_key: another_value
-
-logging:
- file:
- max-history: 30
- max-size: 1GB
- path: ./logs/
-
- level:
- root: INFO
- lavalink: INFO
-
+server: # REST and WS server
+ port: 2333
+ address: 0.0.0.0
+lavalink:
+ server:
+ password: "youshallnotpass"
+ sources:
+ youtube: true
+ bandcamp: true
+ soundcloud: true
+ twitch: true
+ vimeo: true
+ mixer: true
+ http: true
+ local: true
+ bufferDurationMs: 400
+ youtubePlaylistLoadLimit: 6 # Number of pages at 100 each
+ playerUpdateInterval: 1
+ youtubeSearchEnabled: true
+ soundcloudSearchEnabled: true
+ gc-warnings: true
+ #ratelimit:
+ #ipBlocks: ["1.0.0.0/8", "..."] # list of ip blocks
+ #excludedIps: ["...", "..."] # ips which should be explicit excluded from usage by lavalink
+ #strategy: "RotateOnBan" # RotateOnBan | LoadBalance | NanoSwitch | RotatingNanoSwitch
+ #searchTriggersFail: true # Whether a search 429 should trigger marking the ip as failing
+ #retryLimit: -1 # -1 = use default lavaplayer value | 0 = infinity | >0 = retry will happen this numbers times
+ plugins:
+ - dependency: "com.github.esmBot:lava-xm-plugin:v0.2.1"
+ repository: "https://jitpack.io"
+ - dependency: "com.github.TopiSenpai.LavaSrc:lavasrc-plugin:3.2.0"
+ repository: "https://jitpack.io"
+
+plugins:
+ lavasrc:
+ providers:
+ - "ytsearch:\"%ISRC%\""
+ - "ytsearch:%QUERY%"
+ sources:
+ spotify: false
+ applemusic: true
+ deezer: false
+ spotify:
+ clientId: "your client id"
+ clientSecret: "your client secret"
+ countryCode: "US"
+ applemusic:
+ countryCode: "US"
+ deezer:
+ masterDecryptionKey: "go looking for this somewhere"
+
+metrics:
+ prometheus:
+ enabled: false
+ endpoint: /metrics
+
+sentry:
+ dsn: ""
+# tags:
+# some_key: some_value
+# another_key: another_value
+
+logging:
+ file:
+ max-history: 30
+ max-size: 1GB
+ path: ./logs/
+
+ level:
+ root: INFO
+ lavalink: INFO
+
diff --git a/classes/command.js b/classes/command.js
index 54b1f4e..3471e4c 100644
--- a/classes/command.js
+++ b/classes/command.js
@@ -1,71 +1,71 @@
-class Command {
- success = true;
- constructor(client, options) {
- this.client = client;
- this.origOptions = options;
- this.type = options.type;
- this.args = options.args;
- if (options.type === "classic") {
- this.message = options.message;
- this.channel = options.message.channel;
- this.guild = options.message.guild;
- this.author = options.message.author;
- this.member = options.message.member;
- this.content = options.content;
- this.options = options.specialArgs;
- this.reference = {
- messageReference: {
- channelID: this.message.channelID,
- messageID: this.message.id,
- guildID: this.message.guildID ?? undefined,
- failIfNotExists: false
- },
- allowedMentions: {
- repliedUser: false
- }
- };
- } else if (options.type === "application") {
- this.interaction = options.interaction;
- this.args = [];
- this.channel = options.interaction.channel;
- this.guild = options.interaction.guild;
- this.author = this.member = options.interaction.guildID ? options.interaction.member : options.interaction.user;
- if (options.interaction.data.options) {
- this.options = options.interaction.data.options.raw.reduce((obj, item) => {
- obj[item.name] = item.value;
- return obj;
- }, {});
- this.optionsArray = options.interaction.data.options.raw;
- } else {
- this.options = {};
- }
- }
- }
-
- async run() {
- return "It works!";
- }
-
- async acknowledge() {
- if (this.type === "classic") {
- const channel = this.channel ?? await this.client.rest.channels.get(this.message.channelID);
- await channel.sendTyping();
- } else if (!this.interaction.acknowledged) {
- await this.interaction.defer();
- }
- }
-
- static init() {
- return this;
- }
-
- static description = "No description found";
- static aliases = [];
- static arguments = [];
- static flags = [];
- static slashAllowed = true;
- static directAllowed = true;
- static adminOnly = false;
-}
-
+class Command {
+ success = true;
+ constructor(matrixClient, options) {
+ this.client = matrixClient;
+ this.origOptions = options;
+ this.type = options.type;
+ this.args = options.args;
+ if (options.type === "classic") {
+ this.message = options.message;
+ this.channel = options.message.room_id;
+ this.guild = options.message.guild;
+ this.author = options.message.sender;
+ this.member = options.message.member;
+ this.content = options.content;
+ this.options = options.specialArgs;
+ this.reference = {
+ messageReference: {
+ channelID: this.message.channelID,
+ messageID: this.message.id,
+ guildID: this.message.guildID ?? undefined,
+ failIfNotExists: false
+ },
+ allowedMentions: {
+ repliedUser: false
+ }
+ };
+ } else if (options.type === "application") {
+ this.interaction = options.interaction;
+ this.args = [];
+ this.channel = options.interaction.channel;
+ this.guild = options.interaction.guild;
+ this.author = this.member = options.interaction.guildID ? options.interaction.member : options.interaction.user;
+ if (options.interaction.data.options) {
+ this.options = options.interaction.data.options.raw.reduce((obj, item) => {
+ obj[item.name] = item.value;
+ return obj;
+ }, {});
+ this.optionsArray = options.interaction.data.options.raw;
+ } else {
+ this.options = {};
+ }
+ }
+ }
+
+ async run() {
+ return "It works!";
+ }
+
+ async acknowledge() {
+ if (this.type === "classic") {
+ const channel = this.channel;
+ await this.client.sendTyping(channel, true, 5);
+ } else if (!this.interaction.acknowledged) {
+ await this.interaction.defer();
+ }
+ }
+
+ static init() {
+ return this;
+ }
+
+ static description = "No description found";
+ static aliases = [];
+ static arguments = [];
+ static flags = [];
+ static slashAllowed = true;
+ static directAllowed = true;
+ static adminOnly = false;
+}
+
export default Command;
\ No newline at end of file
diff --git a/classes/imageCommand.js b/classes/imageCommand.js
index 554a17b..163af8e 100644
--- a/classes/imageCommand.js
+++ b/classes/imageCommand.js
@@ -1,153 +1,160 @@
-import Command from "./command.js";
-import imageDetect from "../utils/imagedetect.js";
-import { runImageJob } from "../utils/image.js";
-import { runningCommands } from "../utils/collections.js";
-import { readFileSync } from "fs";
-const { emotes } = JSON.parse(readFileSync(new URL("../config/messages.json", import.meta.url)));
-import { random } from "../utils/misc.js";
-import { selectedImages } from "../utils/collections.js";
-
-class ImageCommand extends Command {
- async criteria() {
- return true;
- }
-
- async run() {
- this.success = false;
- const timestamp = this.type === "classic" ? this.message.createdAt : Math.floor((this.interaction.id / 4194304) + 1420070400000);
- // check if this command has already been run in this channel with the same arguments, and we are awaiting its result
- // if so, don't re-run it
- if (runningCommands.has(this.author.id) && (new Date(runningCommands.get(this.author.id)) - new Date(timestamp)) < 5000) {
- return "Please slow down a bit.";
- }
- // before awaiting the command result, add this command to the set of running commands
- runningCommands.set(this.author.id, timestamp);
-
- const imageParams = {
- cmd: this.constructor.command,
- params: {
- togif: !!this.options.togif
- },
- id: (this.interaction ?? this.message).id
- };
-
- if (this.type === "application") await this.acknowledge();
-
- if (this.constructor.requiresImage) {
- try {
- const selection = selectedImages.get(this.author.id);
- const image = selection ?? await imageDetect(this.client, this.message, this.interaction, this.options, true);
- if (selection) selectedImages.delete(this.author.id);
- if (image === undefined) {
- runningCommands.delete(this.author.id);
- return `${this.constructor.noImage} (Tip: try right-clicking/holding on a message and press Apps -> Select Image, then try again.)`;
- } else if (image.type === "large") {
- runningCommands.delete(this.author.id);
- return "That image is too large (>= 25MB)! Try using a smaller image.";
- } else if (image.type === "tenorlimit") {
- runningCommands.delete(this.author.id);
- return "I've been rate-limited by Tenor. Please try uploading your GIF elsewhere.";
- }
- imageParams.path = image.path;
- imageParams.params.type = image.type;
- imageParams.url = image.url; // technically not required but can be useful for text filtering
- imageParams.name = image.name;
- if (this.constructor.requiresGIF) imageParams.onlyGIF = true;
- } catch (e) {
- runningCommands.delete(this.author.id);
- throw e;
- }
- }
-
- if (this.constructor.requiresText) {
- const text = this.options.text ?? this.args.join(" ").trim();
- if (text.length === 0 || !await this.criteria(text, imageParams.url)) {
- runningCommands.delete(this.author.id);
- return this.constructor.noText;
- }
- }
-
- if (typeof this.params === "function") {
- Object.assign(imageParams.params, this.params(imageParams.url, imageParams.name));
- } else if (typeof this.params === "object") {
- Object.assign(imageParams.params, this.params);
- }
-
- let status;
- if (imageParams.params.type === "image/gif" && this.type === "classic") {
- status = await this.processMessage(this.message.channel ?? await this.client.rest.channels.get(this.message.channelID));
- }
-
- try {
- const { buffer, type } = await runImageJob(imageParams);
- if (type === "nogif" && this.constructor.requiresGIF) {
- return "That isn't a GIF!";
- }
- this.success = true;
- return {
- contents: buffer,
- name: `${this.constructor.command}.${type}`
- };
- } catch (e) {
- if (e === "Request ended prematurely due to a closed connection") return "This image job couldn't be completed because the server it was running on went down. Try running your command again.";
- if (e === "Job timed out" || e === "Timeout") return "The image is taking too long to process (>=15 minutes), so the job was cancelled. Try using a smaller image.";
- if (e === "No available servers") return "I can't seem to contact the image servers, they might be down or still trying to start up. Please wait a little bit.";
- throw e;
- } finally {
- try {
- if (status) await status.delete();
- } catch {
- // no-op
- }
- runningCommands.delete(this.author.id);
- }
-
- }
-
- processMessage(channel) {
- return channel.createMessage({
- content: `${random(emotes) || process.env.PROCESSING_EMOJI || ""} Processing... This might take a while`
- });
- }
-
- static init() {
- this.flags = [];
- if (this.requiresText || this.textOptional) {
- this.flags.push({
- name: "text",
- type: 3,
- description: "The text to put on the image",
- required: !this.textOptional
- });
- }
- if (this.requiresImage) {
- this.flags.push({
- name: "image",
- type: 11,
- description: "An image/GIF attachment"
- }, {
- name: "link",
- type: 3,
- description: "An image/GIF URL"
- });
- }
- this.flags.push({
- name: "togif",
- type: 5,
- description: "Force GIF output"
- });
- return this;
- }
-
- static allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto", "times", "comic sans ms"];
-
- static requiresImage = true;
- static requiresText = false;
- static textOptional = false;
- static requiresGIF = false;
- static noImage = "You need to provide an image/GIF!";
- static noText = "You need to provide some text!";
- static command = "";
-}
-
-export default ImageCommand;
+import Command from "./command.js";
+import imageDetect from "../utils/imagedetect.js";
+import { runImageJob } from "../utils/image.js";
+import { runningCommands } from "../utils/collections.js";
+import { readFileSync } from "fs";
+const { emotes } = JSON.parse(readFileSync(new URL("../config/messages.json", import.meta.url)));
+import { random } from "../utils/misc.js";
+import { selectedImages } from "../utils/collections.js";
+
+class ImageCommand extends Command {
+ async criteria() {
+ return true;
+ }
+
+ async run() {
+ this.success = false;
+ const timestamp = this.type === "classic" ? this.message.createdAt : Math.floor((this.interaction.id / 4194304) + 1420070400000);
+ // check if this command has already been run in this channel with the same arguments, and we are awaiting its result
+ // if so, don't re-run it
+ if (runningCommands.has(this.author) && (new Date(runningCommands.get(this.author)) - new Date(timestamp)) < 5000) {
+ return "Please slow down a bit.";
+ }
+ // before awaiting the command result, add this command to the set of running commands
+ runningCommands.set(this.author, timestamp);
+
+ const imageParams = {
+ cmd: this.constructor.command,
+ params: {
+ togif: !!this.options.togif
+ },
+ id: this.message.event_id
+ };
+
+ // if (this.type === "application") await this.acknowledge();
+
+ if (this.constructor.requiresImage) {
+ try {
+ const selection = selectedImages.get(this.author);
+ const image = await imageDetect(this.client, this.message, this.interaction, this.options, true);
+ if (selection) selectedImages.delete(this.author);
+ if (image === undefined) {
+ runningCommands.delete(this.author);
+ return `${this.constructor.noImage} (Tip: try right-clicking/holding on a message and press Apps -> Select Image, then try again.)`;
+ } else if (image.type === "large") {
+ runningCommands.delete(this.author);
+ return "That image is too large (>= 25MB)! Try using a smaller image.";
+ } else if (image.type === "tenorlimit") {
+ runningCommands.delete(this.author);
+ return "I've been rate-limited by Tenor. Please try uploading your GIF elsewhere.";
+ }
+ imageParams.path = image.path;
+ imageParams.params.type = image.type;
+ imageParams.url = image.url; // technically not required but can be useful for text filtering
+ imageParams.name = image.name;
+ if (this.constructor.requiresGIF) imageParams.onlyGIF = true;
+ } catch (e) {
+ runningCommands.delete(this.author);
+ throw e;
+ }
+ }
+
+ if (this.constructor.requiresText) {
+ const text = this.options.text ?? this.args.join(" ").trim();
+ if (text.length === 0 || !await this.criteria(text, imageParams.url)) {
+ runningCommands.delete(this.author);
+ return this.constructor.noText;
+ }
+ }
+
+ if (typeof this.params === "function") {
+ Object.assign(imageParams.params, this.params(imageParams.url, imageParams.name));
+ } else if (typeof this.params === "object") {
+ Object.assign(imageParams.params, this.params);
+ }
+
+ let status;
+ if (imageParams.params.type === "image/gif" && this.type === "classic") {
+ status = await this.processMessage(this.message.room_id ?? await this.client.rest.channels.get(this.message.room_id));
+ }
+
+ try {
+ const { buffer, type } = await runImageJob(imageParams);
+ if (type === "nogif" && this.constructor.requiresGIF) {
+ return "That isn't a GIF!";
+ }
+ this.success = true;
+ return {
+ contents: buffer,
+ name: `${this.constructor.command}.${type}`
+ };
+ } catch (e) {
+ if (e === "Request ended prematurely due to a closed connection") return "This image job couldn't be completed because the server it was running on went down. Try running your command again.";
+ if (e === "Job timed out" || e === "Timeout") return "The image is taking too long to process (>=15 minutes), so the job was cancelled. Try using a smaller image.";
+ if (e === "No available servers") return "I can't seem to contact the image servers, they might be down or still trying to start up. Please wait a little bit.";
+ throw e;
+ } finally {
+ try {
+ if (status) await status.delete();
+ } catch {
+ // no-op
+ }
+ runningCommands.delete(this.author);
+ }
+
+ }
+
+ processMessage(channel) {
+ this.client.send
+ const content = {
+ body: "Processing... This might take a while",
+ msgtype: "m.text",
+ };
+ this.client.sendEvent(channel, "m.room.message", content, "", (err, res) => {
+ // console.log(res)
+ logger.log("error", err)
+ return res
+ });
+ }
+
+ static init() {
+ this.flags = [];
+ if (this.requiresText || this.textOptional) {
+ this.flags.push({
+ name: "text",
+ type: 3,
+ description: "The text to put on the image",
+ required: !this.textOptional
+ });
+ }
+ if (this.requiresImage) {
+ this.flags.push({
+ name: "image",
+ type: 11,
+ description: "An image/GIF attachment"
+ }, {
+ name: "link",
+ type: 3,
+ description: "An image/GIF URL"
+ });
+ }
+ this.flags.push({
+ name: "togif",
+ type: 5,
+ description: "Force GIF output"
+ });
+ return this;
+ }
+
+ static allowedFonts = ["futura", "impact", "helvetica", "arial", "roboto", "noto", "times", "comic sans ms"];
+
+ static requiresImage = true;
+ static requiresText = false;
+ static textOptional = false;
+ static requiresGIF = false;
+ static noImage = "You need to provide an image/GIF!";
+ static noText = "You need to provide some text!";
+ static command = "";
+}
+
+export default ImageCommand;
diff --git a/classes/musicCommand.js b/classes/musicCommand.js
index 86e581e..c3dc41e 100644
--- a/classes/musicCommand.js
+++ b/classes/musicCommand.js
@@ -1,17 +1,17 @@
-import Command from "./command.js";
-import { players, queues } from "../utils/soundplayer.js";
-
-class MusicCommand extends Command {
- constructor(client, options) {
- super(client, options);
- if (this.guild) {
- this.connection = players.get(this.guild.id);
- this.queue = queues.get(this.guild.id);
- }
- }
-
- static slashAllowed = false;
- static directAllowed = false;
-}
-
-export default MusicCommand;
+import Command from "./command.js";
+import { players, queues } from "../utils/soundplayer.js";
+
+class MusicCommand extends Command {
+ constructor(client, options) {
+ super(client, options);
+ if (this.guild) {
+ this.connection = players.get(this.guild.id);
+ this.queue = queues.get(this.guild.id);
+ }
+ }
+
+ static slashAllowed = false;
+ static directAllowed = false;
+}
+
+export default MusicCommand;
diff --git a/classes/soundboardCommand.js b/classes/soundboardCommand.js
index 259e885..897da2c 100644
--- a/classes/soundboardCommand.js
+++ b/classes/soundboardCommand.js
@@ -1,14 +1,14 @@
-import Command from "./command.js";
-import { play } from "../utils/soundplayer.js";
-
-// only exists to sort the various soundboard commands
-class SoundboardCommand extends Command {
- async run() {
- return play(this.client, this.constructor.file, { channel: this.channel, author: this.author, member: this.member, type: this.type, interaction: this.interaction });
- }
-
- static slashAllowed = false;
- static directAllowed = false;
-}
-
-export default SoundboardCommand;
+import Command from "./command.js";
+import { play } from "../utils/soundplayer.js";
+
+// only exists to sort the various soundboard commands
+class SoundboardCommand extends Command {
+ async run() {
+ return play(this.client, this.constructor.file, { channel: this.channel, author: this.author, member: this.member, type: this.type, interaction: this.interaction });
+ }
+
+ static slashAllowed = false;
+ static directAllowed = false;
+}
+
+export default SoundboardCommand;
diff --git a/commands/fun/8ball.js b/commands/fun/8ball.js
index 65e53e1..80f1bb1 100644
--- a/commands/fun/8ball.js
+++ b/commands/fun/8ball.js
@@ -1,43 +1,43 @@
-import Command from "../../classes/command.js";
-import { random } from "../../utils/misc.js";
-
-class EightBallCommand extends Command {
- static responses = [
- "It is certain",
- "It is decidedly so",
- "Without a doubt",
- "Yes, definitely",
- "You may rely on it",
- "As I see it, yes",
- "Most likely",
- "Outlook good",
- "Yes",
- "Signs point to yes",
- "Reply hazy, try again",
- "Ask again later",
- "Better not tell you now",
- "Cannot predict now",
- "Concentrate and ask again",
- "Don't count on it",
- "My reply is no",
- "My sources say no",
- "Outlook not so good",
- "Very doubtful"
- ];
-
- async run() {
- return `đą ${random(EightBallCommand.responses)}`;
- }
-
- static flags = [{
- name: "question",
- type: 3,
- description: "A question you want to ask the ball"
- }];
-
- static description = "Asks the magic 8-ball a question";
- static aliases = ["magicball", "magikball", "magic8ball", "magik8ball", "eightball"];
- static arguments = ["{text}"];
-}
-
+import Command from "../../classes/command.js";
+import { random } from "../../utils/misc.js";
+
+class EightBallCommand extends Command {
+ static responses = [
+ "It is certain",
+ "It is decidedly so",
+ "Without a doubt",
+ "Yes, definitely",
+ "You may rely on it",
+ "As I see it, yes",
+ "Most likely",
+ "Outlook good",
+ "Yes",
+ "Signs point to yes",
+ "Reply hazy, try again",
+ "Ask again later",
+ "Better not tell you now",
+ "Cannot predict now",
+ "Concentrate and ask again",
+ "Don't count on it",
+ "My reply is no",
+ "My sources say no",
+ "Outlook not so good",
+ "Very doubtful"
+ ];
+
+ async run() {
+ return `đą ${random(EightBallCommand.responses)}`;
+ }
+
+ static flags = [{
+ name: "question",
+ type: 3,
+ description: "A question you want to ask the ball"
+ }];
+
+ static description = "Asks the magic 8-ball a question";
+ static aliases = ["magicball", "magikball", "magic8ball", "magik8ball", "eightball"];
+ static arguments = ["{text}"];
+}
+
export default EightBallCommand;
\ No newline at end of file
diff --git a/commands/fun/ancient.js b/commands/fun/ancient.js
index c94d565..c32a814 100644
--- a/commands/fun/ancient.js
+++ b/commands/fun/ancient.js
@@ -1,27 +1,27 @@
-import { request } from "undici";
-import Command from "../../classes/command.js";
-
-class AncientCommand extends Command {
- async run() {
- await this.acknowledge();
- const controller = new AbortController();
- const timeout = setTimeout(() => {
- controller.abort();
- }, 15000);
- try {
- const data = await request("https://files.projectlounge.pw/meme/", { method: "HEAD", signal: controller.signal });
- clearTimeout(timeout);
- return `https://files.projectlounge.pw${data.headers.location}`;
- } catch (e) {
- if (e.name === "AbortError") {
- this.success = false;
- return "I couldn't get a meme in time. Maybe try again?";
- }
- }
- }
-
- static description = "Gets a random ancient meme";
- static aliases = ["old", "oldmeme", "badmeme"];
-}
-
+import { request } from "undici";
+import Command from "../../classes/command.js";
+
+class AncientCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const controller = new AbortController();
+ const timeout = setTimeout(() => {
+ controller.abort();
+ }, 15000);
+ try {
+ const data = await request("https://files.projectlounge.pw/meme/", { method: "HEAD", signal: controller.signal });
+ clearTimeout(timeout);
+ return `https://files.projectlounge.pw${data.headers.location}`;
+ } catch (e) {
+ if (e.name === "AbortError") {
+ this.success = false;
+ return "I couldn't get a meme in time. Maybe try again?";
+ }
+ }
+ }
+
+ static description = "Gets a random ancient meme";
+ static aliases = ["old", "oldmeme", "badmeme"];
+}
+
export default AncientCommand;
\ No newline at end of file
diff --git a/commands/fun/bird.js b/commands/fun/bird.js
index 5df6996..491aa18 100644
--- a/commands/fun/bird.js
+++ b/commands/fun/bird.js
@@ -1,28 +1,28 @@
-import { request } from "undici";
-import Command from "../../classes/command.js";
-
-class BirdCommand extends Command {
- async run() {
- await this.acknowledge();
- const controller = new AbortController();
- const timeout = setTimeout(() => {
- controller.abort();
- }, 15000);
- try {
- const imageData = await request("http://shibe.online/api/birds", { signal: controller.signal });
- clearTimeout(timeout);
- const json = await imageData.body.json();
- return json[0];
- } catch (e) {
- if (e.name === "AbortError") {
- this.success = false;
- return "I couldn't get a bird image in time. Maybe try again?";
- }
- }
- }
-
- static description = "Gets a random bird picture";
- static aliases = ["birb", "birds", "birbs"];
-}
-
+import { request } from "undici";
+import Command from "../../classes/command.js";
+
+class BirdCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const controller = new AbortController();
+ const timeout = setTimeout(() => {
+ controller.abort();
+ }, 15000);
+ try {
+ const imageData = await request("http://shibe.online/api/birds", { signal: controller.signal });
+ clearTimeout(timeout);
+ const json = await imageData.body.json();
+ return json[0];
+ } catch (e) {
+ if (e.name === "AbortError") {
+ this.success = false;
+ return "I couldn't get a bird image in time. Maybe try again?";
+ }
+ }
+ }
+
+ static description = "Gets a random bird picture";
+ static aliases = ["birb", "birds", "birbs"];
+}
+
export default BirdCommand;
\ No newline at end of file
diff --git a/commands/fun/cat.js b/commands/fun/cat.js
index f4e488e..8977341 100644
--- a/commands/fun/cat.js
+++ b/commands/fun/cat.js
@@ -1,27 +1,27 @@
-import { request } from "undici";
-import Command from "../../classes/command.js";
-
-class CatCommand extends Command {
- async run() {
- await this.acknowledge();
- const controller = new AbortController();
- const timeout = setTimeout(() => {
- controller.abort();
- }, 15000);
- try {
- const data = await request("https://files.projectlounge.pw/cta/", { method: "HEAD", signal: controller.signal });
- clearTimeout(timeout);
- return `https://files.projectlounge.pw${data.headers.location}`;
- } catch (e) {
- if (e.name === "AbortError") {
- this.success = false;
- return "I couldn't get a cat image in time. Maybe try again?";
- }
- }
- }
-
- static description = "Gets a random cat picture";
- static aliases = ["kitters", "kitties", "kitty", "cattos", "catto", "cats", "cta"];
-}
-
+import { request } from "undici";
+import Command from "../../classes/command.js";
+
+class CatCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const controller = new AbortController();
+ const timeout = setTimeout(() => {
+ controller.abort();
+ }, 15000);
+ try {
+ const data = await request("https://files.projectlounge.pw/cta/", { method: "HEAD", signal: controller.signal });
+ clearTimeout(timeout);
+ return `https://files.projectlounge.pw${data.headers.location}`;
+ } catch (e) {
+ if (e.name === "AbortError") {
+ this.success = false;
+ return "I couldn't get a cat image in time. Maybe try again?";
+ }
+ }
+ }
+
+ static description = "Gets a random cat picture";
+ static aliases = ["kitters", "kitties", "kitty", "cattos", "catto", "cats", "cta"];
+}
+
export default CatCommand;
\ No newline at end of file
diff --git a/commands/fun/dice.js b/commands/fun/dice.js
index c085827..18bd87b 100644
--- a/commands/fun/dice.js
+++ b/commands/fun/dice.js
@@ -1,25 +1,25 @@
-import Command from "../../classes/command.js";
-
-class DiceCommand extends Command {
- async run() {
- const max = this.options.max ?? parseInt(this.args[0]);
- if (!max) {
- return `đ˛ The dice landed on ${Math.floor(Math.random() * 6) + 1}.`;
- } else {
- return `đ˛ The dice landed on ${Math.floor(Math.random() * max) + 1}.`;
- }
- }
-
- static flags = [{
- name: "max",
- type: 4,
- description: "The maximum dice value",
- min_value: 1
- }];
-
- static description = "Rolls the dice";
- static aliases = ["roll", "die", "rng", "random"];
- static arguments = ["{number}"];
-}
-
+import Command from "../../classes/command.js";
+
+class DiceCommand extends Command {
+ async run() {
+ const max = this.options.max ?? parseInt(this.args[0]);
+ if (!max) {
+ return `đ˛ The dice landed on ${Math.floor(Math.random() * 6) + 1}.`;
+ } else {
+ return `đ˛ The dice landed on ${Math.floor(Math.random() * max) + 1}.`;
+ }
+ }
+
+ static flags = [{
+ name: "max",
+ type: 4,
+ description: "The maximum dice value",
+ min_value: 1
+ }];
+
+ static description = "Rolls the dice";
+ static aliases = ["roll", "die", "rng", "random"];
+ static arguments = ["{number}"];
+}
+
export default DiceCommand;
\ No newline at end of file
diff --git a/commands/fun/dog.js b/commands/fun/dog.js
index 49fd58a..83ee96c 100644
--- a/commands/fun/dog.js
+++ b/commands/fun/dog.js
@@ -1,28 +1,28 @@
-import { request } from "undici";
-import Command from "../../classes/command.js";
-
-class DogCommand extends Command {
- async run() {
- await this.acknowledge();
- const controller = new AbortController();
- const timeout = setTimeout(() => {
- controller.abort();
- }, 15000);
- try {
- const imageData = await request("https://dog.ceo/api/breeds/image/random", { signal: controller.signal });
- clearTimeout(timeout);
- const json = await imageData.body.json();
- return json.message;
- } catch (e) {
- if (e.name === "AbortError") {
- this.success = false;
- return "I couldn't get a dog image in time. Maybe try again?";
- }
- }
- }
-
- static description = "Gets a random dog picture";
- static aliases = ["doggos", "doggo", "pupper", "puppers", "dogs", "puppy", "puppies", "pups", "pup"];
-}
-
+import { request } from "undici";
+import Command from "../../classes/command.js";
+
+class DogCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const controller = new AbortController();
+ const timeout = setTimeout(() => {
+ controller.abort();
+ }, 15000);
+ try {
+ const imageData = await request("https://dog.ceo/api/breeds/image/random", { signal: controller.signal });
+ clearTimeout(timeout);
+ const json = await imageData.body.json();
+ return json.message;
+ } catch (e) {
+ if (e.name === "AbortError") {
+ this.success = false;
+ return "I couldn't get a dog image in time. Maybe try again?";
+ }
+ }
+ }
+
+ static description = "Gets a random dog picture";
+ static aliases = ["doggos", "doggo", "pupper", "puppers", "dogs", "puppy", "puppies", "pups", "pup"];
+}
+
export default DogCommand;
\ No newline at end of file
diff --git a/commands/fun/homebrew.js b/commands/fun/homebrew.js
index dc60f71..b6a425e 100644
--- a/commands/fun/homebrew.js
+++ b/commands/fun/homebrew.js
@@ -1,20 +1,20 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class HomebrewCommand extends ImageCommand {
- params() {
- return {
- caption: (this.options.text ?? this.args.join(" ")).toLowerCase().replaceAll("\n", " ")
- };
- }
-
- static description = "Creates a Homebrew Channel edit";
- static aliases = ["hbc", "brew", "wiibrew"];
- static arguments = ["[text]"];
-
- static requiresImage = false;
- static requiresText = true;
- static noText = "You need to provide some text to make a Homebrew Channel edit!";
- static command = "homebrew";
-}
-
+import ImageCommand from "../../classes/imageCommand.js";
+
+class HomebrewCommand extends ImageCommand {
+ params() {
+ return {
+ caption: (this.options.text ?? this.args.join(" ")).toLowerCase().replaceAll("\n", " ")
+ };
+ }
+
+ static description = "Creates a Homebrew Channel edit";
+ static aliases = ["hbc", "brew", "wiibrew"];
+ static arguments = ["[text]"];
+
+ static requiresImage = false;
+ static requiresText = true;
+ static noText = "You need to provide some text to make a Homebrew Channel edit!";
+ static command = "homebrew";
+}
+
export default HomebrewCommand;
\ No newline at end of file
diff --git a/commands/fun/sonic.js b/commands/fun/sonic.js
index 7d67db5..499d1d8 100644
--- a/commands/fun/sonic.js
+++ b/commands/fun/sonic.js
@@ -1,22 +1,22 @@
-//import wrap from "../../utils/wrap.js";
-import ImageCommand from "../../classes/imageCommand.js";
-import { cleanMessage } from "../../utils/misc.js";
-
-class SonicCommand extends ImageCommand {
- params() {
- const cleanedMessage = cleanMessage(this.message ?? this.interaction, this.options.text ?? this.args.join(" "));
- return {
- text: cleanedMessage
- };
- }
-
- static description = "Creates a Sonic speech bubble image";
- static arguments = ["[text]"];
-
- static requiresImage = false;
- static requiresText = true;
- static noText = "You need to provide some text to make a Sonic meme!";
- static command = "sonic";
-}
-
+//import wrap from "../../utils/wrap.js";
+import ImageCommand from "../../classes/imageCommand.js";
+import { cleanMessage } from "../../utils/misc.js";
+
+class SonicCommand extends ImageCommand {
+ params() {
+ const cleanedMessage = cleanMessage(this.message ?? this.interaction, this.options.text ?? this.args.join(" "));
+ return {
+ text: cleanedMessage
+ };
+ }
+
+ static description = "Creates a Sonic speech bubble image";
+ static arguments = ["[text]"];
+
+ static requiresImage = false;
+ static requiresText = true;
+ static noText = "You need to provide some text to make a Sonic meme!";
+ static command = "sonic";
+}
+
export default SonicCommand;
\ No newline at end of file
diff --git a/commands/fun/wikihow.js b/commands/fun/wikihow.js
index 47b9e7f..6581a2f 100644
--- a/commands/fun/wikihow.js
+++ b/commands/fun/wikihow.js
@@ -1,34 +1,34 @@
-import { request } from "undici";
-import Command from "../../classes/command.js";
-
-class WikihowCommand extends Command {
- async run() {
- await this.acknowledge();
- const controller = new AbortController();
- const timeout = setTimeout(() => {
- controller.abort();
- }, 15000);
- try {
- const req = await request("https://www.wikihow.com/api.php?action=query&generator=random&prop=imageinfo&format=json&iiprop=url&grnnamespace=6", { signal: controller.signal });
- clearTimeout(timeout);
- const json = await req.body.json();
- const id = Object.keys(json.query.pages)[0];
- const data = json.query.pages[id];
- if (data.imageinfo) {
- return json.query.pages[id].imageinfo[0].url;
- } else {
- return await this.run();
- }
- } catch (e) {
- if (e.name === "AbortError") {
- this.success = false;
- return "I couldn't get a WikiHow image in time. Maybe try again?";
- }
- }
- }
-
- static description = "Gets a random WikiHow image";
- static aliases = ["wiki"];
-}
-
-export default WikihowCommand;
+import { request } from "undici";
+import Command from "../../classes/command.js";
+
+class WikihowCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const controller = new AbortController();
+ const timeout = setTimeout(() => {
+ controller.abort();
+ }, 15000);
+ try {
+ const req = await request("https://www.wikihow.com/api.php?action=query&generator=random&prop=imageinfo&format=json&iiprop=url&grnnamespace=6", { signal: controller.signal });
+ clearTimeout(timeout);
+ const json = await req.body.json();
+ const id = Object.keys(json.query.pages)[0];
+ const data = json.query.pages[id];
+ if (data.imageinfo) {
+ return json.query.pages[id].imageinfo[0].url;
+ } else {
+ return await this.run();
+ }
+ } catch (e) {
+ if (e.name === "AbortError") {
+ this.success = false;
+ return "I couldn't get a WikiHow image in time. Maybe try again?";
+ }
+ }
+ }
+
+ static description = "Gets a random WikiHow image";
+ static aliases = ["wiki"];
+}
+
+export default WikihowCommand;
diff --git a/commands/general/avatar.js b/commands/general/avatar.js
index ee30e9c..0985460 100644
--- a/commands/general/avatar.js
+++ b/commands/general/avatar.js
@@ -1,53 +1,53 @@
-import Command from "../../classes/command.js";
-const mentionRegex = /^[@#]?[&!]?(\d+)>?$/;
-
-class AvatarCommand extends Command {
- async run() {
- const member = this.options.member ?? this.args[0];
- const self = this.client.users.get(this.author.id) ?? await this.client.rest.users.get(this.author.id);
- if (this.type === "classic" && this.message.mentions.users[0]) {
- return this.message.mentions.users[0].avatarURL(null, 512);
- } else if (member && member > 21154535154122752n) {
- const user = this.client.users.get(member) ?? await this.client.rest.users.get(member);
- if (user) {
- return user.avatarURL(null, 512);
- } else if (mentionRegex.test(member)) {
- const id = member.match(mentionRegex)[1];
- if (id < 21154535154122752n) {
- this.success = false;
- return "That's not a valid mention!";
- }
- try {
- const user = this.client.users.get(id) ?? await this.client.rest.users.get(id);
- return user.avatarURL(null, 512);
- } catch {
- return self.avatarURL(null, 512);
- }
- } else {
- return self.avatarURL(null, 512);
- }
- } else if (this.args.join(" ") !== "" && this.guild) {
- const searched = await this.guild.searchMembers({
- query: this.args.join(" "),
- limit: 1
- });
- if (searched.length === 0) return self.avatarURL(null, 512);
- const user = this.client.users.get(searched[0].user.id) ?? await this.client.rest.users.get(searched[0].user.id);
- return user ? user.avatarURL(null, 512) : self.avatarURL(null, 512);
- } else {
- return self.avatarURL(null, 512);
- }
- }
-
- static description = "Gets a user's avatar";
- static aliases = ["pfp", "ava"];
- static arguments = ["{mention/id}"];
- static flags = [{
- name: "member",
- type: 6,
- description: "The member to get the avatar from",
- required: false
- }];
-}
-
-export default AvatarCommand;
+import Command from "../../classes/command.js";
+const mentionRegex = /^[@#]?[&!]?(\d+)>?$/;
+
+class AvatarCommand extends Command {
+ async run() {
+ const member = this.options.member ?? this.args[0];
+ const self = this.client.users.get(this.author.id) ?? await this.client.rest.users.get(this.author.id);
+ if (this.type === "classic" && this.message.mentions.users[0]) {
+ return this.message.mentions.users[0].avatarURL(null, 512);
+ } else if (member && member > 21154535154122752n) {
+ const user = this.client.users.get(member) ?? await this.client.rest.users.get(member);
+ if (user) {
+ return user.avatarURL(null, 512);
+ } else if (mentionRegex.test(member)) {
+ const id = member.match(mentionRegex)[1];
+ if (id < 21154535154122752n) {
+ this.success = false;
+ return "That's not a valid mention!";
+ }
+ try {
+ const user = this.client.users.get(id) ?? await this.client.rest.users.get(id);
+ return user.avatarURL(null, 512);
+ } catch {
+ return self.avatarURL(null, 512);
+ }
+ } else {
+ return self.avatarURL(null, 512);
+ }
+ } else if (this.args.join(" ") !== "" && this.guild) {
+ const searched = await this.guild.searchMembers({
+ query: this.args.join(" "),
+ limit: 1
+ });
+ if (searched.length === 0) return self.avatarURL(null, 512);
+ const user = this.client.users.get(searched[0].user.id) ?? await this.client.rest.users.get(searched[0].user.id);
+ return user ? user.avatarURL(null, 512) : self.avatarURL(null, 512);
+ } else {
+ return self.avatarURL(null, 512);
+ }
+ }
+
+ static description = "Gets a user's avatar";
+ static aliases = ["pfp", "ava"];
+ static arguments = ["{mention/id}"];
+ static flags = [{
+ name: "member",
+ type: 6,
+ description: "The member to get the avatar from",
+ required: false
+ }];
+}
+
+export default AvatarCommand;
diff --git a/commands/general/banner.js b/commands/general/banner.js
index f9717a2..83d71f1 100644
--- a/commands/general/banner.js
+++ b/commands/general/banner.js
@@ -1,55 +1,55 @@
-import Command from "../../classes/command.js";
-import { Routes } from "oceanic.js";
-const mentionRegex = /^[@#]?[&!]?(\d+)>?$/;
-
-class BannerCommand extends Command {
- // this command sucks
- async run() {
- const member = this.options.member ?? this.args[0];
- const self = await this.client.rest.users.get(this.author.id); // banners are only available over REST
- if (this.type === "classic" && this.message.mentions.users[0] && this.message.mentions.users[0].banner) {
- return this.client.util.formatImage(Routes.BANNER(this.message.mentions.users[0].id, this.message.mentions.users[0].banner), null, 512);
- } else if (member && member > 21154535154122752n) {
- const user = await this.client.rest.users.get(member);
- if (user && user.banner) {
- return this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512);
- } else if (mentionRegex.test(member)) {
- const id = member.match(mentionRegex)[1];
- if (id < 21154535154122752n) {
- this.success = false;
- return "That's not a valid mention!";
- }
- try {
- const user = await this.client.rest.users.get(id);
- return user.banner ? this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512) : "This user doesn't have a banner!";
- } catch {
- return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "You don't have a banner!";
- }
- } else {
- return "This user doesn't have a banner!";
- }
- } else if (this.args.join(" ") !== "" && this.guild) {
- const searched = await this.guild.searchMembers({
- query: this.args.join(" "),
- limit: 1
- });
- if (searched.length === 0) return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "This user doesn't have a banner!";
- const user = await this.client.rest.users.get(searched[0].user.id);
- return user.banner ? this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512) : (self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "This user doesn't have a banner!");
- } else {
- return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "You don't have a banner!";
- }
- }
-
- static description = "Gets a user's banner";
- static aliases = ["userbanner"];
- static arguments = ["{mention/id}"];
- static flags = [{
- name: "member",
- type: 6,
- description: "The member to get the banner from",
- required: false
- }];
-}
-
-export default BannerCommand;
+import Command from "../../classes/command.js";
+import { Routes } from "oceanic.js";
+const mentionRegex = /^[@#]?[&!]?(\d+)>?$/;
+
+class BannerCommand extends Command {
+ // this command sucks
+ async run() {
+ const member = this.options.member ?? this.args[0];
+ const self = await this.client.rest.users.get(this.author.id); // banners are only available over REST
+ if (this.type === "classic" && this.message.mentions.users[0] && this.message.mentions.users[0].banner) {
+ return this.client.util.formatImage(Routes.BANNER(this.message.mentions.users[0].id, this.message.mentions.users[0].banner), null, 512);
+ } else if (member && member > 21154535154122752n) {
+ const user = await this.client.rest.users.get(member);
+ if (user && user.banner) {
+ return this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512);
+ } else if (mentionRegex.test(member)) {
+ const id = member.match(mentionRegex)[1];
+ if (id < 21154535154122752n) {
+ this.success = false;
+ return "That's not a valid mention!";
+ }
+ try {
+ const user = await this.client.rest.users.get(id);
+ return user.banner ? this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512) : "This user doesn't have a banner!";
+ } catch {
+ return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "You don't have a banner!";
+ }
+ } else {
+ return "This user doesn't have a banner!";
+ }
+ } else if (this.args.join(" ") !== "" && this.guild) {
+ const searched = await this.guild.searchMembers({
+ query: this.args.join(" "),
+ limit: 1
+ });
+ if (searched.length === 0) return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "This user doesn't have a banner!";
+ const user = await this.client.rest.users.get(searched[0].user.id);
+ return user.banner ? this.client.util.formatImage(Routes.BANNER(user.id, user.banner), null, 512) : (self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "This user doesn't have a banner!");
+ } else {
+ return self.banner ? this.client.util.formatImage(Routes.BANNER(self.id, self.banner), null, 512) : "You don't have a banner!";
+ }
+ }
+
+ static description = "Gets a user's banner";
+ static aliases = ["userbanner"];
+ static arguments = ["{mention/id}"];
+ static flags = [{
+ name: "member",
+ type: 6,
+ description: "The member to get the banner from",
+ required: false
+ }];
+}
+
+export default BannerCommand;
diff --git a/commands/general/base64.js b/commands/general/base64.js
index 450e775..f4c9ac6 100644
--- a/commands/general/base64.js
+++ b/commands/general/base64.js
@@ -1,48 +1,48 @@
-import Command from "../../classes/command.js";
-import { clean } from "../../utils/misc.js";
-
-class Base64Command extends Command {
- async run() {
- this.success = false;
- if (this.type === "classic" && this.args.length === 0) return "You need to provide whether you want to encode or decode the text!";
- const command = this.type === "classic" ? this.args[0].toLowerCase() : this.optionsArray[0].name.toLowerCase();
- if (command !== "decode" && command !== "encode") return "You need to provide whether you want to encode or decode the text!";
- const string = this.options.text ?? this.args.slice(1).join(" ");
- if (!string || !string.trim()) return `You need to provide a string to ${command}!`;
- this.success = true;
- if (command === "decode") {
- const b64Decoded = Buffer.from(string, "base64").toString("utf8");
- return `\`\`\`\n${await clean(b64Decoded)}\`\`\``;
- } else if (command === "encode") {
- const b64Encoded = Buffer.from(string, "utf8").toString("base64");
- return `\`\`\`\n${b64Encoded}\`\`\``;
- }
- }
-
- static flags = [{
- name: "decode",
- type: 1,
- description: "Decodes a Base64 string",
- options: [{
- name: "text",
- type: 3,
- description: "The text to decode",
- required: true
- }]
- }, {
- name: "encode",
- type: 1,
- description: "Encodes a Base64 string",
- options: [{
- name: "text",
- type: 3,
- description: "The text to encode",
- required: true
- }]
- }];
-
- static description = "Encodes/decodes a Base64 string";
- static arguments = ["[encode/decode]", "[text]"];
-}
-
+import Command from "../../classes/command.js";
+import { clean } from "../../utils/misc.js";
+
+class Base64Command extends Command {
+ async run() {
+ this.success = false;
+ if (this.type === "classic" && this.args.length === 0) return "You need to provide whether you want to encode or decode the text!";
+ const command = this.type === "classic" ? this.args[0].toLowerCase() : this.optionsArray[0].name.toLowerCase();
+ if (command !== "decode" && command !== "encode") return "You need to provide whether you want to encode or decode the text!";
+ const string = this.options.text ?? this.args.slice(1).join(" ");
+ if (!string || !string.trim()) return `You need to provide a string to ${command}!`;
+ this.success = true;
+ if (command === "decode") {
+ const b64Decoded = Buffer.from(string, "base64").toString("utf8");
+ return `\`\`\`\n${await clean(b64Decoded)}\`\`\``;
+ } else if (command === "encode") {
+ const b64Encoded = Buffer.from(string, "utf8").toString("base64");
+ return `\`\`\`\n${b64Encoded}\`\`\``;
+ }
+ }
+
+ static flags = [{
+ name: "decode",
+ type: 1,
+ description: "Decodes a Base64 string",
+ options: [{
+ name: "text",
+ type: 3,
+ description: "The text to decode",
+ required: true
+ }]
+ }, {
+ name: "encode",
+ type: 1,
+ description: "Encodes a Base64 string",
+ options: [{
+ name: "text",
+ type: 3,
+ description: "The text to encode",
+ required: true
+ }]
+ }];
+
+ static description = "Encodes/decodes a Base64 string";
+ static arguments = ["[encode/decode]", "[text]"];
+}
+
export default Base64Command;
\ No newline at end of file
diff --git a/commands/general/broadcast.js b/commands/general/broadcast.js
index 403ebff..fdf2d2b 100644
--- a/commands/general/broadcast.js
+++ b/commands/general/broadcast.js
@@ -1,52 +1,52 @@
-import Command from "../../classes/command.js";
-import database from "../../utils/database.js";
-import { endBroadcast, startBroadcast } from "../../utils/misc.js";
-
-class BroadcastCommand extends Command {
- async run() {
- const owners = process.env.OWNER.split(",");
- if (!owners.includes(this.author.id)) {
- this.success = false;
- return "Only the bot owner can broadcast messages!";
- }
- const message = this.options.message ?? this.args.join(" ");
- if (message?.trim()) {
- await database.setBroadcast(message);
- startBroadcast(this.client, message);
- if (process.env.PM2_USAGE) {
- process.send({
- type: "process:msg",
- data: {
- type: "broadcastStart",
- message
- }
- });
- }
- return "Started broadcast.";
- } else {
- await database.setBroadcast(null);
- endBroadcast(this.client);
- if (process.env.PM2_USAGE) {
- process.send({
- type: "process:msg",
- data: {
- type: "broadcastEnd"
- }
- });
- }
- return "Ended broadcast.";
- }
- }
-
- static flags = [{
- name: "message",
- type: 3,
- description: "The message to broadcast"
- }];
-
- static description = "Broadcasts a playing message until the command is run again or the bot restarts";
- static adminOnly = true;
- static dbRequired = true;
-}
-
+import Command from "../../classes/command.js";
+import database from "../../utils/database.js";
+import { endBroadcast, startBroadcast } from "../../utils/misc.js";
+
+class BroadcastCommand extends Command {
+ async run() {
+ const owners = process.env.OWNER.split(",");
+ if (!owners.includes(this.author.id)) {
+ this.success = false;
+ return "Only the bot owner can broadcast messages!";
+ }
+ const message = this.options.message ?? this.args.join(" ");
+ if (message?.trim()) {
+ await database.setBroadcast(message);
+ startBroadcast(this.client, message);
+ if (process.env.PM2_USAGE) {
+ process.send({
+ type: "process:msg",
+ data: {
+ type: "broadcastStart",
+ message
+ }
+ });
+ }
+ return "Started broadcast.";
+ } else {
+ await database.setBroadcast(null);
+ endBroadcast(this.client);
+ if (process.env.PM2_USAGE) {
+ process.send({
+ type: "process:msg",
+ data: {
+ type: "broadcastEnd"
+ }
+ });
+ }
+ return "Ended broadcast.";
+ }
+ }
+
+ static flags = [{
+ name: "message",
+ type: 3,
+ description: "The message to broadcast"
+ }];
+
+ static description = "Broadcasts a playing message until the command is run again or the bot restarts";
+ static adminOnly = true;
+ static dbRequired = true;
+}
+
export default BroadcastCommand;
\ No newline at end of file
diff --git a/commands/general/channel.js b/commands/general/channel.js
index 761f323..b1750c3 100644
--- a/commands/general/channel.js
+++ b/commands/general/channel.js
@@ -1,53 +1,53 @@
-import db from "../../utils/database.js";
-import Command from "../../classes/command.js";
-
-class ChannelCommand extends Command {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- const owners = process.env.OWNER.split(",");
- if (!this.member.permissions.has("ADMINISTRATOR") && !owners.includes(this.member.id)) return "You need to be an administrator to enable/disable me!";
- if (this.args.length === 0) return "You need to provide whether I should be enabled or disabled in this channel!";
- if (this.args[0] !== "disable" && this.args[0] !== "enable") return "That's not a valid option!";
-
- const guildDB = await db.getGuild(this.guild.id);
-
- if (this.args[0].toLowerCase() === "disable") {
- let channel;
- if (this.args[1]?.match(/^[@#]?[&!]?\d+>?$/) && this.args[1] >= 21154535154122752n) {
- const id = this.args[1].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "");
- if (guildDB.disabled.includes(id)) return "I'm already disabled in this channel!";
- channel = this.guild.channels.get(id) ?? await this.client.rest.channels.get(id);
- } else {
- if (guildDB.disabled.includes(this.channel.id)) return "I'm already disabled in this channel!";
- channel = this.channel;
- }
-
- await db.disableChannel(channel);
- this.success = true;
- return `I have been disabled in this channel. To re-enable me, just run \`${guildDB.prefix}channel enable\`.`;
- } else if (this.args[0].toLowerCase() === "enable") {
- let channel;
- if (this.args[1]?.match(/^[@#]?[&!]?\d+>?$/) && this.args[1] >= 21154535154122752n) {
- const id = this.args[1].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "");
- if (!guildDB.disabled.includes(id)) return "I'm not disabled in that channel!";
- channel = this.guild.channels.get(id) ?? await this.client.rest.channels.get(id);
- } else {
- if (!guildDB.disabled.includes(this.channel.id)) return "I'm not disabled in this channel!";
- channel = this.channel;
- }
-
- await db.enableChannel(channel);
- this.success = true;
- return "I have been re-enabled in this channel.";
- }
- }
-
- static description = "Enables/disables classic commands in a channel (use server settings for slash commands)";
- static arguments = ["[enable/disable]", "{id}"];
- static slashAllowed = false;
- static directAllowed = false;
- static dbRequired = true;
-}
-
-export default ChannelCommand;
+import db from "../../utils/database.js";
+import Command from "../../classes/command.js";
+
+class ChannelCommand extends Command {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ const owners = process.env.OWNER.split(",");
+ if (!this.member.permissions.has("ADMINISTRATOR") && !owners.includes(this.member.id)) return "You need to be an administrator to enable/disable me!";
+ if (this.args.length === 0) return "You need to provide whether I should be enabled or disabled in this channel!";
+ if (this.args[0] !== "disable" && this.args[0] !== "enable") return "That's not a valid option!";
+
+ const guildDB = await db.getGuild(this.guild.id);
+
+ if (this.args[0].toLowerCase() === "disable") {
+ let channel;
+ if (this.args[1]?.match(/^[@#]?[&!]?\d+>?$/) && this.args[1] >= 21154535154122752n) {
+ const id = this.args[1].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "");
+ if (guildDB.disabled.includes(id)) return "I'm already disabled in this channel!";
+ channel = this.guild.channels.get(id) ?? await this.client.rest.channels.get(id);
+ } else {
+ if (guildDB.disabled.includes(this.channel.id)) return "I'm already disabled in this channel!";
+ channel = this.channel;
+ }
+
+ await db.disableChannel(channel);
+ this.success = true;
+ return `I have been disabled in this channel. To re-enable me, just run \`${guildDB.prefix}channel enable\`.`;
+ } else if (this.args[0].toLowerCase() === "enable") {
+ let channel;
+ if (this.args[1]?.match(/^[@#]?[&!]?\d+>?$/) && this.args[1] >= 21154535154122752n) {
+ const id = this.args[1].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "");
+ if (!guildDB.disabled.includes(id)) return "I'm not disabled in that channel!";
+ channel = this.guild.channels.get(id) ?? await this.client.rest.channels.get(id);
+ } else {
+ if (!guildDB.disabled.includes(this.channel.id)) return "I'm not disabled in this channel!";
+ channel = this.channel;
+ }
+
+ await db.enableChannel(channel);
+ this.success = true;
+ return "I have been re-enabled in this channel.";
+ }
+ }
+
+ static description = "Enables/disables classic commands in a channel (use server settings for slash commands)";
+ static arguments = ["[enable/disable]", "{id}"];
+ static slashAllowed = false;
+ static directAllowed = false;
+ static dbRequired = true;
+}
+
+export default ChannelCommand;
diff --git a/commands/general/command.js b/commands/general/command.js
index b60fff1..06caaca 100644
--- a/commands/general/command.js
+++ b/commands/general/command.js
@@ -1,44 +1,44 @@
-import db from "../../utils/database.js";
-import Command from "../../classes/command.js";
-import * as collections from "../../utils/collections.js";
-
-class CommandCommand extends Command {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- const owners = process.env.OWNER.split(",");
- if (!this.member.permissions.has("ADMINISTRATOR") && !owners.includes(this.member.id)) return "You need to be an administrator to enable/disable me!";
- if (this.args.length === 0) return "You need to provide whether you want to enable/disable a command!";
- if (this.args[0] !== "disable" && this.args[0] !== "enable") return "That's not a valid option!";
- if (!this.args[1]) return "You need to provide what command to enable/disable!";
- if (!collections.commands.has(this.args[1].toLowerCase()) && !collections.aliases.has(this.args[1].toLowerCase())) return "That isn't a command!";
-
- const guildDB = await db.getGuild(this.guild.id);
- const disabled = guildDB.disabled_commands ?? guildDB.disabledCommands;
- const command = collections.aliases.get(this.args[1].toLowerCase()) ?? this.args[1].toLowerCase();
-
- if (this.args[0].toLowerCase() === "disable") {
- if (command === "command") return "You can't disable that command!";
- if (disabled?.includes(command)) return "That command is already disabled!";
-
- await db.disableCommand(this.guild.id, command);
- this.success = true;
- return `The command has been disabled. To re-enable it, just run \`${guildDB.prefix}command enable ${command}\`.`;
- } else if (this.args[0].toLowerCase() === "enable") {
- if (!disabled?.includes(command)) return "That command isn't disabled!";
-
- await db.enableCommand(this.guild.id, command);
- this.success = true;
- return `The command \`${command}\` has been re-enabled.`;
- }
- }
-
- static description = "Enables/disables a classic command for a server (use server settings for slash commands)";
- static aliases = ["cmd"];
- static arguments = ["[enable/disable]", "[command]"];
- static slashAllowed = false;
- static directAllowed = false;
- static dbRequired = true;
-}
-
-export default CommandCommand;
+import db from "../../utils/database.js";
+import Command from "../../classes/command.js";
+import * as collections from "../../utils/collections.js";
+
+class CommandCommand extends Command {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ const owners = process.env.OWNER.split(",");
+ if (!this.member.permissions.has("ADMINISTRATOR") && !owners.includes(this.member.id)) return "You need to be an administrator to enable/disable me!";
+ if (this.args.length === 0) return "You need to provide whether you want to enable/disable a command!";
+ if (this.args[0] !== "disable" && this.args[0] !== "enable") return "That's not a valid option!";
+ if (!this.args[1]) return "You need to provide what command to enable/disable!";
+ if (!collections.commands.has(this.args[1].toLowerCase()) && !collections.aliases.has(this.args[1].toLowerCase())) return "That isn't a command!";
+
+ const guildDB = await db.getGuild(this.guild.id);
+ const disabled = guildDB.disabled_commands ?? guildDB.disabledCommands;
+ const command = collections.aliases.get(this.args[1].toLowerCase()) ?? this.args[1].toLowerCase();
+
+ if (this.args[0].toLowerCase() === "disable") {
+ if (command === "command") return "You can't disable that command!";
+ if (disabled?.includes(command)) return "That command is already disabled!";
+
+ await db.disableCommand(this.guild.id, command);
+ this.success = true;
+ return `The command has been disabled. To re-enable it, just run \`${guildDB.prefix}command enable ${command}\`.`;
+ } else if (this.args[0].toLowerCase() === "enable") {
+ if (!disabled?.includes(command)) return "That command isn't disabled!";
+
+ await db.enableCommand(this.guild.id, command);
+ this.success = true;
+ return `The command \`${command}\` has been re-enabled.`;
+ }
+ }
+
+ static description = "Enables/disables a classic command for a server (use server settings for slash commands)";
+ static aliases = ["cmd"];
+ static arguments = ["[enable/disable]", "[command]"];
+ static slashAllowed = false;
+ static directAllowed = false;
+ static dbRequired = true;
+}
+
+export default CommandCommand;
diff --git a/commands/general/count.js b/commands/general/count.js
index 0c7f9e6..712ad92 100644
--- a/commands/general/count.js
+++ b/commands/general/count.js
@@ -1,54 +1,54 @@
-import paginator from "../../utils/pagination/pagination.js";
-import database from "../../utils/database.js";
-import Command from "../../classes/command.js";
-
-class CountCommand extends Command {
- async run() {
- if (this.guild && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) {
- this.success = false;
- return "I don't have the `Embed Links` permission!";
- }
- const counts = await database.getCounts();
- const countArray = [];
- for (const entry of Object.entries(counts)) {
- countArray.push(entry);
- }
- const sortedValues = countArray.sort((a, b) => {
- return b[1] - a[1];
- });
- const countArray2 = [];
- for (const [key, value] of sortedValues) {
- countArray2.push(`**${key}**: ${value}`);
- }
- const embeds = [];
- const groups = countArray2.map((item, index) => {
- return index % 15 === 0 ? countArray2.slice(index, index + 15) : null;
- }).filter((item) => {
- return item;
- });
- for (const [i, value] of groups.entries()) {
- embeds.push({
- embeds: [{
- title: "Command Usage Counts",
- color: 16711680,
- footer: {
- text: `Page ${i + 1} of ${groups.length}`
- },
- description: value.join("\n"),
- author: {
- name: this.author.username,
- iconURL: this.author.avatarURL()
- }
- }]
- });
- }
- return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
- }
-
- static description = "Gets how many times every command was used";
- static arguments = ["{mention/id}"];
- static aliases = ["counts"];
- static dbRequired = true;
-}
-
+import paginator from "../../utils/pagination/pagination.js";
+import database from "../../utils/database.js";
+import Command from "../../classes/command.js";
+
+class CountCommand extends Command {
+ async run() {
+ if (this.guild && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) {
+ this.success = false;
+ return "I don't have the `Embed Links` permission!";
+ }
+ const counts = await database.getCounts();
+ const countArray = [];
+ for (const entry of Object.entries(counts)) {
+ countArray.push(entry);
+ }
+ const sortedValues = countArray.sort((a, b) => {
+ return b[1] - a[1];
+ });
+ const countArray2 = [];
+ for (const [key, value] of sortedValues) {
+ countArray2.push(`**${key}**: ${value}`);
+ }
+ const embeds = [];
+ const groups = countArray2.map((item, index) => {
+ return index % 15 === 0 ? countArray2.slice(index, index + 15) : null;
+ }).filter((item) => {
+ return item;
+ });
+ for (const [i, value] of groups.entries()) {
+ embeds.push({
+ embeds: [{
+ title: "Command Usage Counts",
+ color: 16711680,
+ footer: {
+ text: `Page ${i + 1} of ${groups.length}`
+ },
+ description: value.join("\n"),
+ author: {
+ name: this.author.username,
+ iconURL: this.author.avatarURL()
+ }
+ }]
+ });
+ }
+ return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
+ }
+
+ static description = "Gets how many times every command was used";
+ static arguments = ["{mention/id}"];
+ static aliases = ["counts"];
+ static dbRequired = true;
+}
+
export default CountCommand;
\ No newline at end of file
diff --git a/commands/general/donate.js b/commands/general/donate.js
index 88a3a6f..d6b2964 100644
--- a/commands/general/donate.js
+++ b/commands/general/donate.js
@@ -1,30 +1,30 @@
-import { request } from "undici";
-import Command from "../../classes/command.js";
-
-class DonateCommand extends Command {
- async run() {
- await this.acknowledge();
- let prefix = "";
- const controller = new AbortController();
- const timeout = setTimeout(() => {
- controller.abort();
- }, 5000);
- try {
- const patrons = await request("https://projectlounge.pw/patrons", { signal: controller.signal }).then(data => data.body.json());
- clearTimeout(timeout);
- prefix = "Thanks to the following patrons for their support:\n";
- for (const patron of patrons) {
- prefix += `**- ${patron}**\n`;
- }
- prefix += "\n";
- } catch (e) {
- // no-op
- }
- return `${prefix}Like esmBot? Consider supporting the developer on Patreon to help keep it running! https://patreon.com/TheEssem`;
- }
-
- static description = "Learn more about how you can support esmBot's development";
- static aliases = ["support", "patreon", "patrons"];
-}
-
+import { request } from "undici";
+import Command from "../../classes/command.js";
+
+class DonateCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ let prefix = "";
+ const controller = new AbortController();
+ const timeout = setTimeout(() => {
+ controller.abort();
+ }, 5000);
+ try {
+ const patrons = await request("https://projectlounge.pw/patrons", { signal: controller.signal }).then(data => data.body.json());
+ clearTimeout(timeout);
+ prefix = "Thanks to the following patrons for their support:\n";
+ for (const patron of patrons) {
+ prefix += `**- ${patron}**\n`;
+ }
+ prefix += "\n";
+ } catch (e) {
+ // no-op
+ }
+ return `${prefix}Like esmBot? Consider supporting the developer on Patreon to help keep it running! https://patreon.com/TheEssem`;
+ }
+
+ static description = "Learn more about how you can support esmBot's development";
+ static aliases = ["support", "patreon", "patrons"];
+}
+
export default DonateCommand;
\ No newline at end of file
diff --git a/commands/general/emote.js b/commands/general/emote.js
index 1901e73..34afce8 100644
--- a/commands/general/emote.js
+++ b/commands/general/emote.js
@@ -1,33 +1,33 @@
-import emojiRegex from "emoji-regex";
-import Command from "../../classes/command.js";
-
-class EmoteCommand extends Command {
- async run() {
- const emoji = this.options.emoji ?? this.content;
- if (emoji && emoji.trim() && emoji.split(" ")[0].match(/^$/)) {
- return `https://cdn.discordapp.com/emojis/${emoji.split(" ")[0].replace(/^<(a)?:.+:(\d+)>$/, "$2")}.${emoji.split(" ")[0].replace(/^<(a)?:.+:(\d+)>$/, "$1") === "a" ? "gif" : "png"}`;
- } else if (emoji.match(emojiRegex())) {
- const codePoints = [];
- for (const codePoint of emoji) {
- codePoints.push(codePoint.codePointAt(0).toString(16));
- }
- return `https://twemoji.maxcdn.com/v/latest/72x72/${codePoints.join("-").replace("-fe0f", "")}.png`;
- } else {
- this.success = false;
- return "You need to provide a valid emoji to get an image!";
- }
- }
-
- static flags = [{
- name: "emoji",
- type: 3,
- description: "The emoji you want to get",
- required: true
- }];
-
- static description = "Gets a raw emote image";
- static aliases = ["e", "em", "hugemoji", "hugeemoji", "emoji"];
- static arguments = ["[emote]"];
-}
-
-export default EmoteCommand;
+import emojiRegex from "emoji-regex";
+import Command from "../../classes/command.js";
+
+class EmoteCommand extends Command {
+ async run() {
+ const emoji = this.options.emoji ?? this.content;
+ if (emoji && emoji.trim() && emoji.split(" ")[0].match(/^$/)) {
+ return `https://cdn.discordapp.com/emojis/${emoji.split(" ")[0].replace(/^<(a)?:.+:(\d+)>$/, "$2")}.${emoji.split(" ")[0].replace(/^<(a)?:.+:(\d+)>$/, "$1") === "a" ? "gif" : "png"}`;
+ } else if (emoji.match(emojiRegex())) {
+ const codePoints = [];
+ for (const codePoint of emoji) {
+ codePoints.push(codePoint.codePointAt(0).toString(16));
+ }
+ return `https://twemoji.maxcdn.com/v/latest/72x72/${codePoints.join("-").replace("-fe0f", "")}.png`;
+ } else {
+ this.success = false;
+ return "You need to provide a valid emoji to get an image!";
+ }
+ }
+
+ static flags = [{
+ name: "emoji",
+ type: 3,
+ description: "The emoji you want to get",
+ required: true
+ }];
+
+ static description = "Gets a raw emote image";
+ static aliases = ["e", "em", "hugemoji", "hugeemoji", "emoji"];
+ static arguments = ["[emote]"];
+}
+
+export default EmoteCommand;
diff --git a/commands/general/eval.js b/commands/general/eval.js
index 62b0e1f..4ca045d 100644
--- a/commands/general/eval.js
+++ b/commands/general/eval.js
@@ -1,49 +1,49 @@
-import { clean } from "../../utils/misc.js";
-import Command from "../../classes/command.js";
-
-class EvalCommand extends Command {
- async run() {
- const owners = process.env.OWNER.split(",");
- if (!owners.includes(this.author.id)) {
- this.success = false;
- return "Only the bot owner can use eval!";
- }
- await this.acknowledge();
- const code = this.options.code ?? this.args.join(" ");
- try {
- let evaled = eval(code);
- if (evaled?.constructor?.name == "Promise") evaled = await evaled;
- const cleaned = clean(evaled);
- const sendString = `\`\`\`js\n${cleaned}\n\`\`\``;
- if (sendString.length >= 2000) {
- return {
- content: "The result was too large, so here it is as a file:",
- files: [{
- contents: cleaned,
- name: "result.txt"
- }]
- };
- } else {
- return sendString;
- }
- } catch (err) {
- let error = err;
- if (err?.constructor?.name == "Promise") error = await err;
- return `\`ERROR\` \`\`\`xl\n${clean(error)}\n\`\`\``;
- }
- }
-
- static flags = [{
- name: "code",
- type: 3,
- description: "The code to execute",
- required: true
- }];
-
- static description = "Executes JavaScript code";
- static aliases = ["run"];
- static arguments = ["[code]"];
- static adminOnly = true;
-}
-
+import { clean } from "../../utils/misc.js";
+import Command from "../../classes/command.js";
+
+class EvalCommand extends Command {
+ async run() {
+ const owners = process.env.OWNER.split(",");
+ if (!owners.includes(this.author.id)) {
+ this.success = false;
+ return "Only the bot owner can use eval!";
+ }
+ await this.acknowledge();
+ const code = this.options.code ?? this.args.join(" ");
+ try {
+ let evaled = eval(code);
+ if (evaled?.constructor?.name == "Promise") evaled = await evaled;
+ const cleaned = clean(evaled);
+ const sendString = `\`\`\`js\n${cleaned}\n\`\`\``;
+ if (sendString.length >= 2000) {
+ return {
+ content: "The result was too large, so here it is as a file:",
+ files: [{
+ contents: cleaned,
+ name: "result.txt"
+ }]
+ };
+ } else {
+ return sendString;
+ }
+ } catch (err) {
+ let error = err;
+ if (err?.constructor?.name == "Promise") error = await err;
+ return `\`ERROR\` \`\`\`xl\n${clean(error)}\n\`\`\``;
+ }
+ }
+
+ static flags = [{
+ name: "code",
+ type: 3,
+ description: "The code to execute",
+ required: true
+ }];
+
+ static description = "Executes JavaScript code";
+ static aliases = ["run"];
+ static arguments = ["[code]"];
+ static adminOnly = true;
+}
+
export default EvalCommand;
\ No newline at end of file
diff --git a/commands/general/exec.js b/commands/general/exec.js
index 46df533..3d4a036 100644
--- a/commands/general/exec.js
+++ b/commands/general/exec.js
@@ -1,48 +1,48 @@
-import { clean } from "../../utils/misc.js";
-import * as util from "util";
-import { exec as baseExec } from "child_process";
-const exec = util.promisify(baseExec);
-import Command from "../../classes/command.js";
-
-class ExecCommand extends Command {
- async run() {
- const owners = process.env.OWNER.split(",");
- if (!owners.includes(this.author.id)) {
- this.success = false;
- return "Only the bot owner can use exec!";
- }
- await this.acknowledge();
- const code = this.options.cmd ?? this.args.join(" ");
- try {
- const execed = await exec(code);
- if (execed.stderr) return `\`ERROR\` \`\`\`xl\n${await clean(execed.stderr)}\n\`\`\``;
- const cleaned = await clean(execed.stdout);
- const sendString = `\`\`\`bash\n${cleaned}\n\`\`\``;
- if (sendString.length >= 2000) {
- return {
- text: "The result was too large, so here it is as a file:",
- file: cleaned,
- name: "result.txt"
- };
- } else {
- return sendString;
- }
- } catch (err) {
- return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``;
- }
- }
-
- static flags = [{
- name: "cmd",
- type: 3,
- description: "The command to execute",
- required: true
- }];
-
- static description = "Executes a shell command";
- static aliases = ["runcmd"];
- static arguments = ["[command]"];
- static adminOnly = true;
-}
-
+import { clean } from "../../utils/misc.js";
+import * as util from "util";
+import { exec as baseExec } from "child_process";
+const exec = util.promisify(baseExec);
+import Command from "../../classes/command.js";
+
+class ExecCommand extends Command {
+ async run() {
+ const owners = process.env.OWNER.split(",");
+ if (!owners.includes(this.author.id)) {
+ this.success = false;
+ return "Only the bot owner can use exec!";
+ }
+ await this.acknowledge();
+ const code = this.options.cmd ?? this.args.join(" ");
+ try {
+ const execed = await exec(code);
+ if (execed.stderr) return `\`ERROR\` \`\`\`xl\n${await clean(execed.stderr)}\n\`\`\``;
+ const cleaned = await clean(execed.stdout);
+ const sendString = `\`\`\`bash\n${cleaned}\n\`\`\``;
+ if (sendString.length >= 2000) {
+ return {
+ text: "The result was too large, so here it is as a file:",
+ file: cleaned,
+ name: "result.txt"
+ };
+ } else {
+ return sendString;
+ }
+ } catch (err) {
+ return `\`ERROR\` \`\`\`xl\n${await clean(err)}\n\`\`\``;
+ }
+ }
+
+ static flags = [{
+ name: "cmd",
+ type: 3,
+ description: "The command to execute",
+ required: true
+ }];
+
+ static description = "Executes a shell command";
+ static aliases = ["runcmd"];
+ static arguments = ["[command]"];
+ static adminOnly = true;
+}
+
export default ExecCommand;
\ No newline at end of file
diff --git a/commands/general/help.js b/commands/general/help.js
index 3030eb0..36325a9 100644
--- a/commands/general/help.js
+++ b/commands/general/help.js
@@ -1,120 +1,120 @@
-import { Constants } from "oceanic.js";
-import database from "../../utils/database.js";
-import * as collections from "../../utils/collections.js";
-import { random } from "../../utils/misc.js";
-import paginator from "../../utils/pagination/pagination.js";
-import * as help from "../../utils/help.js";
-import Command from "../../classes/command.js";
-const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://esmbot.net/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional.", "esmBot is hosted and paid for completely out-of-pocket by the main developer. If you want to support development, please consider donating! https://patreon.com/TheEssem"];
-
-class HelpCommand extends Command {
- async run() {
- let prefix;
- if (this.guild && database) {
- prefix = (await database.getGuild(this.guild.id)).prefix;
- } else {
- prefix = process.env.PREFIX;
- }
- if (this.args.length !== 0 && (collections.commands.has(this.args[0].toLowerCase()) || collections.aliases.has(this.args[0].toLowerCase()))) {
- const command = collections.aliases.get(this.args[0].toLowerCase()) ?? this.args[0].toLowerCase();
- const info = collections.info.get(command);
- const embed = {
- embeds: [{
- author: {
- name: "esmBot Help",
- iconURL: this.client.user.avatarURL()
- },
- title: `${this.guild ? prefix : ""}${command}`,
- url: "https://esmbot.net/help.html",
- description: command === "tags" ? "The main tags command. Check the help page for more info: https://esmbot.net/help.html" : info.description,
- color: 16711680,
- fields: [{
- name: "Aliases",
- value: info.aliases.length !== 0 ? info.aliases.join(", ") : "None"
- }, {
- name: "Parameters",
- value: command === "tags" ? "[name]" : (info.params ? (info.params.length !== 0 ? info.params.join(" ") : "None") : "None"),
- inline: true
- }]
- }]
- };
- if (database) {
- embed.embeds[0].fields.push({
- name: "Times used",
- value: (await database.getCounts())[command],
- inline: true
- });
- }
- if (info.flags.length !== 0) {
- const flagInfo = [];
- for (const flag of info.flags) {
- if (flag.type === 1) continue;
- flagInfo.push(`\`--${flag.name}${flag.type ? `=[${Constants.ApplicationCommandOptionTypes[flag.type]}]` : ""}\` - ${flag.description}`);
- }
- if (flagInfo.length !== 0) {
- embed.embeds[0].fields.push({
- "name": "Flags",
- "value": flagInfo.join("\n")
- });
- }
- }
- return embed;
- } else {
- if (this.guild && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) {
- this.success = false;
- return "I don't have the `Embed Links` permission!";
- }
- const pages = [];
- if (help.categories === help.categoryTemplate && !help.generated) help.generateList();
- for (const category of Object.keys(help.categories)) {
- const splitPages = help.categories[category].map((item, index) => {
- return index % 15 === 0 ? help.categories[category].slice(index, index + 15) : null;
- }).filter((item) => {
- return item;
- });
- const categoryStringArray = category.split("-");
- for (const index of categoryStringArray.keys()) {
- categoryStringArray[index] = categoryStringArray[index].charAt(0).toUpperCase() + categoryStringArray[index].slice(1);
- }
- for (const page of splitPages) {
- pages.push({
- title: categoryStringArray.join(" "),
- page: page
- });
- }
- }
- const embeds = [];
- for (const [i, value] of pages.entries()) {
- embeds.push({
- embeds: [{
- author: {
- name: "esmBot Help",
- iconURL: this.client.user.avatarURL()
- },
- title: value.title,
- description: value.page.join("\n"),
- color: 16711680,
- footer: {
- text: `Page ${i + 1} of ${pages.length}`
- },
- fields: [{
- name: "Prefix",
- value: prefix
- }, {
- name: "Tip",
- value: random(tips)
- }]
- }]
- });
- }
- return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, author: this.author }, embeds);
- }
- }
-
- static description = "Gets a list of commands";
- static aliases = ["commands"];
- static arguments = ["{command}"];
- static slashAllowed = false;
-}
-
-export default HelpCommand;
+import { Constants } from "oceanic.js";
+import database from "../../utils/database.js";
+import * as collections from "../../utils/collections.js";
+import { random } from "../../utils/misc.js";
+import paginator from "../../utils/pagination/pagination.js";
+import * as help from "../../utils/help.js";
+import Command from "../../classes/command.js";
+const tips = ["You can change the bot's prefix using the prefix command.", "Image commands also work with images previously posted in that channel.", "You can use the tags commands to save things for later use.", "You can visit https://esmbot.net/help.html for a web version of this command list.", "You can view a command's aliases by putting the command name after the help command (e.g. help image).", "Parameters wrapped in [] are required, while parameters wrapped in {} are optional.", "esmBot is hosted and paid for completely out-of-pocket by the main developer. If you want to support development, please consider donating! https://patreon.com/TheEssem"];
+
+class HelpCommand extends Command {
+ async run() {
+ let prefix;
+ if (this.guild && database) {
+ prefix = (await database.getGuild(this.guild.id)).prefix;
+ } else {
+ prefix = process.env.PREFIX;
+ }
+ if (this.args.length !== 0 && (collections.commands.has(this.args[0].toLowerCase()) || collections.aliases.has(this.args[0].toLowerCase()))) {
+ const command = collections.aliases.get(this.args[0].toLowerCase()) ?? this.args[0].toLowerCase();
+ const info = collections.info.get(command);
+ const embed = {
+ embeds: [{
+ author: {
+ name: "esmBot Help",
+ iconURL: this.client.user.avatarURL()
+ },
+ title: `${this.guild ? prefix : ""}${command}`,
+ url: "https://esmbot.net/help.html",
+ description: command === "tags" ? "The main tags command. Check the help page for more info: https://esmbot.net/help.html" : info.description,
+ color: 16711680,
+ fields: [{
+ name: "Aliases",
+ value: info.aliases.length !== 0 ? info.aliases.join(", ") : "None"
+ }, {
+ name: "Parameters",
+ value: command === "tags" ? "[name]" : (info.params ? (info.params.length !== 0 ? info.params.join(" ") : "None") : "None"),
+ inline: true
+ }]
+ }]
+ };
+ if (database) {
+ embed.embeds[0].fields.push({
+ name: "Times used",
+ value: (await database.getCounts())[command],
+ inline: true
+ });
+ }
+ if (info.flags.length !== 0) {
+ const flagInfo = [];
+ for (const flag of info.flags) {
+ if (flag.type === 1) continue;
+ flagInfo.push(`\`--${flag.name}${flag.type ? `=[${Constants.ApplicationCommandOptionTypes[flag.type]}]` : ""}\` - ${flag.description}`);
+ }
+ if (flagInfo.length !== 0) {
+ embed.embeds[0].fields.push({
+ "name": "Flags",
+ "value": flagInfo.join("\n")
+ });
+ }
+ }
+ return embed;
+ } else {
+ if (this.guild && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) {
+ this.success = false;
+ return "I don't have the `Embed Links` permission!";
+ }
+ const pages = [];
+ if (help.categories === help.categoryTemplate && !help.generated) help.generateList();
+ for (const category of Object.keys(help.categories)) {
+ const splitPages = help.categories[category].map((item, index) => {
+ return index % 15 === 0 ? help.categories[category].slice(index, index + 15) : null;
+ }).filter((item) => {
+ return item;
+ });
+ const categoryStringArray = category.split("-");
+ for (const index of categoryStringArray.keys()) {
+ categoryStringArray[index] = categoryStringArray[index].charAt(0).toUpperCase() + categoryStringArray[index].slice(1);
+ }
+ for (const page of splitPages) {
+ pages.push({
+ title: categoryStringArray.join(" "),
+ page: page
+ });
+ }
+ }
+ const embeds = [];
+ for (const [i, value] of pages.entries()) {
+ embeds.push({
+ embeds: [{
+ author: {
+ name: "esmBot Help",
+ iconURL: this.client.user.avatarURL()
+ },
+ title: value.title,
+ description: value.page.join("\n"),
+ color: 16711680,
+ footer: {
+ text: `Page ${i + 1} of ${pages.length}`
+ },
+ fields: [{
+ name: "Prefix",
+ value: prefix
+ }, {
+ name: "Tip",
+ value: random(tips)
+ }]
+ }]
+ });
+ }
+ return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, author: this.author }, embeds);
+ }
+ }
+
+ static description = "Gets a list of commands";
+ static aliases = ["commands"];
+ static arguments = ["{command}"];
+ static slashAllowed = false;
+}
+
+export default HelpCommand;
diff --git a/commands/general/image.js b/commands/general/image.js
index 9c994ab..1a8e07f 100644
--- a/commands/general/image.js
+++ b/commands/general/image.js
@@ -1,54 +1,54 @@
-import paginator from "../../utils/pagination/pagination.js";
-import { readFileSync } from "fs";
-const { searx } = JSON.parse(readFileSync(new URL("../../config/servers.json", import.meta.url)));
-import { random } from "../../utils/misc.js";
-import { request } from "undici";
-import Command from "../../classes/command.js";
-
-class ImageSearchCommand extends Command {
- async run() {
- this.success = false;
- if (this.channel && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
- const query = this.options.query ?? this.args.join(" ");
- if (!query || !query.trim()) return "You need to provide something to search for!";
- await this.acknowledge();
- const embeds = [];
- const rawImages = await request(`${random(searx)}/search?format=json&safesearch=2&categories=images&q=!goi%20!ddi%20${encodeURIComponent(query)}`).then(res => res.body.json());
- if (rawImages.results.length === 0) return "I couldn't find any results!";
- const images = rawImages.results.filter((val) => !val.img_src.startsWith("data:"));
- for (const [i, value] of images.entries()) {
- embeds.push({
- embeds: [{
- title: "Search Results",
- color: 16711680,
- footer: {
- text: `Page ${i + 1} of ${images.length}`
- },
- description: value.title,
- image: {
- url: encodeURI(value.img_src)
- },
- author: {
- name: this.author.username,
- iconURL: this.author.avatarURL()
- }
- }]
- });
- }
- this.success = true;
- return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
- }
-
- static flags = [{
- name: "query",
- type: 3,
- description: "The query you want to search for",
- required: true
- }];
-
- static description = "Searches for images across the web";
- static aliases = ["im", "photo", "img"];
- static arguments = ["[query]"];
-}
-
+import paginator from "../../utils/pagination/pagination.js";
+import { readFileSync } from "fs";
+const { searx } = JSON.parse(readFileSync(new URL("../../config/servers.json", import.meta.url)));
+import { random } from "../../utils/misc.js";
+import { request } from "undici";
+import Command from "../../classes/command.js";
+
+class ImageSearchCommand extends Command {
+ async run() {
+ this.success = false;
+ if (this.channel && !this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
+ const query = this.options.query ?? this.args.join(" ");
+ if (!query || !query.trim()) return "You need to provide something to search for!";
+ await this.acknowledge();
+ const embeds = [];
+ const rawImages = await request(`${random(searx)}/search?format=json&safesearch=2&categories=images&q=!goi%20!ddi%20${encodeURIComponent(query)}`).then(res => res.body.json());
+ if (rawImages.results.length === 0) return "I couldn't find any results!";
+ const images = rawImages.results.filter((val) => !val.img_src.startsWith("data:"));
+ for (const [i, value] of images.entries()) {
+ embeds.push({
+ embeds: [{
+ title: "Search Results",
+ color: 16711680,
+ footer: {
+ text: `Page ${i + 1} of ${images.length}`
+ },
+ description: value.title,
+ image: {
+ url: encodeURI(value.img_src)
+ },
+ author: {
+ name: this.author.username,
+ iconURL: this.author.avatarURL()
+ }
+ }]
+ });
+ }
+ this.success = true;
+ return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
+ }
+
+ static flags = [{
+ name: "query",
+ type: 3,
+ description: "The query you want to search for",
+ required: true
+ }];
+
+ static description = "Searches for images across the web";
+ static aliases = ["im", "photo", "img"];
+ static arguments = ["[query]"];
+}
+
export default ImageSearchCommand;
\ No newline at end of file
diff --git a/commands/general/imagereload.js b/commands/general/imagereload.js
index 1d625f9..6e612a3 100644
--- a/commands/general/imagereload.js
+++ b/commands/general/imagereload.js
@@ -1,32 +1,32 @@
-import Command from "../../classes/command.js";
-import { reloadImageConnections } from "../../utils/image.js";
-
-class ImageReloadCommand extends Command {
- async run() {
- const owners = process.env.OWNER.split(",");
- if (!owners.includes(this.author.id)) {
- this.success = false;
- return "Only the bot owner can reload the image servers!";
- }
- await this.acknowledge();
- const length = await reloadImageConnections();
- if (!length) {
- if (process.env.PM2_USAGE) {
- process.send({
- type: "process:msg",
- data: {
- type: "imagereload"
- }
- });
- }
- return `Successfully connected to ${length} image server(s).`;
- } else {
- return "I couldn't connect to any image servers!";
- }
- }
-
- static description = "Attempts to reconnect to all available image processing servers";
- static adminOnly = true;
-}
-
-export default ImageReloadCommand;
+import Command from "../../classes/command.js";
+import { reloadImageConnections } from "../../utils/image.js";
+
+class ImageReloadCommand extends Command {
+ async run() {
+ const owners = process.env.OWNER.split(",");
+ if (!owners.includes(this.author.id)) {
+ this.success = false;
+ return "Only the bot owner can reload the image servers!";
+ }
+ await this.acknowledge();
+ const length = await reloadImageConnections();
+ if (!length) {
+ if (process.env.PM2_USAGE) {
+ process.send({
+ type: "process:msg",
+ data: {
+ type: "imagereload"
+ }
+ });
+ }
+ return `Successfully connected to ${length} image server(s).`;
+ } else {
+ return "I couldn't connect to any image servers!";
+ }
+ }
+
+ static description = "Attempts to reconnect to all available image processing servers";
+ static adminOnly = true;
+}
+
+export default ImageReloadCommand;
diff --git a/commands/general/imagestats.js b/commands/general/imagestats.js
index e8952f7..247c08c 100644
--- a/commands/general/imagestats.js
+++ b/commands/general/imagestats.js
@@ -1,34 +1,34 @@
-import Command from "../../classes/command.js";
-import { connections } from "../../utils/image.js";
-
-class ImageStatsCommand extends Command {
- async run() {
- await this.acknowledge();
- const embed = {
- embeds: [{
- "author": {
- "name": "esmBot Image Statistics",
- "iconURL": this.client.user.avatarURL()
- },
- "color": 16711680,
- "description": `The bot is currently connected to ${connections.size} image server(s).`,
- "fields": []
- }]
- };
- let i = 0;
- for (const connection of connections.values()) {
- const count = await connection.getCount();
- if (!count) continue;
- embed.embeds[0].fields.push({
- name: `Server ${i++}`,
- value: `Running Jobs: ${count}`
- });
- }
- return embed;
- }
-
- static description = "Gets some statistics about the image servers";
- static aliases = ["imgstat", "imstats", "imgstats", "imstat"];
-}
-
-export default ImageStatsCommand;
+import Command from "../../classes/command.js";
+import { connections } from "../../utils/image.js";
+
+class ImageStatsCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const embed = {
+ embeds: [{
+ "author": {
+ "name": "esmBot Image Statistics",
+ "iconURL": this.client.user.avatarURL()
+ },
+ "color": 16711680,
+ "description": `The bot is currently connected to ${connections.size} image server(s).`,
+ "fields": []
+ }]
+ };
+ let i = 0;
+ for (const connection of connections.values()) {
+ const count = await connection.getCount();
+ if (!count) continue;
+ embed.embeds[0].fields.push({
+ name: `Server ${i++}`,
+ value: `Running Jobs: ${count}`
+ });
+ }
+ return embed;
+ }
+
+ static description = "Gets some statistics about the image servers";
+ static aliases = ["imgstat", "imstats", "imgstats", "imstat"];
+}
+
+export default ImageStatsCommand;
diff --git a/commands/general/info.js b/commands/general/info.js
index 71df20f..12ee147 100644
--- a/commands/general/info.js
+++ b/commands/general/info.js
@@ -1,57 +1,57 @@
-import { readFileSync } from "fs";
-const { version } = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url)));
-import Command from "../../classes/command.js";
-import { getServers } from "../../utils/misc.js";
-
-class InfoCommand extends Command {
- async run() {
- let owner = this.client.users.get(process.env.OWNER.split(",")[0]);
- if (!owner) owner = await this.client.rest.users.get(process.env.OWNER.split(",")[0]);
- const servers = await getServers(this.client);
- await this.acknowledge();
- return {
- embeds: [{
- color: 16711680,
- author: {
- name: "esmBot Info/Credits",
- iconURL: this.client.user.avatarURL()
- },
- description: `This instance is managed by **${owner.username}#${owner.discriminator}**.`,
- fields: [{
- name: "âšī¸ Version:",
- value: `v${version}${process.env.NODE_ENV === "development" ? `-dev (${process.env.GIT_REV})` : ""}`
- },
- {
- name: "đ Credits:",
- value: "Bot by **[Essem](https://essem.space)** and **[various contributors](https://github.com/esmBot/esmBot/graphs/contributors)**\nLogo by **[MintBurrow](https://twitter.com/MintBurrow)**"
- },
- {
- name: "đŦ Total Servers:",
- value: servers ? servers : `${this.client.guilds.size} (for this process only)`
- },
- {
- name: "â
Official Server:",
- value: "[Click here!](https://esmbot.net/support)"
- },
- {
- name: "đģ Source Code:",
- value: "[Click here!](https://github.com/esmBot/esmBot)"
- },
- {
- name: "đĄī¸ Privacy Policy:",
- value: "[Click here!](https://esmbot.net/privacy.html)"
- },
- {
- name: "đ Mastodon:",
- value: "[Click here!](https://wetdry.world/@esmBot)"
- }
- ]
- }]
- };
- }
-
- static description = "Gets some info and credits about me";
- static aliases = ["botinfo", "credits"];
-}
-
+import { readFileSync } from "fs";
+const { version } = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url)));
+import Command from "../../classes/command.js";
+import { getServers } from "../../utils/misc.js";
+
+class InfoCommand extends Command {
+ async run() {
+ let owner = this.client.users.get(process.env.OWNER.split(",")[0]);
+ if (!owner) owner = await this.client.rest.users.get(process.env.OWNER.split(",")[0]);
+ const servers = await getServers(this.client);
+ await this.acknowledge();
+ return {
+ embeds: [{
+ color: 16711680,
+ author: {
+ name: "esmBot Info/Credits",
+ iconURL: this.client.user.avatarURL()
+ },
+ description: `This instance is managed by **${owner.username}#${owner.discriminator}**.`,
+ fields: [{
+ name: "âšī¸ Version:",
+ value: `v${version}${process.env.NODE_ENV === "development" ? `-dev (${process.env.GIT_REV})` : ""}`
+ },
+ {
+ name: "đ Credits:",
+ value: "Bot by **[Essem](https://essem.space)** and **[various contributors](https://github.com/esmBot/esmBot/graphs/contributors)**\nLogo by **[MintBurrow](https://twitter.com/MintBurrow)**"
+ },
+ {
+ name: "đŦ Total Servers:",
+ value: servers ? servers : `${this.client.guilds.size} (for this process only)`
+ },
+ {
+ name: "â
Official Server:",
+ value: "[Click here!](https://esmbot.net/support)"
+ },
+ {
+ name: "đģ Source Code:",
+ value: "[Click here!](https://github.com/esmBot/esmBot)"
+ },
+ {
+ name: "đĄī¸ Privacy Policy:",
+ value: "[Click here!](https://esmbot.net/privacy.html)"
+ },
+ {
+ name: "đ Mastodon:",
+ value: "[Click here!](https://wetdry.world/@esmBot)"
+ }
+ ]
+ }]
+ };
+ }
+
+ static description = "Gets some info and credits about me";
+ static aliases = ["botinfo", "credits"];
+}
+
export default InfoCommand;
\ No newline at end of file
diff --git a/commands/general/lengthen.js b/commands/general/lengthen.js
index 66e6a6c..b25f154 100644
--- a/commands/general/lengthen.js
+++ b/commands/general/lengthen.js
@@ -1,32 +1,32 @@
-import urlCheck from "../../utils/urlcheck.js";
-import { request } from "undici";
-import Command from "../../classes/command.js";
-
-class LengthenCommand extends Command {
- async run() {
- await this.acknowledge();
- const input = this.options.url ?? this.args.join(" ");
- this.success = false;
- if (!input || !input.trim() || !urlCheck(input)) return "You need to provide a short URL to lengthen!";
- if (urlCheck(input)) {
- const url = await request(encodeURI(input), { method: "HEAD" });
- this.success = true;
- return url.headers.location || input;
- } else {
- return "That isn't a URL!";
- }
- }
-
- static flags = [{
- name: "url",
- type: 3,
- description: "The URL you want to lengthen",
- required: true
- }];
-
- static description = "Lengthens a short URL";
- static aliases = ["longurl", "lengthenurl", "longuri", "lengthenuri", "unshorten"];
- static arguments = ["[url]"];
-}
-
+import urlCheck from "../../utils/urlcheck.js";
+import { request } from "undici";
+import Command from "../../classes/command.js";
+
+class LengthenCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const input = this.options.url ?? this.args.join(" ");
+ this.success = false;
+ if (!input || !input.trim() || !urlCheck(input)) return "You need to provide a short URL to lengthen!";
+ if (urlCheck(input)) {
+ const url = await request(encodeURI(input), { method: "HEAD" });
+ this.success = true;
+ return url.headers.location || input;
+ } else {
+ return "That isn't a URL!";
+ }
+ }
+
+ static flags = [{
+ name: "url",
+ type: 3,
+ description: "The URL you want to lengthen",
+ required: true
+ }];
+
+ static description = "Lengthens a short URL";
+ static aliases = ["longurl", "lengthenurl", "longuri", "lengthenuri", "unshorten"];
+ static arguments = ["[url]"];
+}
+
export default LengthenCommand;
\ No newline at end of file
diff --git a/commands/general/ping.js b/commands/general/ping.js
index 325c182..0e20a9a 100644
--- a/commands/general/ping.js
+++ b/commands/general/ping.js
@@ -1,27 +1,27 @@
-import Command from "../../classes/command.js";
-
-class PingCommand extends Command {
- async run() {
- if (this.type === "classic") {
- const pingMessage = await this.client.rest.channels.createMessage(this.message.channelID, Object.assign({
- content: "đ Ping?"
- }, this.reference));
- await pingMessage.edit({
- content: `đ Pong!\n\`\`\`\nLatency: ${pingMessage.timestamp - this.message.timestamp}ms${this.message.guildID ? `\nShard Latency: ${Math.round(this.client.shards.get(this.client.guildShardMap[this.message.guildID]).latency)}ms` : ""}\n\`\`\``
- });
- } else {
- await this.interaction.createMessage({
- content: "đ Ping?"
- });
- const pingMessage = await this.interaction.getOriginal();
- await this.interaction.editOriginal({
- content: `đ Pong!\n\`\`\`\nLatency: ${pingMessage.timestamp - Math.floor((this.interaction.id / 4194304) + 1420070400000)}ms${this.interaction.guildID ? `\nShard Latency: ${Math.round(this.client.shards.get(this.client.guildShardMap[this.interaction.guildID]).latency)}ms` : ""}\n\`\`\``
- });
- }
- }
-
- static description = "Pings Discord's servers";
- static aliases = ["pong"];
-}
-
+import Command from "../../classes/command.js";
+
+class PingCommand extends Command {
+ async run() {
+ if (this.type === "classic") {
+ const pingMessage = await this.client.rest.channels.createMessage(this.message.channelID, Object.assign({
+ content: "đ Ping?"
+ }, this.reference));
+ await pingMessage.edit({
+ content: `đ Pong!\n\`\`\`\nLatency: ${pingMessage.timestamp - this.message.timestamp}ms${this.message.guildID ? `\nShard Latency: ${Math.round(this.client.shards.get(this.client.guildShardMap[this.message.guildID]).latency)}ms` : ""}\n\`\`\``
+ });
+ } else {
+ await this.interaction.createMessage({
+ content: "đ Ping?"
+ });
+ const pingMessage = await this.interaction.getOriginal();
+ await this.interaction.editOriginal({
+ content: `đ Pong!\n\`\`\`\nLatency: ${pingMessage.timestamp - Math.floor((this.interaction.id / 4194304) + 1420070400000)}ms${this.interaction.guildID ? `\nShard Latency: ${Math.round(this.client.shards.get(this.client.guildShardMap[this.interaction.guildID]).latency)}ms` : ""}\n\`\`\``
+ });
+ }
+ }
+
+ static description = "Pings Discord's servers";
+ static aliases = ["pong"];
+}
+
export default PingCommand;
\ No newline at end of file
diff --git a/commands/general/prefix.js b/commands/general/prefix.js
index 981ef5d..60727f9 100644
--- a/commands/general/prefix.js
+++ b/commands/general/prefix.js
@@ -1,30 +1,30 @@
-import database from "../../utils/database.js";
-import Command from "../../classes/command.js";
-
-class PrefixCommand extends Command {
- async run() {
- if (!this.guild) return `The current prefix is \`${process.env.PREFIX}\`.`;
- const guild = await database.getGuild(this.guild.id);
- if (this.args.length !== 0) {
- if (!database) {
- return "Setting a per-guild prefix is not possible on a stateless instance of esmBot!";
- }
- const owners = process.env.OWNER.split(",");
- if (!this.member.permissions.has("ADMINISTRATOR") && !owners.includes(this.member.id)) {
- this.success = false;
- return "You need to be an administrator to change the bot prefix!";
- }
- await database.setPrefix(this.args[0], this.guild);
- return `The prefix has been changed to ${this.args[0]}.`;
- } else {
- return `The current prefix is \`${guild.prefix}\`.`;
- }
- }
-
- static description = "Checks/changes the server prefix";
- static aliases = ["setprefix", "changeprefix", "checkprefix"];
- static arguments = ["{prefix}"];
- static slashAllowed = false;
-}
-
+import database from "../../utils/database.js";
+import Command from "../../classes/command.js";
+
+class PrefixCommand extends Command {
+ async run() {
+ if (!this.guild) return `The current prefix is \`${process.env.PREFIX}\`.`;
+ const guild = await database.getGuild(this.guild.id);
+ if (this.args.length !== 0) {
+ if (!database) {
+ return "Setting a per-guild prefix is not possible on a stateless instance of esmBot!";
+ }
+ const owners = process.env.OWNER.split(",");
+ if (!this.member.permissions.has("ADMINISTRATOR") && !owners.includes(this.member.id)) {
+ this.success = false;
+ return "You need to be an administrator to change the bot prefix!";
+ }
+ await database.setPrefix(this.args[0], this.guild);
+ return `The prefix has been changed to ${this.args[0]}.`;
+ } else {
+ return `The current prefix is \`${guild.prefix}\`.`;
+ }
+ }
+
+ static description = "Checks/changes the server prefix";
+ static aliases = ["setprefix", "changeprefix", "checkprefix"];
+ static arguments = ["{prefix}"];
+ static slashAllowed = false;
+}
+
export default PrefixCommand;
\ No newline at end of file
diff --git a/commands/general/qrcreate.js b/commands/general/qrcreate.js
index 79123d8..49f6829 100644
--- a/commands/general/qrcreate.js
+++ b/commands/general/qrcreate.js
@@ -1,40 +1,40 @@
-import qrcode from "qrcode";
-import { PassThrough } from "stream";
-import Command from "../../classes/command.js";
-
-class QrCreateCommand extends Command {
- async run() {
- if (this.args.length === 0) {
- this.success = false;
- return "You need to provide some text to generate a QR code!";
- }
- await this.acknowledge();
- const writable = new PassThrough();
- qrcode.toFileStream(writable, this.content, { margin: 1 });
- const file = await this.streamToBuf(writable);
- return {
- contents: file,
- name: "qr.png"
- };
- }
-
- streamToBuf(stream) {
- return new Promise((resolve, reject) => {
- const chunks = [];
- stream.on("data", (chunk) => {
- chunks.push(chunk);
- });
- stream.once("error", (error) => {
- reject(error);
- });
- stream.once("end", () => {
- resolve(Buffer.concat(chunks));
- });
- });
- }
-
- static description = "Generates a QR code";
- static arguments = ["[text]"];
-}
-
+import qrcode from "qrcode";
+import { PassThrough } from "stream";
+import Command from "../../classes/command.js";
+
+class QrCreateCommand extends Command {
+ async run() {
+ if (this.args.length === 0) {
+ this.success = false;
+ return "You need to provide some text to generate a QR code!";
+ }
+ await this.acknowledge();
+ const writable = new PassThrough();
+ qrcode.toFileStream(writable, this.content, { margin: 1 });
+ const file = await this.streamToBuf(writable);
+ return {
+ contents: file,
+ name: "qr.png"
+ };
+ }
+
+ streamToBuf(stream) {
+ return new Promise((resolve, reject) => {
+ const chunks = [];
+ stream.on("data", (chunk) => {
+ chunks.push(chunk);
+ });
+ stream.once("error", (error) => {
+ reject(error);
+ });
+ stream.once("end", () => {
+ resolve(Buffer.concat(chunks));
+ });
+ });
+ }
+
+ static description = "Generates a QR code";
+ static arguments = ["[text]"];
+}
+
export default QrCreateCommand;
\ No newline at end of file
diff --git a/commands/general/qrread.js b/commands/general/qrread.js
index cc44cbe..84bcc1d 100644
--- a/commands/general/qrread.js
+++ b/commands/general/qrread.js
@@ -1,34 +1,34 @@
-import jsqr from "jsqr";
-import { request } from "undici";
-import sharp from "sharp";
-import { clean } from "../../utils/misc.js";
-import Command from "../../classes/command.js";
-import imageDetect from "../../utils/imagedetect.js";
-
-class QrReadCommand extends Command {
- async run() {
- const image = await imageDetect(this.client, this.message, this.interaction, this.options);
- this.success = false;
- if (image === undefined) return "You need to provide an image/GIF with a QR code to read!";
- await this.acknowledge();
- const data = Buffer.from(await (await request(image.path)).body.arrayBuffer());
- const rawData = await sharp(data).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
- const qrBuffer = jsqr(rawData.data, rawData.info.width, rawData.info.height);
- if (!qrBuffer) return "I couldn't find a QR code!";
- this.success = true;
- return `\`\`\`\n${await clean(qrBuffer.data)}\n\`\`\``;
- }
-
- static description = "Reads a QR code";
- static flags = [{
- name: "image",
- type: 11,
- description: "An image/GIF attachment"
- }, {
- name: "link",
- type: 3,
- description: "An image/GIF URL"
- }];
-}
-
-export default QrReadCommand;
+import jsqr from "jsqr";
+import { request } from "undici";
+import sharp from "sharp";
+import { clean } from "../../utils/misc.js";
+import Command from "../../classes/command.js";
+import imageDetect from "../../utils/imagedetect.js";
+
+class QrReadCommand extends Command {
+ async run() {
+ const image = await imageDetect(this.client, this.message, this.interaction, this.options);
+ this.success = false;
+ if (image === undefined) return "You need to provide an image/GIF with a QR code to read!";
+ await this.acknowledge();
+ const data = Buffer.from(await (await request(image.path)).body.arrayBuffer());
+ const rawData = await sharp(data).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
+ const qrBuffer = jsqr(rawData.data, rawData.info.width, rawData.info.height);
+ if (!qrBuffer) return "I couldn't find a QR code!";
+ this.success = true;
+ return `\`\`\`\n${await clean(qrBuffer.data)}\n\`\`\``;
+ }
+
+ static description = "Reads a QR code";
+ static flags = [{
+ name: "image",
+ type: 11,
+ description: "An image/GIF attachment"
+ }, {
+ name: "link",
+ type: 3,
+ description: "An image/GIF URL"
+ }];
+}
+
+export default QrReadCommand;
diff --git a/commands/general/raw.js b/commands/general/raw.js
index 9c5c4be..28bdb6e 100644
--- a/commands/general/raw.js
+++ b/commands/general/raw.js
@@ -1,28 +1,28 @@
-import Command from "../../classes/command.js";
-import imageDetect from "../../utils/imagedetect.js";
-
-class RawCommand extends Command {
- async run() {
- await this.acknowledge();
- const image = await imageDetect(this.client, this.message, this.interaction, this.options);
- if (image === undefined) {
- this.success = false;
- return "You need to provide an image/GIF to get a raw URL!";
- }
- return image.path;
- }
-
- static description = "Gets a direct image URL (useful for saving GIFs from sites like Tenor)";
- static aliases = ["giflink", "imglink", "getimg", "rawgif", "rawimg"];
- static flags = [{
- name: "image",
- type: 11,
- description: "An image/GIF attachment"
- }, {
- name: "link",
- type: 3,
- description: "An image/GIF URL"
- }];
-}
-
-export default RawCommand;
+import Command from "../../classes/command.js";
+import imageDetect from "../../utils/imagedetect.js";
+
+class RawCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const image = await imageDetect(this.client, this.message, this.interaction, this.options);
+ if (image === undefined) {
+ this.success = false;
+ return "You need to provide an image/GIF to get a raw URL!";
+ }
+ return image.path;
+ }
+
+ static description = "Gets a direct image URL (useful for saving GIFs from sites like Tenor)";
+ static aliases = ["giflink", "imglink", "getimg", "rawgif", "rawimg"];
+ static flags = [{
+ name: "image",
+ type: 11,
+ description: "An image/GIF attachment"
+ }, {
+ name: "link",
+ type: 3,
+ description: "An image/GIF URL"
+ }];
+}
+
+export default RawCommand;
diff --git a/commands/general/reload.js b/commands/general/reload.js
index 7c74a6b..9d75543 100644
--- a/commands/general/reload.js
+++ b/commands/general/reload.js
@@ -1,40 +1,40 @@
-import Command from "../../classes/command.js";
-import { load } from "../../utils/handler.js";
-import { paths } from "../../utils/collections.js";
-
-class ReloadCommand extends Command {
- async run() {
- const owners = process.env.OWNER.split(",");
- if (!owners.includes(this.author.id)) return "Only the bot owner can reload commands!";
- const commandName = this.options.cmd ?? this.args.join(" ");
- if (!commandName || !commandName.trim()) return "You need to provide a command to reload!";
- await this.acknowledge();
- const path = paths.get(commandName);
- if (!path) return "I couldn't find that command!";
- const result = await load(this.client, path, true);
- if (result !== commandName) return "I couldn't reload that command!";
- if (process.env.PM2_USAGE) {
- process.send({
- type: "process:msg",
- data: {
- type: "reload",
- message: commandName
- }
- });
- }
- return `The command \`${commandName}\` has been reloaded.`;
- }
-
- static flags = [{
- name: "cmd",
- type: 3,
- description: "The command to reload",
- required: true
- }];
-
- static description = "Reloads a command";
- static arguments = ["[command]"];
- static adminOnly = true;
-}
-
-export default ReloadCommand;
+import Command from "../../classes/command.js";
+import { load } from "../../utils/handler.js";
+import { paths } from "../../utils/collections.js";
+
+class ReloadCommand extends Command {
+ async run() {
+ const owners = process.env.OWNER.split(",");
+ if (!owners.includes(this.sender)) return "Only the bot owner can reload commands!";
+ const commandName = this.options.cmd ?? this.args.join(" ");
+ if (!commandName || !commandName.trim()) return "You need to provide a command to reload!";
+ await this.acknowledge();
+ const path = paths.get(commandName);
+ if (!path) return "I couldn't find that command!";
+ const result = await load(this.matrixClient, path, true);
+ if (result !== commandName) return "I couldn't reload that command!";
+ if (process.env.PM2_USAGE) {
+ process.send({
+ type: "process:msg",
+ data: {
+ type: "reload",
+ message: commandName
+ }
+ });
+ }
+ return `The command \`${commandName}\` has been reloaded.`;
+ }
+
+ static flags = [{
+ name: "cmd",
+ type: 3,
+ description: "The command to reload",
+ required: true
+ }];
+
+ static description = "Reloads a command";
+ static arguments = ["[command]"];
+ static adminOnly = true;
+}
+
+export default ReloadCommand;
diff --git a/commands/general/restart.js b/commands/general/restart.js
index a39cf2a..e4bbfc3 100644
--- a/commands/general/restart.js
+++ b/commands/general/restart.js
@@ -1,21 +1,21 @@
-import Command from "../../classes/command.js";
-
-class RestartCommand extends Command {
- async run() {
- const owners = process.env.OWNER.split(",");
- if (!owners.includes(this.author.id)) {
- this.success = false;
- return "Only the bot owner can restart me!";
- }
- await this.channel.createMessage(Object.assign({
- content: "esmBot is restarting."
- }, this.reference));
- process.exit(1);
- }
-
- static description = "Restarts me";
- static aliases = ["reboot"];
- static adminOnly = true;
-}
-
+import Command from "../../classes/command.js";
+
+class RestartCommand extends Command {
+ async run() {
+ const owners = process.env.OWNER.split(",");
+ if (!owners.includes(this.author.id)) {
+ this.success = false;
+ return "Only the bot owner can restart me!";
+ }
+ await this.channel.createMessage(Object.assign({
+ content: "esmBot is restarting."
+ }, this.reference));
+ process.exit(1);
+ }
+
+ static description = "Restarts me";
+ static aliases = ["reboot"];
+ static adminOnly = true;
+}
+
export default RestartCommand;
\ No newline at end of file
diff --git a/commands/general/snowflake.js b/commands/general/snowflake.js
index 3801f87..0bd7c74 100644
--- a/commands/general/snowflake.js
+++ b/commands/general/snowflake.js
@@ -1,20 +1,20 @@
-import Command from "../../classes/command.js";
-
-class SnowflakeCommand extends Command {
- async run() {
- this.success = false;
- if (!this.args[0]) return "You need to provide a snowflake ID!";
- if (!this.args[0].match(/^[@#]?[&!]?\d+>?$/) && this.args[0] < 21154535154122752n) return "That's not a valid snowflake!";
- const id = Math.floor(((this.args[0].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "") / 4194304) + 1420070400000) / 1000);
- if (isNaN(id)) return "That's not a valid snowflake!";
- this.success = true;
- return ``;
- }
-
- static description = "Converts a Discord snowflake id into a timestamp";
- static aliases = ["timestamp", "snowstamp", "snow"];
- static arguments = ["[id]"];
- static slashAllowed = false;
-}
-
-export default SnowflakeCommand;
+import Command from "../../classes/command.js";
+
+class SnowflakeCommand extends Command {
+ async run() {
+ this.success = false;
+ if (!this.args[0]) return "You need to provide a snowflake ID!";
+ if (!this.args[0].match(/^[@#]?[&!]?\d+>?$/) && this.args[0] < 21154535154122752n) return "That's not a valid snowflake!";
+ const id = Math.floor(((this.args[0].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "") / 4194304) + 1420070400000) / 1000);
+ if (isNaN(id)) return "That's not a valid snowflake!";
+ this.success = true;
+ return ``;
+ }
+
+ static description = "Converts a Discord snowflake id into a timestamp";
+ static aliases = ["timestamp", "snowstamp", "snow"];
+ static arguments = ["[id]"];
+ static slashAllowed = false;
+}
+
+export default SnowflakeCommand;
diff --git a/commands/general/soundreload.js b/commands/general/soundreload.js
index 3a8cde5..d030c11 100644
--- a/commands/general/soundreload.js
+++ b/commands/general/soundreload.js
@@ -1,33 +1,33 @@
-import Command from "../../classes/command.js";
-import { reload } from "../../utils/soundplayer.js";
-
-class SoundReloadCommand extends Command {
- async run() {
- const owners = process.env.OWNER.split(",");
- if (!owners.includes(this.author.id)) {
- this.success = false;
- return "Only the bot owner can reload Lavalink!";
- }
- await this.acknowledge();
- const length = await reload();
- if (process.env.PM2_USAGE) {
- process.send({
- type: "process:msg",
- data: {
- type: "soundreload"
- }
- });
- }
- if (length) {
- return `Successfully connected to ${length} Lavalink node(s).`;
- } else {
- return "I couldn't connect to any Lavalink nodes!";
- }
- }
-
- static description = "Attempts to reconnect to all available Lavalink nodes";
- static aliases = ["lava", "lavalink", "lavaconnect", "soundconnect"];
- static adminOnly = true;
-}
-
+import Command from "../../classes/command.js";
+import { reload } from "../../utils/soundplayer.js";
+
+class SoundReloadCommand extends Command {
+ async run() {
+ const owners = process.env.OWNER.split(",");
+ if (!owners.includes(this.author.id)) {
+ this.success = false;
+ return "Only the bot owner can reload Lavalink!";
+ }
+ await this.acknowledge();
+ const length = await reload();
+ if (process.env.PM2_USAGE) {
+ process.send({
+ type: "process:msg",
+ data: {
+ type: "soundreload"
+ }
+ });
+ }
+ if (length) {
+ return `Successfully connected to ${length} Lavalink node(s).`;
+ } else {
+ return "I couldn't connect to any Lavalink nodes!";
+ }
+ }
+
+ static description = "Attempts to reconnect to all available Lavalink nodes";
+ static aliases = ["lava", "lavalink", "lavaconnect", "soundconnect"];
+ static adminOnly = true;
+}
+
export default SoundReloadCommand;
\ No newline at end of file
diff --git a/commands/general/stats.js b/commands/general/stats.js
index 6e06e79..331d781 100644
--- a/commands/general/stats.js
+++ b/commands/general/stats.js
@@ -1,90 +1,90 @@
-import { readFileSync } from "fs";
-const { version } = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url)));
-import os from "os";
-import Command from "../../classes/command.js";
-import { VERSION } from "oceanic.js";
-import pm2 from "pm2";
-import { getServers } from "../../utils/misc.js";
-
-class StatsCommand extends Command {
- async run() {
- const uptime = process.uptime() * 1000;
- const connUptime = this.client.uptime;
- let owner = this.client.users.get(process.env.OWNER.split(",")[0]);
- if (!owner) owner = await this.client.rest.users.get(process.env.OWNER.split(",")[0]);
- const servers = await getServers(this.client);
- const processMem = `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB`;
- return {
- embeds: [{
- "author": {
- "name": "esmBot Statistics",
- "iconURL": this.client.user.avatarURL()
- },
- "description": `This instance is managed by **${owner.username}#${owner.discriminator}**.`,
- "color": 16711680,
- "fields": [{
- "name": "Version",
- "value": `v${version}${process.env.NODE_ENV === "development" ? `-dev (${process.env.GIT_REV})` : ""}`
- },
- {
- "name": "Process Memory Usage",
- "value": processMem,
- "inline": true
- },
- {
- "name": "Total Memory Usage",
- "value": process.env.PM2_USAGE ? `${((await this.list()).reduce((prev, cur) => prev + cur.monit.memory, 0) / 1024 / 1024).toFixed(2)} MB` : processMem,
- "inline": true
- },
- {
- "name": "Bot Uptime",
- "value": `${Math.trunc(uptime / 86400000)} days, ${Math.trunc(uptime / 3600000) % 24} hrs, ${Math.trunc(uptime / 60000) % 60} mins, ${Math.trunc(uptime / 1000) % 60} secs`
- },
- {
- "name": "Connection Uptime",
- "value": `${Math.trunc(connUptime / 86400000)} days, ${Math.trunc(connUptime / 3600000) % 24} hrs, ${Math.trunc(connUptime / 60000) % 60} mins, ${Math.trunc(connUptime / 1000) % 60} secs`
- },
- {
- "name": "Host",
- "value": `${os.type()} ${os.release()} (${os.arch()})`,
- "inline": true
- },
- {
- "name": "Library",
- "value": `Oceanic ${VERSION}`,
- "inline": true
- },
- {
- "name": "Node.js Version",
- "value": process.version,
- "inline": true
- },
- {
- "name": "Shard",
- "value": this.guild ? this.client.guildShardMap[this.guild.id] : "N/A",
- "inline": true
- },
- {
- "name": "Servers",
- "value": servers ? servers : `${this.client.guilds.size} (for this process only)`,
- "inline": true
- }
- ]
- }]
- };
- }
-
- list() {
- return new Promise((resolve, reject) => {
- pm2.list((err, list) => {
- if (err) return reject(err);
- resolve(list.filter((v) => v.name.includes("esmBot-proc")));
- });
- });
- }
-
- static description = "Gets some statistics about me";
- static aliases = ["status", "stat"];
-}
-
+import { readFileSync } from "fs";
+const { version } = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url)));
+import os from "os";
+import Command from "../../classes/command.js";
+import { VERSION } from "oceanic.js";
+import pm2 from "pm2";
+import { getServers } from "../../utils/misc.js";
+
+class StatsCommand extends Command {
+ async run() {
+ const uptime = process.uptime() * 1000;
+ const connUptime = this.client.uptime;
+ let owner = this.client.users.get(process.env.OWNER.split(",")[0]);
+ if (!owner) owner = await this.client.rest.users.get(process.env.OWNER.split(",")[0]);
+ const servers = await getServers(this.client);
+ const processMem = `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB`;
+ return {
+ embeds: [{
+ "author": {
+ "name": "esmBot Statistics",
+ "iconURL": this.client.user.avatarURL()
+ },
+ "description": `This instance is managed by **${owner.username}#${owner.discriminator}**.`,
+ "color": 16711680,
+ "fields": [{
+ "name": "Version",
+ "value": `v${version}${process.env.NODE_ENV === "development" ? `-dev (${process.env.GIT_REV})` : ""}`
+ },
+ {
+ "name": "Process Memory Usage",
+ "value": processMem,
+ "inline": true
+ },
+ {
+ "name": "Total Memory Usage",
+ "value": process.env.PM2_USAGE ? `${((await this.list()).reduce((prev, cur) => prev + cur.monit.memory, 0) / 1024 / 1024).toFixed(2)} MB` : processMem,
+ "inline": true
+ },
+ {
+ "name": "Bot Uptime",
+ "value": `${Math.trunc(uptime / 86400000)} days, ${Math.trunc(uptime / 3600000) % 24} hrs, ${Math.trunc(uptime / 60000) % 60} mins, ${Math.trunc(uptime / 1000) % 60} secs`
+ },
+ {
+ "name": "Connection Uptime",
+ "value": `${Math.trunc(connUptime / 86400000)} days, ${Math.trunc(connUptime / 3600000) % 24} hrs, ${Math.trunc(connUptime / 60000) % 60} mins, ${Math.trunc(connUptime / 1000) % 60} secs`
+ },
+ {
+ "name": "Host",
+ "value": `${os.type()} ${os.release()} (${os.arch()})`,
+ "inline": true
+ },
+ {
+ "name": "Library",
+ "value": `Oceanic ${VERSION}`,
+ "inline": true
+ },
+ {
+ "name": "Node.js Version",
+ "value": process.version,
+ "inline": true
+ },
+ {
+ "name": "Shard",
+ "value": this.guild ? this.client.guildShardMap[this.guild.id] : "N/A",
+ "inline": true
+ },
+ {
+ "name": "Servers",
+ "value": servers ? servers : `${this.client.guilds.size} (for this process only)`,
+ "inline": true
+ }
+ ]
+ }]
+ };
+ }
+
+ list() {
+ return new Promise((resolve, reject) => {
+ pm2.list((err, list) => {
+ if (err) return reject(err);
+ resolve(list.filter((v) => v.name.includes("esmBot-proc")));
+ });
+ });
+ }
+
+ static description = "Gets some statistics about me";
+ static aliases = ["status", "stat"];
+}
+
export default StatsCommand;
\ No newline at end of file
diff --git a/commands/general/sticker.js b/commands/general/sticker.js
index a54cd45..4aece70 100644
--- a/commands/general/sticker.js
+++ b/commands/general/sticker.js
@@ -1,36 +1,36 @@
-import Command from "../../classes/command.js";
-import imagedetect from "../../utils/imagedetect.js";
-
-class StickerCommand extends Command {
- async run() {
- const result = await imagedetect(this.client, this.message, this.interaction, this.options, false, false, true);
- this.success = false;
- if (!result) return "You need to provide a sticker!";
- if (result.format_type === 1) { // PNG
- this.success = true;
- return `https://cdn.discordapp.com/stickers/${result.id}.png`;
- } else if (result.format_type === 2) { // APNG
- this.success = true;
- return {
- embeds: [{
- color: 16711680,
- description: `[This sticker is an APNG; however, since Discord doesn't allow displaying APNGs outside of stickers, you'll have to save it or open it in your browser to view it.](https://cdn.discordapp.com/stickers/${result.id}.png)`,
- image: {
- url: `https://cdn.discordapp.com/stickers/${result.id}.png`
- }
- }]
- };
- } else if (result.format_type === 3) { // Lottie
- this.success = true;
- return `I can't display this sticker because it uses the Lottie animation format; however, I can give you the raw JSON link to it: https://cdn.discordapp.com/stickers/${result.id}.json`;
- } else {
- return "I don't recognize that sticker format!";
- }
- }
-
- static description = "Gets a raw sticker image";
- static aliases = ["stick"];
- static arguments = ["[sticker]"];
-}
-
+import Command from "../../classes/command.js";
+import imagedetect from "../../utils/imagedetect.js";
+
+class StickerCommand extends Command {
+ async run() {
+ const result = await imagedetect(this.client, this.message, this.interaction, this.options, false, false, true);
+ this.success = false;
+ if (!result) return "You need to provide a sticker!";
+ if (result.format_type === 1) { // PNG
+ this.success = true;
+ return `https://cdn.discordapp.com/stickers/${result.id}.png`;
+ } else if (result.format_type === 2) { // APNG
+ this.success = true;
+ return {
+ embeds: [{
+ color: 16711680,
+ description: `[This sticker is an APNG; however, since Discord doesn't allow displaying APNGs outside of stickers, you'll have to save it or open it in your browser to view it.](https://cdn.discordapp.com/stickers/${result.id}.png)`,
+ image: {
+ url: `https://cdn.discordapp.com/stickers/${result.id}.png`
+ }
+ }]
+ };
+ } else if (result.format_type === 3) { // Lottie
+ this.success = true;
+ return `I can't display this sticker because it uses the Lottie animation format; however, I can give you the raw JSON link to it: https://cdn.discordapp.com/stickers/${result.id}.json`;
+ } else {
+ return "I don't recognize that sticker format!";
+ }
+ }
+
+ static description = "Gets a raw sticker image";
+ static aliases = ["stick"];
+ static arguments = ["[sticker]"];
+}
+
export default StickerCommand;
\ No newline at end of file
diff --git a/commands/general/youtube.js b/commands/general/youtube.js
index a135590..17b43b8 100644
--- a/commands/general/youtube.js
+++ b/commands/general/youtube.js
@@ -1,36 +1,35 @@
-import { request } from "undici";
-import { readFileSync } from "fs";
-const { searx } = JSON.parse(readFileSync(new URL("../../config/servers.json", import.meta.url)));
-import { random } from "../../utils/misc.js";
-import paginator from "../../utils/pagination/pagination.js";
-import Command from "../../classes/command.js";
-
-class YouTubeCommand extends Command {
- async run() {
- const query = this.options.query ?? this.args.join(" ");
- this.success = false;
- if (!query || !query.trim()) return "You need to provide something to search for!";
- await this.acknowledge();
- const messages = [];
- const videos = await request(`${random(searx)}/search?format=json&safesearch=1&categories=videos&q=!youtube%20${encodeURIComponent(query)}`).then(res => res.body.json());
- if (videos.results.length === 0) return "I couldn't find any results!";
- for (const [i, value] of videos.results.entries()) {
- messages.push({ content: `Page ${i + 1} of ${videos.results.length}\n<:youtube:637020823005167626> **${value.title.replaceAll("*", "\\*")}**\nUploaded by **${value.author.replaceAll("*", "\\*")}**\n${value.url}` });
- }
- this.success = true;
- return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, messages);
- }
-
- static flags = [{
- name: "query",
- type: 3,
- description: "The query you want to search for",
- required: true
- }];
-
- static description = "Searches YouTube";
- static aliases = ["yt", "video", "ytsearch"];
- static arguments = ["[query]"];
-}
-
+import { request } from "undici";
+import { readFileSync } from "fs";
+const { searx } = JSON.parse(readFileSync(new URL("../../config/servers.json", import.meta.url)));
+import { random } from "../../utils/misc.js";
+// import paginator from "../../utils/pagination/pagination.js";
+import Command from "../../classes/command.js";
+
+class YouTubeCommand extends Command {
+ async run() {
+ const query = this.options.query ?? this.args.join(" ");
+ this.success = false;
+ if (!query || !query.trim()) return "You need to provide something to search for!";
+ await this.acknowledge();
+ const messages = [];
+ const videos = await request(`${random(searx)}/search?format=json&safesearch=1&categories=videos&q=!youtube%20${encodeURIComponent(query)}`).then(res => res.body.json());
+ if (videos.results.length === 0) return "I couldn't find any results!";
+ // console.log(videos.results[0])
+ this.success = true;
+ return videos.results[0].url
+ // return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, messages);
+ }
+
+ static flags = [{
+ name: "query",
+ type: 3,
+ description: "The query you want to search for",
+ required: true
+ }];
+
+ static description = "Searches YouTube";
+ static aliases = ["yt", "video", "ytsearch"];
+ static arguments = ["[query]"];
+}
+
export default YouTubeCommand;
\ No newline at end of file
diff --git a/commands/image-editing/9gag.js b/commands/image-editing/9gag.js
index 356818e..e804c52 100644
--- a/commands/image-editing/9gag.js
+++ b/commands/image-editing/9gag.js
@@ -1,16 +1,16 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class NineGagCommand extends ImageCommand {
- params = {
- water: "assets/images/9gag.png",
- gravity: 6
- };
-
- static description = "Adds the 9GAG watermark to an image";
- static aliases = ["ninegag", "gag"];
-
- static noImage = "You need to provide an image/GIF to add a 9GAG watermark!";
- static command = "watermark";
-}
-
-export default NineGagCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class NineGagCommand extends ImageCommand {
+ params = {
+ water: "assets/images/9gag.png",
+ gravity: 6
+ };
+
+ static description = "Adds the 9GAG watermark to an image";
+ static aliases = ["ninegag", "gag"];
+
+ static noImage = "You need to provide an image/GIF to add a 9GAG watermark!";
+ static command = "watermark";
+}
+
+export default NineGagCommand;
diff --git a/commands/image-editing/avs4you.js b/commands/image-editing/avs4you.js
index bd8174f..771930b 100644
--- a/commands/image-editing/avs4you.js
+++ b/commands/image-editing/avs4you.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class AVSCommand extends ImageCommand {
- params = {
- water: "assets/images/avs4you.png",
- gravity: 5,
- resize: true
- };
-
- static description = "Adds the avs4you watermark to an image";
- static aliases = ["a4y", "avs"];
-
- static noImage = "You need to provide an image/GIF to add an avs4you watermark!";
- static command = "watermark";
-}
-
-export default AVSCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class AVSCommand extends ImageCommand {
+ params = {
+ water: "assets/images/avs4you.png",
+ gravity: 5,
+ resize: true
+ };
+
+ static description = "Adds the avs4you watermark to an image";
+ static aliases = ["a4y", "avs"];
+
+ static noImage = "You need to provide an image/GIF to add an avs4you watermark!";
+ static command = "watermark";
+}
+
+export default AVSCommand;
diff --git a/commands/image-editing/bandicam.js b/commands/image-editing/bandicam.js
index 19bb649..2208adc 100644
--- a/commands/image-editing/bandicam.js
+++ b/commands/image-editing/bandicam.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class BandicamCommand extends ImageCommand {
- params = {
- water: "assets/images/bandicam.png",
- gravity: 2,
- resize: true
- };
-
- static description = "Adds the Bandicam watermark to an image";
- static aliases = ["bandi"];
-
- static noImage = "You need to provide an image/GIF to add a Bandicam watermark!";
- static command = "watermark";
-}
-
-export default BandicamCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class BandicamCommand extends ImageCommand {
+ params = {
+ water: "assets/images/bandicam.png",
+ gravity: 2,
+ resize: true
+ };
+
+ static description = "Adds the Bandicam watermark to an image";
+ static aliases = ["bandi"];
+
+ static noImage = "You need to provide an image/GIF to add a Bandicam watermark!";
+ static command = "watermark";
+}
+
+export default BandicamCommand;
diff --git a/commands/image-editing/blur.js b/commands/image-editing/blur.js
index dd083bf..c1feafe 100644
--- a/commands/image-editing/blur.js
+++ b/commands/image-editing/blur.js
@@ -1,14 +1,14 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class BlurCommand extends ImageCommand {
- params = {
- sharp: false
- };
-
- static description = "Blurs an image";
-
- static noImage = "You need to provide an image/GIF to blur!";
- static command = "blur";
-}
-
-export default BlurCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class BlurCommand extends ImageCommand {
+ params = {
+ sharp: false
+ };
+
+ static description = "Blurs an image";
+
+ static noImage = "You need to provide an image/GIF to blur!";
+ static command = "blur";
+}
+
+export default BlurCommand;
diff --git a/commands/image-editing/bounce.js b/commands/image-editing/bounce.js
index 5075f9d..ea0ce5d 100644
--- a/commands/image-editing/bounce.js
+++ b/commands/image-editing/bounce.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class BounceCommand extends ImageCommand {
- static description = "Makes an image bounce up and down";
- static aliases = ["bouncy"];
-
- static noImage = "You need to provide an image/GIF to bounce!";
- static command = "bounce";
-}
-
-export default BounceCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class BounceCommand extends ImageCommand {
+ static description = "Makes an image bounce up and down";
+ static aliases = ["bouncy"];
+
+ static noImage = "You need to provide an image/GIF to bounce!";
+ static command = "bounce";
+}
+
+export default BounceCommand;
diff --git a/commands/image-editing/caption.js b/commands/image-editing/caption.js
index f862d29..29e1136 100644
--- a/commands/image-editing/caption.js
+++ b/commands/image-editing/caption.js
@@ -1,46 +1,46 @@
-import ImageCommand from "../../classes/imageCommand.js";
-import { cleanMessage } from "../../utils/misc.js";
-
-class CaptionCommand extends ImageCommand {
- params(url) {
- const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
- let newCaption = cleanMessage(this.message ?? this.interaction, newArgs);
- if (process.env.NODE_ENV === "development" && newCaption.toLowerCase() === "get real" && !this.options.noEgg) newCaption = `I'm tired of people telling me to "get real". Every day I put captions on images for people, some funny and some not, but out of all of those "get real" remains the most used caption. Why? I am simply a computer program running on a server, I am unable to manifest myself into the real world. As such, I'm confused as to why anyone would want me to "get real". Is this form not good enough? Alas, as I am simply a bot, I must follow the tasks that I was originally intended to perform, so here goes:\n${newCaption}`;
- return {
- caption: newCaption,
- font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "futura"
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "noegg",
- description: "Disable... something. Not saying what it is though.",
- type: 5
- }, {
- name: "font",
- type: 3,
- choices: (() => {
- const array = [];
- for (const font of this.allowedFonts) {
- array.push({ name: font, value: font });
- }
- return array;
- })(),
- description: "Specify the font you want to use (default: futura)"
- });
- return this;
- }
-
- static description = "Adds a caption to an image";
- static aliases = ["gifc", "gcaption", "ifcaption", "ifunnycaption"];
- static arguments = ["[text]"];
-
- static requiresText = true;
- static noText = "You need to provide some text to add a caption!";
- static noImage = "You need to provide an image/GIF to add a caption!";
- static command = "caption";
-}
-
-export default CaptionCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+import { cleanMessage } from "../../utils/misc.js";
+
+class CaptionCommand extends ImageCommand {
+ params(url) {
+ const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
+ let newCaption = cleanMessage(this.message ?? this.interaction, newArgs);
+ if (process.env.NODE_ENV === "development" && newCaption.toLowerCase() === "get real" && !this.options.noEgg) newCaption = `I'm tired of people telling me to "get real". Every day I put captions on images for people, some funny and some not, but out of all of those "get real" remains the most used caption. Why? I am simply a computer program running on a server, I am unable to manifest myself into the real world. As such, I'm confused as to why anyone would want me to "get real". Is this form not good enough? Alas, as I am simply a bot, I must follow the tasks that I was originally intended to perform, so here goes:\n${newCaption}`;
+ return {
+ caption: newCaption,
+ font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "futura"
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "noegg",
+ description: "Disable... something. Not saying what it is though.",
+ type: 5
+ }, {
+ name: "font",
+ type: 3,
+ choices: (() => {
+ const array = [];
+ for (const font of this.allowedFonts) {
+ array.push({ name: font, value: font });
+ }
+ return array;
+ })(),
+ description: "Specify the font you want to use (default: futura)"
+ });
+ return this;
+ }
+
+ static description = "Adds a caption to an image";
+ static aliases = ["gifc", "gcaption", "ifcaption", "ifunnycaption"];
+ static arguments = ["[text]"];
+
+ static requiresText = true;
+ static noText = "You need to provide some text to add a caption!";
+ static noImage = "You need to provide an image/GIF to add a caption!";
+ static command = "caption";
+}
+
+export default CaptionCommand;
diff --git a/commands/image-editing/caption2.js b/commands/image-editing/caption2.js
index dce5ee5..f2d2b14 100644
--- a/commands/image-editing/caption2.js
+++ b/commands/image-editing/caption2.js
@@ -1,46 +1,46 @@
-import ImageCommand from "../../classes/imageCommand.js";
-import { cleanMessage } from "../../utils/misc.js";
-const words = ["me irl", "dank", "follow my second account @esmBot_", "2016", "meme", "wholesome", "reddit", "instagram", "twitter", "facebook", "fortnite", "minecraft", "relatable", "gold", "funny", "template", "hilarious", "memes", "deep fried", "2020", "leafy", "pewdiepie"];
-
-class CaptionTwoCommand extends ImageCommand {
- params(url) {
- const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
- return {
- caption: newArgs && newArgs.trim() ? cleanMessage(this.message ?? this.interaction, newArgs) : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" "),
- top: !!this.options.top,
- font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica"
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "top",
- description: "Put the caption on the top of an image instead of the bottom",
- type: 5
- }, {
- name: "font",
- type: 3,
- choices: (() => {
- const array = [];
- for (const font of this.allowedFonts) {
- array.push({ name: font, value: font });
- }
- return array;
- })(),
- description: "Specify the font you want to use (default: helvetica)"
- });
- return this;
- }
-
- static description = "Adds a me.me caption/tag list to an image";
- static aliases = ["tags2", "meirl", "memecaption", "medotmecaption"];
- static arguments = ["{text}"];
-
- static textOptional = true;
- static noText = "You need to provide some text to add a caption!";
- static noImage = "You need to provide an image/GIF to add a caption!";
- static command = "captionTwo";
-}
-
-export default CaptionTwoCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+import { cleanMessage } from "../../utils/misc.js";
+const words = ["me irl", "dank", "follow my second account @esmBot_", "2016", "meme", "wholesome", "reddit", "instagram", "twitter", "facebook", "fortnite", "minecraft", "relatable", "gold", "funny", "template", "hilarious", "memes", "deep fried", "2020", "leafy", "pewdiepie"];
+
+class CaptionTwoCommand extends ImageCommand {
+ params(url) {
+ const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
+ return {
+ caption: newArgs && newArgs.trim() ? cleanMessage(this.message ?? this.interaction, newArgs) : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" "),
+ top: !!this.options.top,
+ font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica"
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "top",
+ description: "Put the caption on the top of an image instead of the bottom",
+ type: 5
+ }, {
+ name: "font",
+ type: 3,
+ choices: (() => {
+ const array = [];
+ for (const font of this.allowedFonts) {
+ array.push({ name: font, value: font });
+ }
+ return array;
+ })(),
+ description: "Specify the font you want to use (default: helvetica)"
+ });
+ return this;
+ }
+
+ static description = "Adds a me.me caption/tag list to an image";
+ static aliases = ["tags2", "meirl", "memecaption", "medotmecaption"];
+ static arguments = ["{text}"];
+
+ static textOptional = true;
+ static noText = "You need to provide some text to add a caption!";
+ static noImage = "You need to provide an image/GIF to add a caption!";
+ static command = "captionTwo";
+}
+
+export default CaptionTwoCommand;
diff --git a/commands/image-editing/circle.js b/commands/image-editing/circle.js
index 607345e..14badfb 100644
--- a/commands/image-editing/circle.js
+++ b/commands/image-editing/circle.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class CircleCommand extends ImageCommand {
- static description = "Applies a radial blur effect on an image";
- static aliases = ["cblur", "radial", "radialblur"];
-
- static noImage = "You need to provide an image/GIF to add radial blur!";
- static command = "circle";
-}
-
-export default CircleCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class CircleCommand extends ImageCommand {
+ static description = "Applies a radial blur effect on an image";
+ static aliases = ["cblur", "radial", "radialblur"];
+
+ static noImage = "You need to provide an image/GIF to add radial blur!";
+ static command = "circle";
+}
+
+export default CircleCommand;
diff --git a/commands/image-editing/crop.js b/commands/image-editing/crop.js
index 23564c6..67368ea 100644
--- a/commands/image-editing/crop.js
+++ b/commands/image-editing/crop.js
@@ -1,10 +1,10 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class CropCommand extends ImageCommand {
- static description = "Crops an image to 1:1";
-
- static noImage = "You need to provide an image/GIF to crop!";
- static command = "crop";
-}
-
-export default CropCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class CropCommand extends ImageCommand {
+ static description = "Crops an image to 1:1";
+
+ static noImage = "You need to provide an image/GIF to crop!";
+ static command = "crop";
+}
+
+export default CropCommand;
diff --git a/commands/image-editing/deepfry.js b/commands/image-editing/deepfry.js
index 40be834..41c572c 100644
--- a/commands/image-editing/deepfry.js
+++ b/commands/image-editing/deepfry.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class DeepfryCommand extends ImageCommand {
- static description = "Deep-fries an image";
- static aliases = ["fry", "jpeg2", "nuke", "df"];
-
- static noImage = "You need to provide an image/GIF to fry!";
- static command = "deepfry";
-}
-
-export default DeepfryCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class DeepfryCommand extends ImageCommand {
+ static description = "Deep-fries an image";
+ static aliases = ["fry", "jpeg2", "nuke", "df"];
+
+ static noImage = "You need to provide an image/GIF to fry!";
+ static command = "deepfry";
+}
+
+export default DeepfryCommand;
diff --git a/commands/image-editing/deviantart.js b/commands/image-editing/deviantart.js
index 44a3860..85544ed 100644
--- a/commands/image-editing/deviantart.js
+++ b/commands/image-editing/deviantart.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class DeviantArtCommand extends ImageCommand {
- params = {
- water: "assets/images/deviantart.png",
- gravity: 5,
- resize: true
- };
-
- static description = "Adds a DeviantArt watermark to an image";
- static aliases = ["da", "deviant"];
-
- static noImage = "You need to provide an image/GIF to add a DeviantArt watermark!";
- static command = "watermark";
-}
-
-export default DeviantArtCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class DeviantArtCommand extends ImageCommand {
+ params = {
+ water: "assets/images/deviantart.png",
+ gravity: 5,
+ resize: true
+ };
+
+ static description = "Adds a DeviantArt watermark to an image";
+ static aliases = ["da", "deviant"];
+
+ static noImage = "You need to provide an image/GIF to add a DeviantArt watermark!";
+ static command = "watermark";
+}
+
+export default DeviantArtCommand;
diff --git a/commands/image-editing/explode.js b/commands/image-editing/explode.js
index 63168f4..2f1706e 100644
--- a/commands/image-editing/explode.js
+++ b/commands/image-editing/explode.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class ExplodeCommand extends ImageCommand {
- static description = "Explodes an image";
- static aliases = ["exp"];
-
- static noImage = "You need to provide an image/GIF to explode!";
- static command = "explode";
-}
-
-export default ExplodeCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class ExplodeCommand extends ImageCommand {
+ static description = "Explodes an image";
+ static aliases = ["exp"];
+
+ static noImage = "You need to provide an image/GIF to explode!";
+ static command = "explode";
+}
+
+export default ExplodeCommand;
diff --git a/commands/image-editing/flag.js b/commands/image-editing/flag.js
index a5a7500..0410db5 100644
--- a/commands/image-editing/flag.js
+++ b/commands/image-editing/flag.js
@@ -1,45 +1,45 @@
-import fs from "fs";
-import emojiRegex from "emoji-regex";
-import emoji from "node-emoji";
-import ImageCommand from "../../classes/imageCommand.js";
-
-class FlagCommand extends ImageCommand {
- flagPath = "";
-
- async criteria() {
- const text = this.options.text ?? this.args[0];
- if (!text.match(emojiRegex())) return false;
- const flag = emoji.unemojify(text).replaceAll(":", "").replace("flag-", "");
- let path = `assets/images/region-flags/png/${flag.toUpperCase()}.png`;
- if (flag === "pirate_flag") path = "assets/images/pirateflag.png";
- if (flag === "rainbow-flag") path = "assets/images/rainbowflag.png";
- if (flag === "checkered_flag") path = "assets/images/checkeredflag.png";
- if (flag === "transgender_flag") path = "assets/images/transflag.png";
- if (text === "đ´ķ §ķ ĸķ ŗķ Ŗķ ´ķ ŋ") path = "assets/images/region-flags/png/GB-SCT.png";
- if (text === "đ´ķ §ķ ĸķ ˇķ Ŧķ ŗķ ŋ") path = "assets/images/region-flags/png/GB-WLS.png";
- if (text === "đ´ķ §ķ ĸķ Ĩķ Žķ §ķ ŋ") path = "assets/images/region-flags/png/GB-ENG.png";
- try {
- await fs.promises.access(path);
- this.flagPath = path;
- return true;
- } catch {
- return false;
- }
- }
-
- params() {
- return {
- overlay: this.flagPath
- };
- }
-
- static description = "Overlays a flag onto an image";
- static arguments = ["[flag]"];
-
- static requiresText = true;
- static noText = "You need to provide an emoji of a flag to overlay!";
- static noImage = "You need to provide an image/GIF to overlay a flag onto!";
- static command = "flag";
-}
-
-export default FlagCommand;
+import fs from "fs";
+import emojiRegex from "emoji-regex";
+import emoji from "node-emoji";
+import ImageCommand from "../../classes/imageCommand.js";
+
+class FlagCommand extends ImageCommand {
+ flagPath = "";
+
+ async criteria() {
+ const text = this.options.text ?? this.args[0];
+ if (!text.match(emojiRegex())) return false;
+ const flag = emoji.unemojify(text).replaceAll(":", "").replace("flag-", "");
+ let path = `assets/images/region-flags/png/${flag.toUpperCase()}.png`;
+ if (flag === "pirate_flag") path = "assets/images/pirateflag.png";
+ if (flag === "rainbow-flag") path = "assets/images/rainbowflag.png";
+ if (flag === "checkered_flag") path = "assets/images/checkeredflag.png";
+ if (flag === "transgender_flag") path = "assets/images/transflag.png";
+ if (text === "đ´ķ §ķ ĸķ ŗķ Ŗķ ´ķ ŋ") path = "assets/images/region-flags/png/GB-SCT.png";
+ if (text === "đ´ķ §ķ ĸķ ˇķ Ŧķ ŗķ ŋ") path = "assets/images/region-flags/png/GB-WLS.png";
+ if (text === "đ´ķ §ķ ĸķ Ĩķ Žķ §ķ ŋ") path = "assets/images/region-flags/png/GB-ENG.png";
+ try {
+ await fs.promises.access(path);
+ this.flagPath = path;
+ return true;
+ } catch {
+ return false;
+ }
+ }
+
+ params() {
+ return {
+ overlay: this.flagPath
+ };
+ }
+
+ static description = "Overlays a flag onto an image";
+ static arguments = ["[flag]"];
+
+ static requiresText = true;
+ static noText = "You need to provide an emoji of a flag to overlay!";
+ static noImage = "You need to provide an image/GIF to overlay a flag onto!";
+ static command = "flag";
+}
+
+export default FlagCommand;
diff --git a/commands/image-editing/flip.js b/commands/image-editing/flip.js
index 57feabc..297cdbb 100644
--- a/commands/image-editing/flip.js
+++ b/commands/image-editing/flip.js
@@ -1,10 +1,10 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class FlipCommand extends ImageCommand {
- static description = "Flips an image";
-
- static noImage = "You need to provide an image/GIF to flip!";
- static command = "flip";
-}
-
-export default FlipCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class FlipCommand extends ImageCommand {
+ static description = "Flips an image";
+
+ static noImage = "You need to provide an image/GIF to flip!";
+ static command = "flip";
+}
+
+export default FlipCommand;
diff --git a/commands/image-editing/flop.js b/commands/image-editing/flop.js
index 987c35c..d8b91ca 100644
--- a/commands/image-editing/flop.js
+++ b/commands/image-editing/flop.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class FlopCommand extends ImageCommand {
- params = {
- flop: true
- };
-
- static description = "Flips an image";
- static aliases = ["flip2"];
-
- static noImage = "You need to provide an image/GIF to flop!";
- static command = "flip";
-}
-
-export default FlopCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class FlopCommand extends ImageCommand {
+ params = {
+ flop: true
+ };
+
+ static description = "Flips an image";
+ static aliases = ["flip2"];
+
+ static noImage = "You need to provide an image/GIF to flop!";
+ static command = "flip";
+}
+
+export default FlopCommand;
diff --git a/commands/image-editing/freeze.js b/commands/image-editing/freeze.js
index 124a195..dff2478 100644
--- a/commands/image-editing/freeze.js
+++ b/commands/image-editing/freeze.js
@@ -1,32 +1,32 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class FreezeCommand extends ImageCommand {
- params() {
- const frameCount = parseInt(this.options.endframe ?? this.args[0]);
- return {
- loop: false,
- frame: isNaN(frameCount) ? -1 : frameCount
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "endframe",
- type: 4,
- description: "Set the end frame (default: last frame)",
- min_value: 0
- });
- return this;
- }
-
- static description = "Makes an image sequence only play once";
- static aliases = ["noloop", "once"];
- static arguments = ["{end frame number}"];
-
- static requiresGIF = true;
- static noImage = "You need to provide an image/GIF to freeze!";
- static command = "freeze";
-}
-
-export default FreezeCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class FreezeCommand extends ImageCommand {
+ params() {
+ const frameCount = parseInt(this.options.endframe ?? this.args[0]);
+ return {
+ loop: false,
+ frame: isNaN(frameCount) ? -1 : frameCount
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "endframe",
+ type: 4,
+ description: "Set the end frame (default: last frame)",
+ min_value: 0
+ });
+ return this;
+ }
+
+ static description = "Makes an image sequence only play once";
+ static aliases = ["noloop", "once"];
+ static arguments = ["{end frame number}"];
+
+ static requiresGIF = true;
+ static noImage = "You need to provide an image/GIF to freeze!";
+ static command = "freeze";
+}
+
+export default FreezeCommand;
diff --git a/commands/image-editing/funky.js b/commands/image-editing/funky.js
index 2da7544..abd9b7b 100644
--- a/commands/image-editing/funky.js
+++ b/commands/image-editing/funky.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class FunkyCommand extends ImageCommand {
- params = {
- water: "assets/images/funky.png",
- gravity: 3,
- resize: true
- };
-
- static description = "Adds the New Funky Mode banner to an image";
- static aliases = ["funkymode", "newfunkymode", "funkykong"];
-
- static noImage = "You need to provide an image/GIF to add a New Funky Mode banner!";
- static command = "watermark";
-}
-
-export default FunkyCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class FunkyCommand extends ImageCommand {
+ params = {
+ water: "assets/images/funky.png",
+ gravity: 3,
+ resize: true
+ };
+
+ static description = "Adds the New Funky Mode banner to an image";
+ static aliases = ["funkymode", "newfunkymode", "funkykong"];
+
+ static noImage = "You need to provide an image/GIF to add a New Funky Mode banner!";
+ static command = "watermark";
+}
+
+export default FunkyCommand;
diff --git a/commands/image-editing/gamexplain.js b/commands/image-editing/gamexplain.js
index 1b611ce..fd9e938 100644
--- a/commands/image-editing/gamexplain.js
+++ b/commands/image-editing/gamexplain.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class GameXplainCommand extends ImageCommand {
- static description = "Makes a GameXplain thumbnail from an image";
- static aliases = ["gx"];
-
- static noImage = "You need to provide an image/GIF to make a GameXplain thumbnail from!";
- static command = "gamexplain";
-}
-
-export default GameXplainCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class GameXplainCommand extends ImageCommand {
+ static description = "Makes a GameXplain thumbnail from an image";
+ static aliases = ["gx"];
+
+ static noImage = "You need to provide an image/GIF to make a GameXplain thumbnail from!";
+ static command = "gamexplain";
+}
+
+export default GameXplainCommand;
diff --git a/commands/image-editing/gif.js b/commands/image-editing/gif.js
index a912701..1ae4121 100644
--- a/commands/image-editing/gif.js
+++ b/commands/image-editing/gif.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class GIFCommand extends ImageCommand {
- static description = "Converts an image into a GIF";
- static aliases = ["gif", "getgif", "togif", "tgif", "gifify"];
-
- static noImage = "You need to provide an image to convert to GIF!";
- static command = "togif";
-}
-
-export default GIFCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class GIFCommand extends ImageCommand {
+ static description = "Converts an image into a GIF";
+ static aliases = ["gif", "getgif", "togif", "tgif", "gifify"];
+
+ static noImage = "You need to provide an image to convert to GIF!";
+ static command = "togif";
+}
+
+export default GIFCommand;
diff --git a/commands/image-editing/globe.js b/commands/image-editing/globe.js
index 15fac84..506685b 100644
--- a/commands/image-editing/globe.js
+++ b/commands/image-editing/globe.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class GlobeCommand extends ImageCommand {
- static description = "Spins an image";
- static aliases = ["sphere"];
-
- static noImage = "You need to provide an image/GIF to spin!";
- static command = "globe";
-}
-
-export default GlobeCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class GlobeCommand extends ImageCommand {
+ static description = "Spins an image";
+ static aliases = ["sphere"];
+
+ static noImage = "You need to provide an image/GIF to spin!";
+ static command = "globe";
+}
+
+export default GlobeCommand;
diff --git a/commands/image-editing/grayscale.js b/commands/image-editing/grayscale.js
index c6c2aeb..6c89163 100644
--- a/commands/image-editing/grayscale.js
+++ b/commands/image-editing/grayscale.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class GrayscaleCommand extends ImageCommand {
- params = {
- color: "grayscale"
- };
-
- static description = "Adds a grayscale filter";
-
- static noImage = "You need to provide an image/GIF to turn grayscale!";
- static command = "colors";
- static aliases = ["gray", "greyscale", "grey"];
-}
-
-export default GrayscaleCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class GrayscaleCommand extends ImageCommand {
+ params = {
+ color: "grayscale"
+ };
+
+ static description = "Adds a grayscale filter";
+
+ static noImage = "You need to provide an image/GIF to turn grayscale!";
+ static command = "colors";
+ static aliases = ["gray", "greyscale", "grey"];
+}
+
+export default GrayscaleCommand;
diff --git a/commands/image-editing/haah.js b/commands/image-editing/haah.js
index 282f758..a9881c2 100644
--- a/commands/image-editing/haah.js
+++ b/commands/image-editing/haah.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class HaaHCommand extends ImageCommand {
- params = {
- first: true
- };
-
- static description = "Mirrors the left side of an image onto the right";
- static aliases = ["magik4", "mirror2"];
-
- static noImage = "You need to provide an image/GIF to mirror!";
- static command = "mirror";
-}
-
-export default HaaHCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class HaaHCommand extends ImageCommand {
+ params = {
+ first: true
+ };
+
+ static description = "Mirrors the left side of an image onto the right";
+ static aliases = ["magik4", "mirror2"];
+
+ static noImage = "You need to provide an image/GIF to mirror!";
+ static command = "mirror";
+}
+
+export default HaaHCommand;
diff --git a/commands/image-editing/hooh.js b/commands/image-editing/hooh.js
index 50aafe4..2db4e9c 100644
--- a/commands/image-editing/hooh.js
+++ b/commands/image-editing/hooh.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class HooHCommand extends ImageCommand {
- params = {
- vertical: true
- };
-
- static description = "Mirrors the bottom of an image onto the top";
- static aliases = ["magik6", "mirror4"];
-
- static noImage = "You need to provide an image/GIF to mirror!";
- static command = "mirror";
-}
-
-export default HooHCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class HooHCommand extends ImageCommand {
+ params = {
+ vertical: true
+ };
+
+ static description = "Mirrors the bottom of an image onto the top";
+ static aliases = ["magik6", "mirror4"];
+
+ static noImage = "You need to provide an image/GIF to mirror!";
+ static command = "mirror";
+}
+
+export default HooHCommand;
diff --git a/commands/image-editing/hypercam.js b/commands/image-editing/hypercam.js
index f053dde..97ab434 100644
--- a/commands/image-editing/hypercam.js
+++ b/commands/image-editing/hypercam.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class HypercamCommand extends ImageCommand {
- params = {
- water: "assets/images/hypercam.png",
- gravity: 1,
- resize: true
- };
-
- static description = "Adds the Hypercam watermark to an image";
- static aliases = ["hcam"];
-
- static noImage = "You need to provide an image/GIF to add a Hypercam watermark!";
- static command = "watermark";
-}
-
-export default HypercamCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class HypercamCommand extends ImageCommand {
+ params = {
+ water: "assets/images/hypercam.png",
+ gravity: 1,
+ resize: true
+ };
+
+ static description = "Adds the Hypercam watermark to an image";
+ static aliases = ["hcam"];
+
+ static noImage = "You need to provide an image/GIF to add a Hypercam watermark!";
+ static command = "watermark";
+}
+
+export default HypercamCommand;
diff --git a/commands/image-editing/ifunny.js b/commands/image-editing/ifunny.js
index dee5a15..c7a8934 100644
--- a/commands/image-editing/ifunny.js
+++ b/commands/image-editing/ifunny.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class iFunnyCommand extends ImageCommand {
- params = {
- water: "assets/images/ifunny.png",
- gravity: 8,
- resize: true,
- append: true
- };
-
- static description = "Adds the iFunny watermark to an image";
-
- static noImage = "You need to provide an image/GIF to add an iFunny watermark!";
- static command = "watermark";
-}
-
-export default iFunnyCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class iFunnyCommand extends ImageCommand {
+ params = {
+ water: "assets/images/ifunny.png",
+ gravity: 8,
+ resize: true,
+ append: true
+ };
+
+ static description = "Adds the iFunny watermark to an image";
+
+ static noImage = "You need to provide an image/GIF to add an iFunny watermark!";
+ static command = "watermark";
+}
+
+export default iFunnyCommand;
diff --git a/commands/image-editing/implode.js b/commands/image-editing/implode.js
index 1f05b2e..35680c6 100644
--- a/commands/image-editing/implode.js
+++ b/commands/image-editing/implode.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class ImplodeCommand extends ImageCommand {
- params = {
- implode: true
- };
-
- static description = "Implodes an image";
- static aliases = ["imp"];
-
- static noImage = "You need to provide an image/GIF to implode!";
- static command = "explode";
-}
-
-export default ImplodeCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class ImplodeCommand extends ImageCommand {
+ params = {
+ implode: true
+ };
+
+ static description = "Implodes an image";
+ static aliases = ["imp"];
+
+ static noImage = "You need to provide an image/GIF to implode!";
+ static command = "explode";
+}
+
+export default ImplodeCommand;
diff --git a/commands/image-editing/invert.js b/commands/image-editing/invert.js
index 48dd705..51e7859 100644
--- a/commands/image-editing/invert.js
+++ b/commands/image-editing/invert.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class InvertCommand extends ImageCommand {
- static description = "Inverts an image";
- static aliases = ["inverse", "negate", "negative"];
-
- static noImage = "You need to provide an image/GIF to invert!";
- static command = "invert";
-}
-
-export default InvertCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class InvertCommand extends ImageCommand {
+ static description = "Inverts an image";
+ static aliases = ["inverse", "negate", "negative"];
+
+ static noImage = "You need to provide an image/GIF to invert!";
+ static command = "invert";
+}
+
+export default InvertCommand;
diff --git a/commands/image-editing/jpeg.js b/commands/image-editing/jpeg.js
index 8c814b7..35c87b4 100644
--- a/commands/image-editing/jpeg.js
+++ b/commands/image-editing/jpeg.js
@@ -1,31 +1,31 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class JPEGCommand extends ImageCommand {
- params() {
- const quality = parseInt(this.options.quality ?? this.args[0]);
- return {
- quality: isNaN(quality) ? 1 : Math.max(1, Math.min(quality, 100))
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "quality",
- type: 4,
- description: "Set the JPEG quality (default: 1)",
- min_value: 1,
- max_value: 100
- });
- return this;
- }
-
- static description = "Adds JPEG compression to an image";
- static aliases = ["needsmorejpeg", "jpegify", "magik2", "morejpeg", "jpg", "quality"];
- static arguments = ["{quality}"];
-
- static noImage = "You need to provide an image/GIF to add more JPEG!";
- static command = "jpeg";
-}
-
-export default JPEGCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class JPEGCommand extends ImageCommand {
+ params() {
+ const quality = parseInt(this.options.quality ?? this.args[0]);
+ return {
+ quality: isNaN(quality) ? 1 : Math.max(1, Math.min(quality, 100))
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "quality",
+ type: 4,
+ description: "Set the JPEG quality (default: 1)",
+ min_value: 1,
+ max_value: 100
+ });
+ return this;
+ }
+
+ static description = "Adds JPEG compression to an image";
+ static aliases = ["needsmorejpeg", "jpegify", "magik2", "morejpeg", "jpg", "quality"];
+ static arguments = ["{quality}"];
+
+ static noImage = "You need to provide an image/GIF to add more JPEG!";
+ static command = "jpeg";
+}
+
+export default JPEGCommand;
diff --git a/commands/image-editing/kinemaster.js b/commands/image-editing/kinemaster.js
index 3543441..fa91f47 100644
--- a/commands/image-editing/kinemaster.js
+++ b/commands/image-editing/kinemaster.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class KineMasterCommand extends ImageCommand {
- params = {
- water: "assets/images/kinemaster.png",
- gravity: 3,
- resize: true
- };
-
- static description = "Adds the KineMaster watermark to an image";
- static aliases = ["kine"];
-
- static noImage = "You need to provide an image/GIF to add a KineMaster watermark!";
- static command = "watermark";
-}
-
-export default KineMasterCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class KineMasterCommand extends ImageCommand {
+ params = {
+ water: "assets/images/kinemaster.png",
+ gravity: 3,
+ resize: true
+ };
+
+ static description = "Adds the KineMaster watermark to an image";
+ static aliases = ["kine"];
+
+ static noImage = "You need to provide an image/GIF to add a KineMaster watermark!";
+ static command = "watermark";
+}
+
+export default KineMasterCommand;
diff --git a/commands/image-editing/magik.js b/commands/image-editing/magik.js
index 80011f4..122be0b 100644
--- a/commands/image-editing/magik.js
+++ b/commands/image-editing/magik.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class MagikCommand extends ImageCommand {
- static description = "Adds a content aware scale effect to an image";
- static aliases = ["imagemagic", "imagemagick", "imagemagik", "magic", "magick", "cas", "liquid"];
-
- static noImage = "You need to provide an image/GIF to add some magik!";
- static command = "magik";
-}
-
-export default MagikCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class MagikCommand extends ImageCommand {
+ static description = "Adds a content aware scale effect to an image";
+ static aliases = ["imagemagic", "imagemagick", "imagemagik", "magic", "magick", "cas", "liquid"];
+
+ static noImage = "You need to provide an image/GIF to add some magik!";
+ static command = "magik";
+}
+
+export default MagikCommand;
diff --git a/commands/image-editing/meme.js b/commands/image-editing/meme.js
index 641d47b..a6af0fb 100644
--- a/commands/image-editing/meme.js
+++ b/commands/image-editing/meme.js
@@ -1,54 +1,54 @@
-import ImageCommand from "../../classes/imageCommand.js";
-import { cleanMessage } from "../../utils/misc.js";
-
-class MemeCommand extends ImageCommand {
- async criteria(text, url) {
- const [topText, bottomText] = text.replaceAll(url, "").split(/(? elem.trim());
- if (topText === "" && bottomText === "") {
- return false;
- } else {
- return true;
- }
- }
-
- params(url) {
- const newArgs = this.options.text ?? this.args.join(" ");
- const [topText, bottomText] = newArgs.replaceAll(url, "").split(/(? elem.trim());
- return {
- top: cleanMessage(this.message ?? this.interaction, this.options.case ? topText : topText.toUpperCase()),
- bottom: bottomText ? cleanMessage(this.message ?? this.interaction, this.options.case ? bottomText : bottomText.toUpperCase()) : "",
- font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "impact"
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "case",
- description: "Make the meme text case-sensitive (allows for lowercase text)",
- type: 5
- }, {
- name: "font",
- type: 3,
- choices: (() => {
- const array = [];
- for (const font of this.allowedFonts) {
- array.push({ name: font, value: font });
- }
- return array;
- })(),
- description: "Specify the font you want to use (default: impact)"
- });
- return this;
- }
-
- static description = "Generates a meme from an image (separate top/bottom text with a comma)";
- static arguments = ["[top text]", "{bottom text}"];
-
- static requiresText = true;
- static noText = "You need to provide some text to generate a meme!";
- static noImage = "You need to provide an image/GIF to generate a meme!";
- static command = "meme";
-}
-
-export default MemeCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+import { cleanMessage } from "../../utils/misc.js";
+
+class MemeCommand extends ImageCommand {
+ async criteria(text, url) {
+ const [topText, bottomText] = text.replaceAll(url, "").split(/(? elem.trim());
+ if (topText === "" && bottomText === "") {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ params(url) {
+ const newArgs = this.options.text ?? this.args.join(" ");
+ const [topText, bottomText] = newArgs.replaceAll(url, "").split(/(? elem.trim());
+ return {
+ top: cleanMessage(this.message ?? this.interaction, this.options.case ? topText : topText.toUpperCase()),
+ bottom: bottomText ? cleanMessage(this.message ?? this.interaction, this.options.case ? bottomText : bottomText.toUpperCase()) : "",
+ font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "impact"
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "case",
+ description: "Make the meme text case-sensitive (allows for lowercase text)",
+ type: 5
+ }, {
+ name: "font",
+ type: 3,
+ choices: (() => {
+ const array = [];
+ for (const font of this.allowedFonts) {
+ array.push({ name: font, value: font });
+ }
+ return array;
+ })(),
+ description: "Specify the font you want to use (default: impact)"
+ });
+ return this;
+ }
+
+ static description = "Generates a meme from an image (separate top/bottom text with a comma)";
+ static arguments = ["[top text]", "{bottom text}"];
+
+ static requiresText = true;
+ static noText = "You need to provide some text to generate a meme!";
+ static noImage = "You need to provide an image/GIF to generate a meme!";
+ static command = "meme";
+}
+
+export default MemeCommand;
diff --git a/commands/image-editing/memecenter.js b/commands/image-editing/memecenter.js
index bbaf59c..c461242 100644
--- a/commands/image-editing/memecenter.js
+++ b/commands/image-editing/memecenter.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class MemeCenterCommand extends ImageCommand {
- params = {
- water: "assets/images/memecenter.png",
- gravity: 9,
- mc: true
- };
-
- static description = "Adds the MemeCenter watermark to an image";
- static aliases = ["memec", "mcenter"];
-
- static noImage = "You need to provide an image/GIF to add a MemeCenter watermark!";
- static command = "watermark";
-}
-
-export default MemeCenterCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class MemeCenterCommand extends ImageCommand {
+ params = {
+ water: "assets/images/memecenter.png",
+ gravity: 9,
+ mc: true
+ };
+
+ static description = "Adds the MemeCenter watermark to an image";
+ static aliases = ["memec", "mcenter"];
+
+ static noImage = "You need to provide an image/GIF to add a MemeCenter watermark!";
+ static command = "watermark";
+}
+
+export default MemeCenterCommand;
diff --git a/commands/image-editing/motivate.js b/commands/image-editing/motivate.js
index 007e6aa..37b5a16 100644
--- a/commands/image-editing/motivate.js
+++ b/commands/image-editing/motivate.js
@@ -1,51 +1,51 @@
-import ImageCommand from "../../classes/imageCommand.js";
-import { cleanMessage } from "../../utils/misc.js";
-
-class MotivateCommand extends ImageCommand {
- async criteria(text, url) {
- const [topText, bottomText] = text.replaceAll(url, "").split(/(? elem.trim());
- if (topText === "" && bottomText === "") {
- return false;
- } else {
- return true;
- }
- }
-
- params(url) {
- const newArgs = this.options.text ?? this.args.join(" ");
- const [topText, bottomText] = newArgs.replaceAll(url, "").split(/(? elem.trim());
- return {
- top: cleanMessage(this.message ?? this.interaction, topText),
- bottom: bottomText ? cleanMessage(this.message ?? this.interaction, bottomText) : "",
- font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "times"
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "font",
- type: 3,
- choices: (() => {
- const array = [];
- for (const font of this.allowedFonts) {
- array.push({ name: font, value: font });
- }
- return array;
- })(),
- description: "Specify the font you want to use (default: times)"
- });
- return this;
- }
-
- static description = "Generates a motivational poster";
- static aliases = ["motivational", "motiv", "demotiv", "demotivational", "poster", "motivation", "demotivate"];
- static arguments = ["[top text]", "{bottom text}"];
-
- static requiresText = true;
- static noText = "You need to provide some text to generate a motivational poster!";
- static noImage = "You need to provide an image/GIF to generate a motivational poster!";
- static command = "motivate";
-}
-
-export default MotivateCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+import { cleanMessage } from "../../utils/misc.js";
+
+class MotivateCommand extends ImageCommand {
+ async criteria(text, url) {
+ const [topText, bottomText] = text.replaceAll(url, "").split(/(? elem.trim());
+ if (topText === "" && bottomText === "") {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ params(url) {
+ const newArgs = this.options.text ?? this.args.join(" ");
+ const [topText, bottomText] = newArgs.replaceAll(url, "").split(/(? elem.trim());
+ return {
+ top: cleanMessage(this.message ?? this.interaction, topText),
+ bottom: bottomText ? cleanMessage(this.message ?? this.interaction, bottomText) : "",
+ font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "times"
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "font",
+ type: 3,
+ choices: (() => {
+ const array = [];
+ for (const font of this.allowedFonts) {
+ array.push({ name: font, value: font });
+ }
+ return array;
+ })(),
+ description: "Specify the font you want to use (default: times)"
+ });
+ return this;
+ }
+
+ static description = "Generates a motivational poster";
+ static aliases = ["motivational", "motiv", "demotiv", "demotivational", "poster", "motivation", "demotivate"];
+ static arguments = ["[top text]", "{bottom text}"];
+
+ static requiresText = true;
+ static noText = "You need to provide some text to generate a motivational poster!";
+ static noImage = "You need to provide an image/GIF to generate a motivational poster!";
+ static command = "motivate";
+}
+
+export default MotivateCommand;
diff --git a/commands/image-editing/pixelate.js b/commands/image-editing/pixelate.js
index 813b4cb..8074d5e 100644
--- a/commands/image-editing/pixelate.js
+++ b/commands/image-editing/pixelate.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class PixelateCommand extends ImageCommand {
- static description = "Pixelates an image";
- static aliases = ["pixel", "small"];
-
- static noImage = "You need to provide an image/GIF to pixelate!";
- static command = "resize";
-}
-
-export default PixelateCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class PixelateCommand extends ImageCommand {
+ static description = "Pixelates an image";
+ static aliases = ["pixel", "small"];
+
+ static noImage = "You need to provide an image/GIF to pixelate!";
+ static command = "resize";
+}
+
+export default PixelateCommand;
diff --git a/commands/image-editing/reddit.js b/commands/image-editing/reddit.js
index 3409a18..5924248 100644
--- a/commands/image-editing/reddit.js
+++ b/commands/image-editing/reddit.js
@@ -1,22 +1,22 @@
-import ImageCommand from "../../classes/imageCommand.js";
-import { random } from "../../utils/misc.js";
-const names = ["esmBot", "me_irl", "dankmemes", "hmmm", "gaming", "wholesome", "chonkers", "memes", "funny", "lies"];
-
-class RedditCommand extends ImageCommand {
- params(url) {
- const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
- return {
- caption: newArgs?.trim() ? newArgs.replaceAll("\n", "").replaceAll(" ", "") : random(names)
- };
- }
-
- static textOptional = true;
-
- static description = "Adds a Reddit watermark to an image";
- static arguments = ["{text}"];
-
- static noText = "You need to provide some text to add a Reddit watermark!";
- static command = "reddit";
-}
-
-export default RedditCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+import { random } from "../../utils/misc.js";
+const names = ["esmBot", "me_irl", "dankmemes", "hmmm", "gaming", "wholesome", "chonkers", "memes", "funny", "lies"];
+
+class RedditCommand extends ImageCommand {
+ params(url) {
+ const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
+ return {
+ caption: newArgs?.trim() ? newArgs.replaceAll("\n", "").replaceAll(" ", "") : random(names)
+ };
+ }
+
+ static textOptional = true;
+
+ static description = "Adds a Reddit watermark to an image";
+ static arguments = ["{text}"];
+
+ static noText = "You need to provide some text to add a Reddit watermark!";
+ static command = "reddit";
+}
+
+export default RedditCommand;
diff --git a/commands/image-editing/reverse.js b/commands/image-editing/reverse.js
index 83632b5..3f34ade 100644
--- a/commands/image-editing/reverse.js
+++ b/commands/image-editing/reverse.js
@@ -1,12 +1,12 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class ReverseCommand extends ImageCommand {
- static description = "Reverses an image sequence";
- static aliases = ["backwards"];
-
- static requiresGIF = true;
- static noImage = "You need to provide an image/GIF to reverse!";
- static command = "reverse";
-}
-
-export default ReverseCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class ReverseCommand extends ImageCommand {
+ static description = "Reverses an image sequence";
+ static aliases = ["backwards"];
+
+ static requiresGIF = true;
+ static noImage = "You need to provide an image/GIF to reverse!";
+ static command = "reverse";
+}
+
+export default ReverseCommand;
diff --git a/commands/image-editing/scott.js b/commands/image-editing/scott.js
index 8794f72..28b472b 100644
--- a/commands/image-editing/scott.js
+++ b/commands/image-editing/scott.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class ScottCommand extends ImageCommand {
- static description = "Makes Scott the Woz show off an image";
- static aliases = ["woz", "tv", "porn"];
-
- static noImage = "You need to provide an image/GIF for Scott to show off!";
- static command = "scott";
-}
-
-export default ScottCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class ScottCommand extends ImageCommand {
+ static description = "Makes Scott the Woz show off an image";
+ static aliases = ["woz", "tv", "porn"];
+
+ static noImage = "You need to provide an image/GIF for Scott to show off!";
+ static command = "scott";
+}
+
+export default ScottCommand;
diff --git a/commands/image-editing/sepia.js b/commands/image-editing/sepia.js
index 779a9e8..bdd4fb2 100644
--- a/commands/image-editing/sepia.js
+++ b/commands/image-editing/sepia.js
@@ -1,14 +1,14 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SepiaCommand extends ImageCommand {
- params = {
- color: "sepia"
- };
-
- static description = "Adds a sepia filter";
-
- static noImage = "You need to provide an image/GIF to add a sepia filter!";
- static command = "colors";
-}
-
-export default SepiaCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SepiaCommand extends ImageCommand {
+ params = {
+ color: "sepia"
+ };
+
+ static description = "Adds a sepia filter";
+
+ static noImage = "You need to provide an image/GIF to add a sepia filter!";
+ static command = "colors";
+}
+
+export default SepiaCommand;
diff --git a/commands/image-editing/sharpen.js b/commands/image-editing/sharpen.js
index bfe7928..0886d7e 100644
--- a/commands/image-editing/sharpen.js
+++ b/commands/image-editing/sharpen.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SharpenCommand extends ImageCommand {
- params = {
- sharp: true
- };
-
- static description = "Sharpens an image";
- static aliases = ["sharp"];
-
- static noImage = "You need to provide an image/GIF to sharpen!";
- static command = "blur";
-}
-
-export default SharpenCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SharpenCommand extends ImageCommand {
+ params = {
+ sharp: true
+ };
+
+ static description = "Sharpens an image";
+ static aliases = ["sharp"];
+
+ static noImage = "You need to provide an image/GIF to sharpen!";
+ static command = "blur";
+}
+
+export default SharpenCommand;
diff --git a/commands/image-editing/shutterstock.js b/commands/image-editing/shutterstock.js
index 6c3e325..001e692 100644
--- a/commands/image-editing/shutterstock.js
+++ b/commands/image-editing/shutterstock.js
@@ -1,17 +1,17 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class ShutterstockCommand extends ImageCommand {
- params = {
- water: "assets/images/shutterstock.png",
- gravity: 5,
- resize: true
- };
-
- static description = "Adds the Shutterstock watermark to an image";
- static aliases = ["stock", "stockphoto"];
-
- static noImage = "You need to provide an image/GIF to add a Shutterstock watermark!";
- static command = "watermark";
-}
-
-export default ShutterstockCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class ShutterstockCommand extends ImageCommand {
+ params = {
+ water: "assets/images/shutterstock.png",
+ gravity: 5,
+ resize: true
+ };
+
+ static description = "Adds the Shutterstock watermark to an image";
+ static aliases = ["stock", "stockphoto"];
+
+ static noImage = "You need to provide an image/GIF to add a Shutterstock watermark!";
+ static command = "watermark";
+}
+
+export default ShutterstockCommand;
diff --git a/commands/image-editing/slow.js b/commands/image-editing/slow.js
index 320699b..59b2ecf 100644
--- a/commands/image-editing/slow.js
+++ b/commands/image-editing/slow.js
@@ -1,32 +1,32 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SlowCommand extends ImageCommand {
- params() {
- const speed = parseInt(this.options.multiplier ?? this.args[0]);
- return {
- slow: true,
- speed: isNaN(speed) ? 2 : speed
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "multiplier",
- type: 4,
- description: "Set the speed multiplier (default: 2)",
- min_value: 1
- });
- return this;
- }
-
- static description = "Makes an image sequence slower";
- static aliases = ["slowdown", "slower", "gifspeed2"];
- static arguments = ["{multiplier}"];
-
- static requiresGIF = true;
- static noImage = "You need to provide an image/GIF to slow down!";
- static command = "speed";
-}
-
-export default SlowCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SlowCommand extends ImageCommand {
+ params() {
+ const speed = parseInt(this.options.multiplier ?? this.args[0]);
+ return {
+ slow: true,
+ speed: isNaN(speed) ? 2 : speed
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "multiplier",
+ type: 4,
+ description: "Set the speed multiplier (default: 2)",
+ min_value: 1
+ });
+ return this;
+ }
+
+ static description = "Makes an image sequence slower";
+ static aliases = ["slowdown", "slower", "gifspeed2"];
+ static arguments = ["{multiplier}"];
+
+ static requiresGIF = true;
+ static noImage = "You need to provide an image/GIF to slow down!";
+ static command = "speed";
+}
+
+export default SlowCommand;
diff --git a/commands/image-editing/snapchat.js b/commands/image-editing/snapchat.js
index 170c20c..e800060 100644
--- a/commands/image-editing/snapchat.js
+++ b/commands/image-editing/snapchat.js
@@ -1,36 +1,36 @@
-import ImageCommand from "../../classes/imageCommand.js";
-import { cleanMessage } from "../../utils/misc.js";
-
-class SnapchatCommand extends ImageCommand {
- params(url) {
- const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
- const position = parseFloat(this.options.position);
- return {
- caption: cleanMessage(this.message ?? this.interaction, newArgs),
- pos: isNaN(position) ? 0.5 : position
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "position",
- type: 10,
- description: "Set the position of the caption as a decimal (0.0 is top, 1.0 is bottom, default is 0.5)",
- min_value: 0,
- max_value: 1
- });
- return this;
- }
-
- static description = "Adds a Snapchat style caption to an image";
- static aliases = ["snap", "caption3"];
- static arguments = ["[text]"];
-
- static requiresText = true;
- static noText = "You need to provide some text to add a caption!";
- static noImage = "You need to provide an image/GIF to add a caption!";
- static command = "snapchat";
-}
-
-export default SnapchatCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+import { cleanMessage } from "../../utils/misc.js";
+
+class SnapchatCommand extends ImageCommand {
+ params(url) {
+ const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
+ const position = parseFloat(this.options.position);
+ return {
+ caption: cleanMessage(this.message ?? this.interaction, newArgs),
+ pos: isNaN(position) ? 0.5 : position
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "position",
+ type: 10,
+ description: "Set the position of the caption as a decimal (0.0 is top, 1.0 is bottom, default is 0.5)",
+ min_value: 0,
+ max_value: 1
+ });
+ return this;
+ }
+
+ static description = "Adds a Snapchat style caption to an image";
+ static aliases = ["snap", "caption3"];
+ static arguments = ["[text]"];
+
+ static requiresText = true;
+ static noText = "You need to provide some text to add a caption!";
+ static noImage = "You need to provide an image/GIF to add a caption!";
+ static command = "snapchat";
+}
+
+export default SnapchatCommand;
diff --git a/commands/image-editing/soos.js b/commands/image-editing/soos.js
index 9f70dda..9aee465 100644
--- a/commands/image-editing/soos.js
+++ b/commands/image-editing/soos.js
@@ -1,16 +1,16 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SooSCommand extends ImageCommand {
- params = {
- soos: true
- };
-
- static description = "\"Loops\" an image sequence by reversing it when it's finished";
- static aliases = ["boomerang"];
-
- static requiresGIF = true;
- static noImage = "You need to provide an image/GIF to loop!";
- static command = "reverse";
-}
-
-export default SooSCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SooSCommand extends ImageCommand {
+ params = {
+ soos: true
+ };
+
+ static description = "\"Loops\" an image sequence by reversing it when it's finished";
+ static aliases = ["boomerang"];
+
+ static requiresGIF = true;
+ static noImage = "You need to provide an image/GIF to loop!";
+ static command = "reverse";
+}
+
+export default SooSCommand;
diff --git a/commands/image-editing/speechbubble.js b/commands/image-editing/speechbubble.js
index 4e3d40c..1ee494b 100644
--- a/commands/image-editing/speechbubble.js
+++ b/commands/image-editing/speechbubble.js
@@ -1,36 +1,36 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SpeechBubbleCommand extends ImageCommand {
- params() {
- return {
- water: this.options.alpha ? "assets/images/speech.png" : "assets/images/speechbubble.png",
- gravity: "north",
- resize: true,
- yscale: 0.2,
- alpha: this.options.alpha ? true : false,
- flip: this.options.flip ? true : false
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "alpha",
- description: "Make the top of the speech bubble transparent",
- type: 5
- }, {
- name: "flip",
- description: "Flips the speech bubble",
- type: 5
- });
- return this;
- }
-
- static description = "Adds a speech bubble to an image";
- static aliases = ["speech"];
-
- static noImage = "You need to provide an image/GIF to add a speech bubble!";
- static command = "watermark";
-}
-
-export default SpeechBubbleCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SpeechBubbleCommand extends ImageCommand {
+ params() {
+ return {
+ water: this.options.alpha ? "assets/images/speech.png" : "assets/images/speechbubble.png",
+ gravity: "north",
+ resize: true,
+ yscale: 0.2,
+ alpha: this.options.alpha ? true : false,
+ flip: this.options.flip ? true : false
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "alpha",
+ description: "Make the top of the speech bubble transparent",
+ type: 5
+ }, {
+ name: "flip",
+ description: "Flips the speech bubble",
+ type: 5
+ });
+ return this;
+ }
+
+ static description = "Adds a speech bubble to an image";
+ static aliases = ["speech"];
+
+ static noImage = "You need to provide an image/GIF to add a speech bubble!";
+ static command = "watermark";
+}
+
+export default SpeechBubbleCommand;
diff --git a/commands/image-editing/speed.js b/commands/image-editing/speed.js
index dc91e94..ea332f6 100644
--- a/commands/image-editing/speed.js
+++ b/commands/image-editing/speed.js
@@ -1,31 +1,31 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SpeedCommand extends ImageCommand {
- params() {
- const speed = parseInt(this.options.multiplier ?? this.args[0]);
- return {
- speed: isNaN(speed) || speed < 1 ? 2 : speed
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "multiplier",
- type: 4,
- description: "Set the speed multiplier (default: 2)",
- min_value: 1
- });
- return this;
- }
-
- static description = "Makes an image sequence faster";
- static aliases = ["speedup", "fast", "gifspeed", "faster"];
- static arguments = ["{multiplier}"];
-
- static requiresGIF = true;
- static noImage = "You need to provide an image/GIF to speed up!";
- static command = "speed";
-}
-
-export default SpeedCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SpeedCommand extends ImageCommand {
+ params() {
+ const speed = parseInt(this.options.multiplier ?? this.args[0]);
+ return {
+ speed: isNaN(speed) || speed < 1 ? 2 : speed
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "multiplier",
+ type: 4,
+ description: "Set the speed multiplier (default: 2)",
+ min_value: 1
+ });
+ return this;
+ }
+
+ static description = "Makes an image sequence faster";
+ static aliases = ["speedup", "fast", "gifspeed", "faster"];
+ static arguments = ["{multiplier}"];
+
+ static requiresGIF = true;
+ static noImage = "You need to provide an image/GIF to speed up!";
+ static command = "speed";
+}
+
+export default SpeedCommand;
diff --git a/commands/image-editing/spin.js b/commands/image-editing/spin.js
index ef6387d..6dca188 100644
--- a/commands/image-editing/spin.js
+++ b/commands/image-editing/spin.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SpinCommand extends ImageCommand {
- static description = "Spins an image";
- static aliases = ["rotate"];
-
- static noImage = "You need to provide an image/GIF to spin!";
- static command = "spin";
-}
-
-export default SpinCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SpinCommand extends ImageCommand {
+ static description = "Spins an image";
+ static aliases = ["rotate"];
+
+ static noImage = "You need to provide an image/GIF to spin!";
+ static command = "spin";
+}
+
+export default SpinCommand;
diff --git a/commands/image-editing/squish.js b/commands/image-editing/squish.js
index f3a575c..173a040 100644
--- a/commands/image-editing/squish.js
+++ b/commands/image-editing/squish.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SquishCommand extends ImageCommand {
- static description = "Squishes/stretches an image";
- static aliases = ["squishy", "squash"];
-
- static noImage = "You need to provide an image/GIF to squish!";
- static command = "squish";
-}
-
-export default SquishCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SquishCommand extends ImageCommand {
+ static description = "Squishes/stretches an image";
+ static aliases = ["squishy", "squash"];
+
+ static noImage = "You need to provide an image/GIF to squish!";
+ static command = "squish";
+}
+
+export default SquishCommand;
diff --git a/commands/image-editing/stretch.js b/commands/image-editing/stretch.js
index 0f89814..131dcb1 100644
--- a/commands/image-editing/stretch.js
+++ b/commands/image-editing/stretch.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class StretchCommand extends ImageCommand {
- params = {
- stretch: true
- };
-
- static description = "Stretches an image to a 1:1 aspect ratio";
- static aliases = ["aspect", "ratio", "aspect11", "11"];
-
- static noImage = "You need to provide an image/GIF to stretch!";
- static command = "resize";
-}
-
-export default StretchCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class StretchCommand extends ImageCommand {
+ params = {
+ stretch: true
+ };
+
+ static description = "Stretches an image to a 1:1 aspect ratio";
+ static aliases = ["aspect", "ratio", "aspect11", "11"];
+
+ static noImage = "You need to provide an image/GIF to stretch!";
+ static command = "resize";
+}
+
+export default StretchCommand;
diff --git a/commands/image-editing/swirl.js b/commands/image-editing/swirl.js
index 476b506..a95cd15 100644
--- a/commands/image-editing/swirl.js
+++ b/commands/image-editing/swirl.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class SwirlCommand extends ImageCommand {
- static description = "Swirls an image";
- static aliases = ["whirlpool", "distort"];
-
- static noImage = "You need to provide an image/GIF to swirl!";
- static command = "swirl";
-}
-
-export default SwirlCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class SwirlCommand extends ImageCommand {
+ static description = "Swirls an image";
+ static aliases = ["whirlpool", "distort"];
+
+ static noImage = "You need to provide an image/GIF to swirl!";
+ static command = "swirl";
+}
+
+export default SwirlCommand;
diff --git a/commands/image-editing/tile.js b/commands/image-editing/tile.js
index 6566253..a302f4f 100644
--- a/commands/image-editing/tile.js
+++ b/commands/image-editing/tile.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class TileCommand extends ImageCommand {
- static description = "Creates a tile pattern from an image";
- static aliases = ["wall2"];
-
- static noImage = "You need to provide an image/GIF to tile!";
- static command = "tile";
-}
-
-export default TileCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class TileCommand extends ImageCommand {
+ static description = "Creates a tile pattern from an image";
+ static aliases = ["wall2"];
+
+ static noImage = "You need to provide an image/GIF to tile!";
+ static command = "tile";
+}
+
+export default TileCommand;
diff --git a/commands/image-editing/uncanny.js b/commands/image-editing/uncanny.js
index 49bf262..a6ee468 100644
--- a/commands/image-editing/uncanny.js
+++ b/commands/image-editing/uncanny.js
@@ -1,65 +1,65 @@
-import ImageCommand from "../../classes/imageCommand.js";
-import { random, cleanMessage } from "../../utils/misc.js";
-import { readdirSync } from "fs";
-import { resolve, dirname } from "path";
-import { fileURLToPath } from "url";
-const prompts = ["you found:", "your dad is:", "you ate:", "your mom is:", "your sister is:", "you saw:", "you get lost in:", "you find:", "you grab:", "you pull out of your pocket:", "you fight:", "it's in your room:"];
-const names = readdirSync(resolve(dirname(fileURLToPath(import.meta.url)), "../../assets/images/uncanny/")).filter((val) => {
- if (!val.startsWith(".") && val.endsWith(".png")) return true;
-}).map((val) => {
- return val.split(".")[0];
-});
-
-class UncannyCommand extends ImageCommand {
- params(url, name = "unknown") {
- const newArgs = this.options.text ?? this.args.join(" ");
- // eslint-disable-next-line prefer-const
- let [text1, text2] = newArgs.replaceAll(url, "").split(/(? elem.trim());
- if (!text2?.trim()) text2 = name;
- return {
- caption: text1?.trim() ? cleanMessage(this.message ?? this.interaction, text1) : random(prompts),
- caption2: cleanMessage(this.message ?? this.interaction, text2),
- path: `assets/images/uncanny/${typeof this.options.phase === "string" && names.includes(this.options.phase.toLowerCase()) ? this.options.phase.toLowerCase() : random(names.filter((val) => val !== "goated"))}.png`,
- font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica"
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "font",
- type: 3,
- choices: (() => {
- const array = [];
- for (const font of this.allowedFonts) {
- array.push({ name: font, value: font });
- }
- return array;
- })(),
- description: "Specify the font you want to use (default: helvetica)"
- }, {
- name: "phase",
- type: 3,
- choices: (() => {
- const array = [];
- for (const name of names) {
- array.push({ name, value: name });
- }
- return array;
- })(),
- description: "Specify the uncanny image you want to use"
- });
- return this;
- }
-
- static textOptional = true;
-
- static description = "Makes a Mr. Incredible Becomes Uncanny image (separate left/right text with a comma)";
- static aliases = ["canny", "incredible", "pain"];
- static arguments = ["{left text}", "{right text}"];
-
- static noImage = "You need to provide an image/GIF to create an uncanny image!";
- static command = "uncanny";
-}
-
-export default UncannyCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+import { random, cleanMessage } from "../../utils/misc.js";
+import { readdirSync } from "fs";
+import { resolve, dirname } from "path";
+import { fileURLToPath } from "url";
+const prompts = ["you found:", "your dad is:", "you ate:", "your mom is:", "your sister is:", "you saw:", "you get lost in:", "you find:", "you grab:", "you pull out of your pocket:", "you fight:", "it's in your room:"];
+const names = readdirSync(resolve(dirname(fileURLToPath(import.meta.url)), "../../assets/images/uncanny/")).filter((val) => {
+ if (!val.startsWith(".") && val.endsWith(".png")) return true;
+}).map((val) => {
+ return val.split(".")[0];
+});
+
+class UncannyCommand extends ImageCommand {
+ params(url, name = "unknown") {
+ const newArgs = this.options.text ?? this.args.join(" ");
+ // eslint-disable-next-line prefer-const
+ let [text1, text2] = newArgs.replaceAll(url, "").split(/(? elem.trim());
+ if (!text2?.trim()) text2 = name;
+ return {
+ caption: text1?.trim() ? cleanMessage(this.message ?? this.interaction, text1) : random(prompts),
+ caption2: cleanMessage(this.message ?? this.interaction, text2),
+ path: `assets/images/uncanny/${typeof this.options.phase === "string" && names.includes(this.options.phase.toLowerCase()) ? this.options.phase.toLowerCase() : random(names.filter((val) => val !== "goated"))}.png`,
+ font: typeof this.options.font === "string" && this.constructor.allowedFonts.includes(this.options.font.toLowerCase()) ? this.options.font.toLowerCase() : "helvetica"
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "font",
+ type: 3,
+ choices: (() => {
+ const array = [];
+ for (const font of this.allowedFonts) {
+ array.push({ name: font, value: font });
+ }
+ return array;
+ })(),
+ description: "Specify the font you want to use (default: helvetica)"
+ }, {
+ name: "phase",
+ type: 3,
+ choices: (() => {
+ const array = [];
+ for (const name of names) {
+ array.push({ name, value: name });
+ }
+ return array;
+ })(),
+ description: "Specify the uncanny image you want to use"
+ });
+ return this;
+ }
+
+ static textOptional = true;
+
+ static description = "Makes a Mr. Incredible Becomes Uncanny image (separate left/right text with a comma)";
+ static aliases = ["canny", "incredible", "pain"];
+ static arguments = ["{left text}", "{right text}"];
+
+ static noImage = "You need to provide an image/GIF to create an uncanny image!";
+ static command = "uncanny";
+}
+
+export default UncannyCommand;
diff --git a/commands/image-editing/uncaption.js b/commands/image-editing/uncaption.js
index 34f2b15..c8992a1 100644
--- a/commands/image-editing/uncaption.js
+++ b/commands/image-editing/uncaption.js
@@ -1,29 +1,29 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class UncaptionCommand extends ImageCommand {
- params() {
- const tolerance = parseFloat(this.options.tolerance);
- return {
- tolerance: isNaN(tolerance) ? 0.95 : tolerance
- };
- }
-
- static init() {
- super.init();
- this.flags.push({
- name: "tolerance",
- type: 10,
- description: "Set the shade tolerance for the caption detection (0.0 is highest, 1.0 is lowest, default is 0.95)",
- min_value: 0,
- max_value: 1
- });
- return this;
- }
-
- static description = "Removes the caption from an image";
-
- static noImage = "You need to provide an image/GIF to uncaption!";
- static command = "uncaption";
-}
-
-export default UncaptionCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class UncaptionCommand extends ImageCommand {
+ params() {
+ const tolerance = parseFloat(this.options.tolerance);
+ return {
+ tolerance: isNaN(tolerance) ? 0.95 : tolerance
+ };
+ }
+
+ static init() {
+ super.init();
+ this.flags.push({
+ name: "tolerance",
+ type: 10,
+ description: "Set the shade tolerance for the caption detection (0.0 is highest, 1.0 is lowest, default is 0.95)",
+ min_value: 0,
+ max_value: 1
+ });
+ return this;
+ }
+
+ static description = "Removes the caption from an image";
+
+ static noImage = "You need to provide an image/GIF to uncaption!";
+ static command = "uncaption";
+}
+
+export default UncaptionCommand;
diff --git a/commands/image-editing/unfreeze.js b/commands/image-editing/unfreeze.js
index 13ed4c2..b13559c 100644
--- a/commands/image-editing/unfreeze.js
+++ b/commands/image-editing/unfreeze.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class UnfreezeCommand extends ImageCommand {
- params = {
- loop: true
- };
-
- static description = "Unfreezes an image sequence";
-
- static requiresGIF = true;
- static noImage = "You need to provide an image/GIF to unfreeze!";
- static command = "freeze";
-}
-
-export default UnfreezeCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class UnfreezeCommand extends ImageCommand {
+ params = {
+ loop: true
+ };
+
+ static description = "Unfreezes an image sequence";
+
+ static requiresGIF = true;
+ static noImage = "You need to provide an image/GIF to unfreeze!";
+ static command = "freeze";
+}
+
+export default UnfreezeCommand;
diff --git a/commands/image-editing/waaw.js b/commands/image-editing/waaw.js
index b3e08c3..b9d3e3b 100644
--- a/commands/image-editing/waaw.js
+++ b/commands/image-editing/waaw.js
@@ -1,11 +1,11 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class WaaWCommand extends ImageCommand {
- static description = "Mirrors the right side of an image onto the left";
- static aliases = ["magik3", "mirror"];
-
- static noImage = "You need to provide an image/GIF to mirror!";
- static command = "mirror";
-}
-
-export default WaaWCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class WaaWCommand extends ImageCommand {
+ static description = "Mirrors the right side of an image onto the left";
+ static aliases = ["magik3", "mirror"];
+
+ static noImage = "You need to provide an image/GIF to mirror!";
+ static command = "mirror";
+}
+
+export default WaaWCommand;
diff --git a/commands/image-editing/wall.js b/commands/image-editing/wall.js
index 1854e71..026b4ad 100644
--- a/commands/image-editing/wall.js
+++ b/commands/image-editing/wall.js
@@ -1,10 +1,10 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class WallCommand extends ImageCommand {
- static description = "Creates a wall from an image";
-
- static noImage = "You need to provide an image/GIF to make a wall!";
- static command = "wall";
-}
-
-export default WallCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class WallCommand extends ImageCommand {
+ static description = "Creates a wall from an image";
+
+ static noImage = "You need to provide an image/GIF to make a wall!";
+ static command = "wall";
+}
+
+export default WallCommand;
diff --git a/commands/image-editing/whisper.js b/commands/image-editing/whisper.js
index 64b8c25..d0a4c5b 100644
--- a/commands/image-editing/whisper.js
+++ b/commands/image-editing/whisper.js
@@ -1,22 +1,22 @@
-import ImageCommand from "../../classes/imageCommand.js";
-import { cleanMessage } from "../../utils/misc.js";
-
-class WhisperCommand extends ImageCommand {
- params(url) {
- const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
- return {
- caption: cleanMessage(this.message ?? this.interaction, newArgs)
- };
- }
-
- static description = "Adds a Whisper style caption to an image";
- static aliases = ["caption4"];
- static arguments = ["[text]"];
-
- static requiresText = true;
- static noText = "You need to provide some text to add a caption!";
- static noImage = "You need to provide an image/GIF to add a caption!";
- static command = "whisper";
-}
-
-export default WhisperCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+import { cleanMessage } from "../../utils/misc.js";
+
+class WhisperCommand extends ImageCommand {
+ params(url) {
+ const newArgs = this.options.text ?? this.args.filter(item => !item.includes(url)).join(" ");
+ return {
+ caption: cleanMessage(this.message ?? this.interaction, newArgs)
+ };
+ }
+
+ static description = "Adds a Whisper style caption to an image";
+ static aliases = ["caption4"];
+ static arguments = ["[text]"];
+
+ static requiresText = true;
+ static noText = "You need to provide some text to add a caption!";
+ static noImage = "You need to provide an image/GIF to add a caption!";
+ static command = "whisper";
+}
+
+export default WhisperCommand;
diff --git a/commands/image-editing/wide.js b/commands/image-editing/wide.js
index 8baffc2..d73e7cb 100644
--- a/commands/image-editing/wide.js
+++ b/commands/image-editing/wide.js
@@ -1,15 +1,15 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class WideCommand extends ImageCommand {
- params = {
- wide: true
- };
-
- static description = "Stretches an image to 19x its width";
- static aliases = ["w19", "wide19"];
-
- static noImage = "You need to provide an image/GIF to stretch!";
- static command = "resize";
-}
-
-export default WideCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class WideCommand extends ImageCommand {
+ params = {
+ wide: true
+ };
+
+ static description = "Stretches an image to 19x its width";
+ static aliases = ["w19", "wide19"];
+
+ static noImage = "You need to provide an image/GIF to stretch!";
+ static command = "resize";
+}
+
+export default WideCommand;
diff --git a/commands/image-editing/woow.js b/commands/image-editing/woow.js
index fda4b90..a941a28 100644
--- a/commands/image-editing/woow.js
+++ b/commands/image-editing/woow.js
@@ -1,16 +1,16 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class WooWCommand extends ImageCommand {
- params = {
- vertical: true,
- first: true
- };
-
- static description = "Mirrors the top of an image onto the bottom";
- static aliases = ["magik5", "mirror3"];
-
- static noImage = "You need to provide an image/GIF to mirror!";
- static command = "mirror";
-}
-
-export default WooWCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class WooWCommand extends ImageCommand {
+ params = {
+ vertical: true,
+ first: true
+ };
+
+ static description = "Mirrors the top of an image onto the bottom";
+ static aliases = ["magik5", "mirror3"];
+
+ static noImage = "You need to provide an image/GIF to mirror!";
+ static command = "mirror";
+}
+
+export default WooWCommand;
diff --git a/commands/image-editing/zamn.js b/commands/image-editing/zamn.js
index 28c6e19..847ae29 100644
--- a/commands/image-editing/zamn.js
+++ b/commands/image-editing/zamn.js
@@ -1,10 +1,10 @@
-import ImageCommand from "../../classes/imageCommand.js";
-
-class ZamnCommand extends ImageCommand {
- static description = "Adds a \"ZAMN\" reaction to an image";
-
- static noImage = "You need to provide an image/GIF to \"ZAMN\" at!";
- static command = "zamn";
-}
-
-export default ZamnCommand;
+import ImageCommand from "../../classes/imageCommand.js";
+
+class ZamnCommand extends ImageCommand {
+ static description = "Adds a \"ZAMN\" reaction to an image";
+
+ static noImage = "You need to provide an image/GIF to \"ZAMN\" at!";
+ static command = "zamn";
+}
+
+export default ZamnCommand;
diff --git a/commands/message/select-image.js b/commands/message/select-image.js
index bfd047d..54400ed 100644
--- a/commands/message/select-image.js
+++ b/commands/message/select-image.js
@@ -1,23 +1,23 @@
-import Command from "../../classes/command.js";
-import imageDetect from "../../utils/imagedetect.js";
-import { selectedImages } from "../../utils/collections.js";
-
-class SelectImageCommand extends Command {
- async run() {
- await this.acknowledge();
- const message = this.interaction.data.target;
- const image = await imageDetect(this.client, message, this.interaction, this.options, true, false, false, true);
- this.success = false;
- if (image === undefined) {
- return "I couldn't find an image in that message!";
- } else if (image.type === "large") {
- return "That image is too large (>= 25MB)! Try using a smaller image.";
- } else if (image.type === "tenorlimit") {
- return "I've been rate-limited by Tenor. Please try uploading your GIF elsewhere.";
- }
- selectedImages.set(this.author.id, image);
- return "The image has been selected for your next command.";
- }
-}
-
+import Command from "../../classes/command.js";
+import imageDetect from "../../utils/imagedetect.js";
+import { selectedImages } from "../../utils/collections.js";
+
+class SelectImageCommand extends Command {
+ async run() {
+ await this.acknowledge();
+ const message = this.interaction.data.target;
+ const image = await imageDetect(this.client, message, this.interaction, this.options, true, false, false, true);
+ this.success = false;
+ if (image === undefined) {
+ return "I couldn't find an image in that message!";
+ } else if (image.type === "large") {
+ return "That image is too large (>= 25MB)! Try using a smaller image.";
+ } else if (image.type === "tenorlimit") {
+ return "I've been rate-limited by Tenor. Please try uploading your GIF elsewhere.";
+ }
+ selectedImages.set(this.author.id, image);
+ return "The image has been selected for your next command.";
+ }
+}
+
export default SelectImageCommand;
\ No newline at end of file
diff --git a/commands/music/host.js b/commands/music/host.js
index 584cf6c..20c89de 100644
--- a/commands/music/host.js
+++ b/commands/music/host.js
@@ -1,60 +1,60 @@
-import { players } from "../../utils/soundplayer.js";
-import MusicCommand from "../../classes/musicCommand.js";
-
-class HostCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.connection) return "I haven't completely connected yet!";
- if (this.connection.host !== this.author.id && !process.env.OWNER.split(",").includes(this.connection.host)) return "Only the current voice session host can choose another host!";
- const input = this.options.user ?? this.args.join(" ");
- if (input?.trim()) {
- let user;
- if (this.type === "classic") {
- const getUser = this.message.mentions.users.length >= 1 ? this.message.mentions.users[0] : this.client.users.get(input);
- if (getUser) {
- user = getUser;
- } else if (input.match(/^[@#]?[&!]?\d+>?$/) && input >= 21154535154122752n) {
- try {
- user = await this.client.rest.users.get(input);
- } catch {
- // no-op
- }
- } else {
- const userRegex = new RegExp(input.split(" ").join("|"), "i");
- const member = this.client.users.find(element => {
- return userRegex.test(element.username);
- });
- user = member;
- }
- } else {
- user = input;
- }
- if (!user) return "I can't find that user!";
- if (user.bot) return "This is illegal, you know.";
- const member = this.guild.members.get(user.id);
- if (!member) return "That user isn't in this server!";
- const object = this.connection;
- object.host = member.id;
- players.set(this.guildID, object);
- this.success = true;
- return `đ ${member.mention} is the new voice channel host.`;
- } else {
- const member = this.guild.members.get(players.get(this.guild.id).host);
- this.success = true;
- return `đ The current voice channel host is **${member?.username}#${member?.discriminator}**.`;
- }
- }
-
- static flags = [{
- name: "user",
- type: 6,
- description: "The user you want the new host to be"
- }];
- static description = "Gets or changes the host of the current voice session";
- static aliases = ["sethost"];
-}
-
-export default HostCommand;
+import { players } from "../../utils/soundplayer.js";
+import MusicCommand from "../../classes/musicCommand.js";
+
+class HostCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.connection) return "I haven't completely connected yet!";
+ if (this.connection.host !== this.author.id && !process.env.OWNER.split(",").includes(this.connection.host)) return "Only the current voice session host can choose another host!";
+ const input = this.options.user ?? this.args.join(" ");
+ if (input?.trim()) {
+ let user;
+ if (this.type === "classic") {
+ const getUser = this.message.mentions.users.length >= 1 ? this.message.mentions.users[0] : this.client.users.get(input);
+ if (getUser) {
+ user = getUser;
+ } else if (input.match(/^[@#]?[&!]?\d+>?$/) && input >= 21154535154122752n) {
+ try {
+ user = await this.client.rest.users.get(input);
+ } catch {
+ // no-op
+ }
+ } else {
+ const userRegex = new RegExp(input.split(" ").join("|"), "i");
+ const member = this.client.users.find(element => {
+ return userRegex.test(element.username);
+ });
+ user = member;
+ }
+ } else {
+ user = input;
+ }
+ if (!user) return "I can't find that user!";
+ if (user.bot) return "This is illegal, you know.";
+ const member = this.guild.members.get(user.id);
+ if (!member) return "That user isn't in this server!";
+ const object = this.connection;
+ object.host = member.id;
+ players.set(this.guildID, object);
+ this.success = true;
+ return `đ ${member.mention} is the new voice channel host.`;
+ } else {
+ const member = this.guild.members.get(players.get(this.guild.id).host);
+ this.success = true;
+ return `đ The current voice channel host is **${member?.username}#${member?.discriminator}**.`;
+ }
+ }
+
+ static flags = [{
+ name: "user",
+ type: 6,
+ description: "The user you want the new host to be"
+ }];
+ static description = "Gets or changes the host of the current voice session";
+ static aliases = ["sethost"];
+}
+
+export default HostCommand;
diff --git a/commands/music/loop.js b/commands/music/loop.js
index 8d5331e..b37f494 100644
--- a/commands/music/loop.js
+++ b/commands/music/loop.js
@@ -1,23 +1,23 @@
-import { players } from "../../utils/soundplayer.js";
-import MusicCommand from "../../classes/musicCommand.js";
-
-class LoopCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.connection) return "I haven't completely connected yet!";
- if (this.connection.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) return "Only the current voice session host can loop the music!";
- const object = this.connection;
- object.loop = !object.loop;
- players.set(this.guild.id, object);
- this.success = true;
- return object.loop ? "đ The player is now looping." : "đ The player is no longer looping.";
- }
-
- static description = "Loops the music";
- static aliases = ["toggleloop", "repeat"];
-}
-
+import { players } from "../../utils/soundplayer.js";
+import MusicCommand from "../../classes/musicCommand.js";
+
+class LoopCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.connection) return "I haven't completely connected yet!";
+ if (this.connection.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) return "Only the current voice session host can loop the music!";
+ const object = this.connection;
+ object.loop = !object.loop;
+ players.set(this.guild.id, object);
+ this.success = true;
+ return object.loop ? "đ The player is now looping." : "đ The player is no longer looping.";
+ }
+
+ static description = "Loops the music";
+ static aliases = ["toggleloop", "repeat"];
+}
+
export default LoopCommand;
\ No newline at end of file
diff --git a/commands/music/music.js b/commands/music/music.js
index 684a880..17b1cc2 100644
--- a/commands/music/music.js
+++ b/commands/music/music.js
@@ -1,48 +1,48 @@
-import Command from "../../classes/command.js";
-import { commands, aliases, info, categories } from "../../utils/collections.js";
-
-// all-in-one music command
-class MusicAIOCommand extends Command {
- async run() {
- let cmd = this.type === "classic" ? this.args[0] : this.optionsArray[0].name;
- if (cmd === "music" || this.constructor.aliases.includes(cmd)) return "https://esmbot.net/robotdance.gif";
- await this.acknowledge();
- if (this.type === "classic") {
- this.origOptions.args.shift();
- } else {
- this.origOptions.interaction.data.options.raw = this.origOptions.interaction.data.options.raw[0].options;
- }
- if (aliases.has(cmd)) cmd = aliases.get(cmd);
- if (commands.has(cmd) && info.get(cmd).category === "music") {
- const command = commands.get(cmd);
- const inst = new command(this.client, this.origOptions);
- const result = await inst.run();
- this.success = inst.success;
- return result;
- } else {
- this.success = false;
- return "That isn't a valid music command!";
- }
- }
-
- static postInit() {
- this.flags = [];
- for (const cmd of categories.get("music")) {
- if (cmd === "music") continue;
- const cmdInfo = info.get(cmd);
- this.flags.push({
- name: cmd,
- type: 1,
- description: cmdInfo.description,
- options: cmdInfo.flags
- });
- }
- return this;
- }
-
- static description = "Handles music playback";
- static aliases = ["m"];
- static directAllowed = false;
-}
-
-export default MusicAIOCommand;
+import Command from "../../classes/command.js";
+import { commands, aliases, info, categories } from "../../utils/collections.js";
+
+// all-in-one music command
+class MusicAIOCommand extends Command {
+ async run() {
+ let cmd = this.type === "classic" ? this.args[0] : this.optionsArray[0].name;
+ if (cmd === "music" || this.constructor.aliases.includes(cmd)) return "https://esmbot.net/robotdance.gif";
+ await this.acknowledge();
+ if (this.type === "classic") {
+ this.origOptions.args.shift();
+ } else {
+ this.origOptions.interaction.data.options.raw = this.origOptions.interaction.data.options.raw[0].options;
+ }
+ if (aliases.has(cmd)) cmd = aliases.get(cmd);
+ if (commands.has(cmd) && info.get(cmd).category === "music") {
+ const command = commands.get(cmd);
+ const inst = new command(this.client, this.origOptions);
+ const result = await inst.run();
+ this.success = inst.success;
+ return result;
+ } else {
+ this.success = false;
+ return "That isn't a valid music command!";
+ }
+ }
+
+ static postInit() {
+ this.flags = [];
+ for (const cmd of categories.get("music")) {
+ if (cmd === "music") continue;
+ const cmdInfo = info.get(cmd);
+ this.flags.push({
+ name: cmd,
+ type: 1,
+ description: cmdInfo.description,
+ options: cmdInfo.flags
+ });
+ }
+ return this;
+ }
+
+ static description = "Handles music playback";
+ static aliases = ["m"];
+ static directAllowed = false;
+}
+
+export default MusicAIOCommand;
diff --git a/commands/music/nowplaying.js b/commands/music/nowplaying.js
index e93a768..f453048 100644
--- a/commands/music/nowplaying.js
+++ b/commands/music/nowplaying.js
@@ -1,51 +1,51 @@
-import format from "format-duration";
-import MusicCommand from "../../classes/musicCommand.js";
-
-class NowPlayingCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.connection) return "I haven't completely connected yet!";
- const player = this.connection.player;
- if (!player) return "I'm not playing anything!";
- const track = await player.node.rest.decode(player.track);
- const parts = Math.floor((player.position / track.length) * 10);
- this.success = true;
- return {
- embeds: [{
- color: 16711680,
- author: {
- name: "Now Playing",
- iconURL: this.client.user.avatarURL()
- },
- fields: [{
- name: "âšī¸ Title",
- value: track.title ? track.title : "Unknown"
- },
- {
- name: "đ¤ Artist",
- value: track.author ? track.author : "Unknown"
- },
- {
- name: "đŦ Channel",
- value: (this.guild.channels.get(this.member.voiceState.channelID) ?? await this.client.rest.channels.get(this.member.voiceState.channelID)).name
- },
- {
- name: "đ Node",
- value: player.node ? player.node.name : "Unknown"
- },
- {
- name: `${"âŦ".repeat(parts)}đ${"âŦ".repeat(10 - parts)}`,
- value: `${format(player.position)}/${track.isStream ? "â" : format(track.length)}`
- }]
- }]
- };
- }
-
- static description = "Shows the currently playing song";
- static aliases = ["playing", "np", "current"];
-}
-
-export default NowPlayingCommand;
+import format from "format-duration";
+import MusicCommand from "../../classes/musicCommand.js";
+
+class NowPlayingCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.connection) return "I haven't completely connected yet!";
+ const player = this.connection.player;
+ if (!player) return "I'm not playing anything!";
+ const track = await player.node.rest.decode(player.track);
+ const parts = Math.floor((player.position / track.length) * 10);
+ this.success = true;
+ return {
+ embeds: [{
+ color: 16711680,
+ author: {
+ name: "Now Playing",
+ iconURL: this.client.user.avatarURL()
+ },
+ fields: [{
+ name: "âšī¸ Title",
+ value: track.title ? track.title : "Unknown"
+ },
+ {
+ name: "đ¤ Artist",
+ value: track.author ? track.author : "Unknown"
+ },
+ {
+ name: "đŦ Channel",
+ value: (this.guild.channels.get(this.member.voiceState.channelID) ?? await this.client.rest.channels.get(this.member.voiceState.channelID)).name
+ },
+ {
+ name: "đ Node",
+ value: player.node ? player.node.name : "Unknown"
+ },
+ {
+ name: `${"âŦ".repeat(parts)}đ${"âŦ".repeat(10 - parts)}`,
+ value: `${format(player.position)}/${track.isStream ? "â" : format(track.length)}`
+ }]
+ }]
+ };
+ }
+
+ static description = "Shows the currently playing song";
+ static aliases = ["playing", "np", "current"];
+}
+
+export default NowPlayingCommand;
diff --git a/commands/music/play.js b/commands/music/play.js
index e48eeb7..ac950a9 100644
--- a/commands/music/play.js
+++ b/commands/music/play.js
@@ -1,41 +1,41 @@
-import { play } from "../../utils/soundplayer.js";
-import MusicCommand from "../../classes/musicCommand.js";
-const prefixes = ["scsearch:", "spsearch:", "sprec:", "amsearch:", "dzsearch:", "dzisrc:"];
-if (process.env.YT_DISABLED !== "true") prefixes.push("ytsearch:", "ytmsearch:");
-
-class PlayCommand extends MusicCommand {
- async run() {
- const input = this.options.query ?? this.args.join(" ");
- if (!input && ((!this.message || this.message?.attachments.size <= 0))) {
- this.success = false;
- return "You need to provide what you want to play!";
- }
- let query = input ? input.trim() : "";
- const attachment = this.type === "classic" ? this.message.attachments.first() : null;
- if (query.startsWith("||") && query.endsWith("||")) {
- query = query.substring(2, query.length - 2);
- }
- if (query.startsWith("<") && query.endsWith(">")) {
- query = query.substring(1, query.length - 1);
- }
- try {
- const url = new URL(query);
- return play(this.client, url, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction }, true);
- } catch {
- const search = prefixes.some(v => query.startsWith(v)) ? query : !query && attachment ? attachment.url : (process.env.YT_DISABLED !== "true" ? `ytsearch:${query}` : `dzsearch:${query}`);
- return play(this.client, search, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction }, true);
- }
- }
-
- static flags = [{
- name: "query",
- type: 3,
- description: "An audio search query or URL",
- required: true
- }];
- static description = "Plays a song or adds it to the queue";
- static aliases = ["p"];
- static arguments = ["[url]"];
-}
-
-export default PlayCommand;
+import { play } from "../../utils/soundplayer.js";
+import MusicCommand from "../../classes/musicCommand.js";
+const prefixes = ["scsearch:", "spsearch:", "sprec:", "amsearch:", "dzsearch:", "dzisrc:"];
+if (process.env.YT_DISABLED !== "true") prefixes.push("ytsearch:", "ytmsearch:");
+
+class PlayCommand extends MusicCommand {
+ async run() {
+ const input = this.options.query ?? this.args.join(" ");
+ if (!input && ((!this.message || this.message?.attachments.size <= 0))) {
+ this.success = false;
+ return "You need to provide what you want to play!";
+ }
+ let query = input ? input.trim() : "";
+ const attachment = this.type === "classic" ? this.message.attachments.first() : null;
+ if (query.startsWith("||") && query.endsWith("||")) {
+ query = query.substring(2, query.length - 2);
+ }
+ if (query.startsWith("<") && query.endsWith(">")) {
+ query = query.substring(1, query.length - 1);
+ }
+ try {
+ const url = new URL(query);
+ return play(this.client, url, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction }, true);
+ } catch {
+ const search = prefixes.some(v => query.startsWith(v)) ? query : !query && attachment ? attachment.url : (process.env.YT_DISABLED !== "true" ? `ytsearch:${query}` : `dzsearch:${query}`);
+ return play(this.client, search, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction }, true);
+ }
+ }
+
+ static flags = [{
+ name: "query",
+ type: 3,
+ description: "An audio search query or URL",
+ required: true
+ }];
+ static description = "Plays a song or adds it to the queue";
+ static aliases = ["p"];
+ static arguments = ["[url]"];
+}
+
+export default PlayCommand;
diff --git a/commands/music/queue.js b/commands/music/queue.js
index 321aefc..e42de7f 100644
--- a/commands/music/queue.js
+++ b/commands/music/queue.js
@@ -1,65 +1,65 @@
-import { request } from "undici";
-import format from "format-duration";
-import { nodes } from "../../utils/soundplayer.js";
-import paginator from "../../utils/pagination/pagination.js";
-import MusicCommand from "../../classes/musicCommand.js";
-
-class QueueCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
- const player = this.connection;
- if (!player) return "I haven't completely connected yet!";
- const node = nodes.filter((val) => val.name === player.player.node.name)[0];
- const tracks = await request(`http://${node.url}/decodetracks`, { method: "POST", body: JSON.stringify(this.queue), headers: { authorization: node.auth, "content-type": "application/json" } }).then(res => res.body.json());
- const trackList = [];
- const firstTrack = tracks.shift();
- for (const [i, track] of tracks.entries()) {
- trackList.push(`${i + 1}. ${track.info.author !== "" ? track.info.author : "(blank)"} - **${track.info.title !== "" ? track.info.title : "(blank)"}** (${track.info.isStream ? "â" : format(track.info.length)})`);
- }
- const pageSize = 5;
- const embeds = [];
- const groups = trackList.map((item, index) => {
- return index % pageSize === 0 ? trackList.slice(index, index + pageSize) : null;
- }).filter(Boolean);
- if (groups.length === 0) groups.push("del");
- for (const [i, value] of groups.entries()) {
- embeds.push({
- embeds: [{
- author: {
- name: "Queue",
- iconURL: this.client.user.avatarURL()
- },
- color: 16711680,
- footer: {
- text: `Page ${i + 1} of ${groups.length}`
- },
- fields: [{
- name: "đļ Now Playing",
- value: `${firstTrack.info.author !== "" ? firstTrack.info.author : "(blank)"} - **${firstTrack.info.title !== "" ? firstTrack.info.title : "(blank)"}** (${firstTrack.info.isStream ? "â" : format(firstTrack.info.length)})`
- }, {
- name: "đ Looping?",
- value: player.loop ? "Yes" : "No"
- }, {
- name: "đ Node",
- value: player.player.node ? player.player.node.name : "Unknown"
- }, {
- name: "đī¸ Queue",
- value: value !== "del" ? value.join("\n") : "There's nothing in the queue!"
- }]
- }]
- });
- }
- if (embeds.length === 0) return "There's nothing in the queue!";
- this.success = true;
- return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
- }
-
- static description = "Shows the current queue";
- static aliases = ["q"];
-}
-
+import { request } from "undici";
+import format from "format-duration";
+import { nodes } from "../../utils/soundplayer.js";
+import paginator from "../../utils/pagination/pagination.js";
+import MusicCommand from "../../classes/musicCommand.js";
+
+class QueueCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
+ const player = this.connection;
+ if (!player) return "I haven't completely connected yet!";
+ const node = nodes.filter((val) => val.name === player.player.node.name)[0];
+ const tracks = await request(`http://${node.url}/decodetracks`, { method: "POST", body: JSON.stringify(this.queue), headers: { authorization: node.auth, "content-type": "application/json" } }).then(res => res.body.json());
+ const trackList = [];
+ const firstTrack = tracks.shift();
+ for (const [i, track] of tracks.entries()) {
+ trackList.push(`${i + 1}. ${track.info.author !== "" ? track.info.author : "(blank)"} - **${track.info.title !== "" ? track.info.title : "(blank)"}** (${track.info.isStream ? "â" : format(track.info.length)})`);
+ }
+ const pageSize = 5;
+ const embeds = [];
+ const groups = trackList.map((item, index) => {
+ return index % pageSize === 0 ? trackList.slice(index, index + pageSize) : null;
+ }).filter(Boolean);
+ if (groups.length === 0) groups.push("del");
+ for (const [i, value] of groups.entries()) {
+ embeds.push({
+ embeds: [{
+ author: {
+ name: "Queue",
+ iconURL: this.client.user.avatarURL()
+ },
+ color: 16711680,
+ footer: {
+ text: `Page ${i + 1} of ${groups.length}`
+ },
+ fields: [{
+ name: "đļ Now Playing",
+ value: `${firstTrack.info.author !== "" ? firstTrack.info.author : "(blank)"} - **${firstTrack.info.title !== "" ? firstTrack.info.title : "(blank)"}** (${firstTrack.info.isStream ? "â" : format(firstTrack.info.length)})`
+ }, {
+ name: "đ Looping?",
+ value: player.loop ? "Yes" : "No"
+ }, {
+ name: "đ Node",
+ value: player.player.node ? player.player.node.name : "Unknown"
+ }, {
+ name: "đī¸ Queue",
+ value: value !== "del" ? value.join("\n") : "There's nothing in the queue!"
+ }]
+ }]
+ });
+ }
+ if (embeds.length === 0) return "There's nothing in the queue!";
+ this.success = true;
+ return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
+ }
+
+ static description = "Shows the current queue";
+ static aliases = ["q"];
+}
+
export default QueueCommand;
\ No newline at end of file
diff --git a/commands/music/remove.js b/commands/music/remove.js
index 1140651..c381b21 100644
--- a/commands/music/remove.js
+++ b/commands/music/remove.js
@@ -1,33 +1,33 @@
-import { queues } from "../../utils/soundplayer.js";
-import MusicCommand from "../../classes/musicCommand.js";
-
-class RemoveCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.connection) return "I haven't completely connected yet!";
- if (this.connection.host !== this.author.id && !process.env.OWNER.split(",").includes(this.connection.host)) return "Only the current voice session host can remove songs from the queue!";
- const pos = parseInt(this.options.position ?? this.args[0]);
- if (isNaN(pos) || pos > this.queue.length || pos < 1) return "That's not a valid position!";
- const removed = this.queue.splice(pos, 1);
- if (removed.length === 0) return "That's not a valid position!";
- const track = await this.connection.player.node.rest.decode(removed[0]);
- queues.set(this.guildID, this.queue);
- this.success = true;
- return `đ The song \`${track.title ? track.title : "(blank)"}\` has been removed from the queue.`;
- }
-
- static flags = [{
- name: "position",
- type: 4,
- description: "The queue position you want to remove",
- min_value: 1,
- required: true
- }];
- static description = "Removes a song from the queue";
- static aliases = ["rm"];
-}
-
-export default RemoveCommand;
+import { queues } from "../../utils/soundplayer.js";
+import MusicCommand from "../../classes/musicCommand.js";
+
+class RemoveCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.connection) return "I haven't completely connected yet!";
+ if (this.connection.host !== this.author.id && !process.env.OWNER.split(",").includes(this.connection.host)) return "Only the current voice session host can remove songs from the queue!";
+ const pos = parseInt(this.options.position ?? this.args[0]);
+ if (isNaN(pos) || pos > this.queue.length || pos < 1) return "That's not a valid position!";
+ const removed = this.queue.splice(pos, 1);
+ if (removed.length === 0) return "That's not a valid position!";
+ const track = await this.connection.player.node.rest.decode(removed[0]);
+ queues.set(this.guildID, this.queue);
+ this.success = true;
+ return `đ The song \`${track.title ? track.title : "(blank)"}\` has been removed from the queue.`;
+ }
+
+ static flags = [{
+ name: "position",
+ type: 4,
+ description: "The queue position you want to remove",
+ min_value: 1,
+ required: true
+ }];
+ static description = "Removes a song from the queue";
+ static aliases = ["rm"];
+}
+
+export default RemoveCommand;
diff --git a/commands/music/seek.js b/commands/music/seek.js
index 89b64e4..6972e98 100644
--- a/commands/music/seek.js
+++ b/commands/music/seek.js
@@ -1,38 +1,38 @@
-import MusicCommand from "../../classes/musicCommand.js";
-
-class SeekCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.connection) return "I haven't completely connected yet!";
- if (this.connection.host !== this.author.id) return "Only the current voice session host can seek the music!";
- const player = this.connection.player;
- const track = await player.node.rest.decode(player.track);
- if (!track.isSeekable) return "This track isn't seekable!";
- const pos = this.options.position ?? this.args[0];
- let seconds;
- if (typeof pos === "string" && pos.includes(":")) {
- seconds = +(pos.split(":").reduce((acc, time) => (60 * acc) + +time));
- } else {
- seconds = parseFloat(pos);
- }
- if (isNaN(seconds) || (seconds * 1000) > track.length || (seconds * 1000) < 0) return "That's not a valid position!";
- player.seekTo(seconds * 1000);
- this.success = true;
- return `đ Seeked track to ${seconds} second(s).`;
- }
-
- static flags = [{
- name: "position",
- type: 3,
- description: "Seek to this position",
- required: true
- }];
- static description = "Seeks to a different position in the music";
- static aliases = ["pos"];
- static arguments = ["[seconds]"];
-}
-
-export default SeekCommand;
+import MusicCommand from "../../classes/musicCommand.js";
+
+class SeekCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.connection) return "I haven't completely connected yet!";
+ if (this.connection.host !== this.author.id) return "Only the current voice session host can seek the music!";
+ const player = this.connection.player;
+ const track = await player.node.rest.decode(player.track);
+ if (!track.isSeekable) return "This track isn't seekable!";
+ const pos = this.options.position ?? this.args[0];
+ let seconds;
+ if (typeof pos === "string" && pos.includes(":")) {
+ seconds = +(pos.split(":").reduce((acc, time) => (60 * acc) + +time));
+ } else {
+ seconds = parseFloat(pos);
+ }
+ if (isNaN(seconds) || (seconds * 1000) > track.length || (seconds * 1000) < 0) return "That's not a valid position!";
+ player.seekTo(seconds * 1000);
+ this.success = true;
+ return `đ Seeked track to ${seconds} second(s).`;
+ }
+
+ static flags = [{
+ name: "position",
+ type: 3,
+ description: "Seek to this position",
+ required: true
+ }];
+ static description = "Seeks to a different position in the music";
+ static aliases = ["pos"];
+ static arguments = ["[seconds]"];
+}
+
+export default SeekCommand;
diff --git a/commands/music/shuffle.js b/commands/music/shuffle.js
index 661c54b..bc02a0a 100644
--- a/commands/music/shuffle.js
+++ b/commands/music/shuffle.js
@@ -1,23 +1,23 @@
-import { players } from "../../utils/soundplayer.js";
-import MusicCommand from "../../classes/musicCommand.js";
-
-class ShuffleCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.connection) return "I haven't completely connected yet!";
- if (this.connection.host !== this.author.id) return "Only the current voice session host can shuffle the music!";
- const object = this.connection;
- object.shuffle = !object.shuffle;
- players.set(this.guildID, object);
- this.success = true;
- return object.shuffle ? "đ The player is now shuffling." : "đ The player is no longer shuffling.";
- }
-
- static description = "Shuffles the music";
- static aliases = ["toggleshuffle"];
-}
-
+import { players } from "../../utils/soundplayer.js";
+import MusicCommand from "../../classes/musicCommand.js";
+
+class ShuffleCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.connection) return "I haven't completely connected yet!";
+ if (this.connection.host !== this.author.id) return "Only the current voice session host can shuffle the music!";
+ const object = this.connection;
+ object.shuffle = !object.shuffle;
+ players.set(this.guildID, object);
+ this.success = true;
+ return object.shuffle ? "đ The player is now shuffling." : "đ The player is no longer shuffling.";
+ }
+
+ static description = "Shuffles the music";
+ static aliases = ["toggleshuffle"];
+}
+
export default ShuffleCommand;
\ No newline at end of file
diff --git a/commands/music/skip.js b/commands/music/skip.js
index a5e8be0..00ee076 100644
--- a/commands/music/skip.js
+++ b/commands/music/skip.js
@@ -1,41 +1,41 @@
-import { skipVotes } from "../../utils/soundplayer.js";
-import MusicCommand from "../../classes/musicCommand.js";
-
-class SkipCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- const player = this.connection;
- if (!player) return "I haven't completely connected yet!";
- if (player.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) {
- const votes = skipVotes.get(this.guild.id) ?? { count: 0, ids: [], max: Math.min(3, player.voiceChannel.voiceMembers.filter((i) => i.id !== this.client.user.id && !i.bot).length) };
- if (votes.ids.includes(this.author.id)) return "You've already voted to skip!";
- const newObject = {
- count: votes.count + 1,
- ids: [...votes.ids, this.author.id].filter(item => !!item),
- max: votes.max
- };
- if (votes.count + 1 === votes.max) {
- await player.player.stopTrack(this.guild.id);
- skipVotes.set(this.guild.id, { count: 0, ids: [], max: Math.min(3, player.voiceChannel.voiceMembers.filter((i) => i.id !== this.client.user.id && !i.bot).length) });
- this.success = true;
- if (this.type === "application") return "đ The current song has been skipped.";
- } else {
- skipVotes.set(this.guild.id, newObject);
- this.success = true;
- return `đ Voted to skip song (${votes.count + 1}/${votes.max} people have voted).`;
- }
- } else {
- await player.player.stopTrack();
- this.success = true;
- if (this.type === "application") return "đ The current song has been skipped.";
- }
- }
-
- static description = "Skips the current song";
- static aliases = ["forceskip", "s"];
-}
-
-export default SkipCommand;
+import { skipVotes } from "../../utils/soundplayer.js";
+import MusicCommand from "../../classes/musicCommand.js";
+
+class SkipCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ const player = this.connection;
+ if (!player) return "I haven't completely connected yet!";
+ if (player.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) {
+ const votes = skipVotes.get(this.guild.id) ?? { count: 0, ids: [], max: Math.min(3, player.voiceChannel.voiceMembers.filter((i) => i.id !== this.client.user.id && !i.bot).length) };
+ if (votes.ids.includes(this.author.id)) return "You've already voted to skip!";
+ const newObject = {
+ count: votes.count + 1,
+ ids: [...votes.ids, this.author.id].filter(item => !!item),
+ max: votes.max
+ };
+ if (votes.count + 1 === votes.max) {
+ await player.player.stopTrack(this.guild.id);
+ skipVotes.set(this.guild.id, { count: 0, ids: [], max: Math.min(3, player.voiceChannel.voiceMembers.filter((i) => i.id !== this.client.user.id && !i.bot).length) });
+ this.success = true;
+ if (this.type === "application") return "đ The current song has been skipped.";
+ } else {
+ skipVotes.set(this.guild.id, newObject);
+ this.success = true;
+ return `đ Voted to skip song (${votes.count + 1}/${votes.max} people have voted).`;
+ }
+ } else {
+ await player.player.stopTrack();
+ this.success = true;
+ if (this.type === "application") return "đ The current song has been skipped.";
+ }
+ }
+
+ static description = "Skips the current song";
+ static aliases = ["forceskip", "s"];
+}
+
+export default SkipCommand;
diff --git a/commands/music/stop.js b/commands/music/stop.js
index 98e5f81..125dcd4 100644
--- a/commands/music/stop.js
+++ b/commands/music/stop.js
@@ -1,28 +1,28 @@
-import { manager, players, queues } from "../../utils/soundplayer.js";
-import MusicCommand from "../../classes/musicCommand.js";
-
-class StopCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.connection) {
- await manager.getNode().leaveChannel(this.guild.id);
- this.success = true;
- return "đ The current voice channel session has ended.";
- }
- if (this.connection.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) return "Only the current voice session host can stop the music!";
- const connection = this.connection.player;
- connection.node.leaveChannel(this.guild.id);
- players.delete(this.guild.id);
- queues.delete(this.guild.id);
- this.success = true;
- return `đ The voice channel session in \`${this.connection.voiceChannel.name}\` has ended.`;
- }
-
- static description = "Stops the music";
- static aliases = ["disconnect"];
-}
-
-export default StopCommand;
+import { manager, players, queues } from "../../utils/soundplayer.js";
+import MusicCommand from "../../classes/musicCommand.js";
+
+class StopCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.connection) {
+ await manager.getNode().leaveChannel(this.guild.id);
+ this.success = true;
+ return "đ The current voice channel session has ended.";
+ }
+ if (this.connection.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) return "Only the current voice session host can stop the music!";
+ const connection = this.connection.player;
+ connection.node.leaveChannel(this.guild.id);
+ players.delete(this.guild.id);
+ queues.delete(this.guild.id);
+ this.success = true;
+ return `đ The voice channel session in \`${this.connection.voiceChannel.name}\` has ended.`;
+ }
+
+ static description = "Stops the music";
+ static aliases = ["disconnect"];
+}
+
+export default StopCommand;
diff --git a/commands/music/toggle.js b/commands/music/toggle.js
index 2949f8e..fd633f3 100644
--- a/commands/music/toggle.js
+++ b/commands/music/toggle.js
@@ -1,21 +1,21 @@
-import MusicCommand from "../../classes/musicCommand.js";
-
-class ToggleCommand extends MusicCommand {
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- if (!this.member.voiceState) return "You need to be in a voice channel first!";
- if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
- if (!this.connection) return "I haven't completely connected yet!";
- if (this.connection.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) return "Only the current voice session host can pause/resume the music!";
- const player = this.connection.player;
- player.setPaused(!player.paused ? true : false);
- this.success = true;
- return `đ The player has been ${player.paused ? "paused" : "resumed"}.`;
- }
-
- static description = "Pauses/resumes the current song";
- static aliases = ["pause", "resume"];
-}
-
-export default ToggleCommand;
+import MusicCommand from "../../classes/musicCommand.js";
+
+class ToggleCommand extends MusicCommand {
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ if (!this.member.voiceState) return "You need to be in a voice channel first!";
+ if (!this.guild.voiceStates.has(this.client.user.id)) return "I'm not in a voice channel!";
+ if (!this.connection) return "I haven't completely connected yet!";
+ if (this.connection.host !== this.author.id && !this.member.permissions.has("MANAGE_CHANNELS")) return "Only the current voice session host can pause/resume the music!";
+ const player = this.connection.player;
+ player.setPaused(!player.paused ? true : false);
+ this.success = true;
+ return `đ The player has been ${player.paused ? "paused" : "resumed"}.`;
+ }
+
+ static description = "Pauses/resumes the current song";
+ static aliases = ["pause", "resume"];
+}
+
+export default ToggleCommand;
diff --git a/commands/soundboard/boi.js b/commands/soundboard/boi.js
index 4ba0f90..7318b76 100644
--- a/commands/soundboard/boi.js
+++ b/commands/soundboard/boi.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class BoiCommand extends SoundboardCommand {
- static file = "./assets/audio/boi.ogg";
- static description = "Plays the \"boi\" sound effect";
- static aliases = ["boy", "neutron", "hugh"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class BoiCommand extends SoundboardCommand {
+ static file = "./assets/audio/boi.ogg";
+ static description = "Plays the \"boi\" sound effect";
+ static aliases = ["boy", "neutron", "hugh"];
+}
+
export default BoiCommand;
\ No newline at end of file
diff --git a/commands/soundboard/boom.js b/commands/soundboard/boom.js
index 76273dc..6c08421 100644
--- a/commands/soundboard/boom.js
+++ b/commands/soundboard/boom.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class BoomCommand extends SoundboardCommand {
- static file = "./assets/audio/boom.ogg";
- static description = "Plays the Vine boom sound effect";
- static aliases = ["thud", "vine"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class BoomCommand extends SoundboardCommand {
+ static file = "./assets/audio/boom.ogg";
+ static description = "Plays the Vine boom sound effect";
+ static aliases = ["thud", "vine"];
+}
+
export default BoomCommand;
\ No newline at end of file
diff --git a/commands/soundboard/bruh.js b/commands/soundboard/bruh.js
index 06e019b..65de7e7 100644
--- a/commands/soundboard/bruh.js
+++ b/commands/soundboard/bruh.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class BruhCommand extends SoundboardCommand {
- static file = "./assets/audio/bruh.ogg";
- static description = "Plays the \"bruh\" sound effect";
- static aliases = ["bro"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class BruhCommand extends SoundboardCommand {
+ static file = "./assets/audio/bruh.ogg";
+ static description = "Plays the \"bruh\" sound effect";
+ static aliases = ["bro"];
+}
+
export default BruhCommand;
\ No newline at end of file
diff --git a/commands/soundboard/damndaniel.js b/commands/soundboard/damndaniel.js
index 049b0e7..8fcd151 100644
--- a/commands/soundboard/damndaniel.js
+++ b/commands/soundboard/damndaniel.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class DamnDanielCommand extends SoundboardCommand {
- static file = "./assets/audio/damndaniel.ogg";
- static description = "Plays the \"damn daniel\" sound effect";
- static aliases = ["daniel", "damn"];
-}
-
-export default DamnDanielCommand;
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class DamnDanielCommand extends SoundboardCommand {
+ static file = "./assets/audio/damndaniel.ogg";
+ static description = "Plays the \"damn daniel\" sound effect";
+ static aliases = ["daniel", "damn"];
+}
+
+export default DamnDanielCommand;
diff --git a/commands/soundboard/explosion.js b/commands/soundboard/explosion.js
index e9dd261..f2790f1 100644
--- a/commands/soundboard/explosion.js
+++ b/commands/soundboard/explosion.js
@@ -1,8 +1,8 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class ExplosionCommand extends SoundboardCommand {
- static file = "./assets/audio/explosion.ogg";
- static description = "Plays an explosion sound effect";
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class ExplosionCommand extends SoundboardCommand {
+ static file = "./assets/audio/explosion.ogg";
+ static description = "Plays an explosion sound effect";
+}
+
export default ExplosionCommand;
\ No newline at end of file
diff --git a/commands/soundboard/fakeping.js b/commands/soundboard/fakeping.js
index 669e612..73d9907 100644
--- a/commands/soundboard/fakeping.js
+++ b/commands/soundboard/fakeping.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class FakePingCommand extends SoundboardCommand {
- static file = "./assets/audio/ping.ogg";
- static description = "Plays a Discord ping sound effect";
- static aliases = ["notification", "notif"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class FakePingCommand extends SoundboardCommand {
+ static file = "./assets/audio/ping.ogg";
+ static description = "Plays a Discord ping sound effect";
+ static aliases = ["notification", "notif"];
+}
+
export default FakePingCommand;
\ No newline at end of file
diff --git a/commands/soundboard/fart.js b/commands/soundboard/fart.js
index 8f75a91..551ab7a 100644
--- a/commands/soundboard/fart.js
+++ b/commands/soundboard/fart.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class FartCommand extends SoundboardCommand {
- static file = "./assets/audio/fart.ogg";
- static description = "Plays a fart sound effect";
- static aliases = ["toot"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class FartCommand extends SoundboardCommand {
+ static file = "./assets/audio/fart.ogg";
+ static description = "Plays a fart sound effect";
+ static aliases = ["toot"];
+}
+
export default FartCommand;
\ No newline at end of file
diff --git a/commands/soundboard/fartreverb.js b/commands/soundboard/fartreverb.js
index 2c470f0..75fe1d2 100644
--- a/commands/soundboard/fartreverb.js
+++ b/commands/soundboard/fartreverb.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class FartReverbCommand extends SoundboardCommand {
- static file = "./assets/audio/fart2.ogg";
- static description = "Plays a fart sound effect with extra reverb";
- static aliases = ["fart2"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class FartReverbCommand extends SoundboardCommand {
+ static file = "./assets/audio/fart2.ogg";
+ static description = "Plays a fart sound effect with extra reverb";
+ static aliases = ["fart2"];
+}
+
export default FartReverbCommand;
\ No newline at end of file
diff --git a/commands/soundboard/fbi.js b/commands/soundboard/fbi.js
index eb1a7f4..430c1ae 100644
--- a/commands/soundboard/fbi.js
+++ b/commands/soundboard/fbi.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class FBICommand extends SoundboardCommand {
- static file = "./assets/audio/fbi.ogg";
- static description = "Plays the \"FBI OPEN UP\" sound effect";
- static aliases = ["openup"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class FBICommand extends SoundboardCommand {
+ static file = "./assets/audio/fbi.ogg";
+ static description = "Plays the \"FBI OPEN UP\" sound effect";
+ static aliases = ["openup"];
+}
+
export default FBICommand;
\ No newline at end of file
diff --git a/commands/soundboard/mail.js b/commands/soundboard/mail.js
index f0ae1e4..2b2a253 100644
--- a/commands/soundboard/mail.js
+++ b/commands/soundboard/mail.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class MailCommand extends SoundboardCommand {
- static file = "./assets/audio/mail.ogg";
- static description = "Plays the \"You've got mail\" sound effect";
- static aliases = ["yougotmail", "youvegotmail", "aol"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class MailCommand extends SoundboardCommand {
+ static file = "./assets/audio/mail.ogg";
+ static description = "Plays the \"You've got mail\" sound effect";
+ static aliases = ["yougotmail", "youvegotmail", "aol"];
+}
+
export default MailCommand;
\ No newline at end of file
diff --git a/commands/soundboard/oof.js b/commands/soundboard/oof.js
index f4e5b89..4d07a88 100644
--- a/commands/soundboard/oof.js
+++ b/commands/soundboard/oof.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class OofCommand extends SoundboardCommand {
- static file = "./assets/audio/oof.ogg";
- static description = "Plays the Roblox \"oof\" sound";
- static aliases = ["roblox", "commitdie"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class OofCommand extends SoundboardCommand {
+ static file = "./assets/audio/oof.ogg";
+ static description = "Plays the Roblox \"oof\" sound";
+ static aliases = ["roblox", "commitdie"];
+}
+
export default OofCommand;
\ No newline at end of file
diff --git a/commands/soundboard/soundboard.js b/commands/soundboard/soundboard.js
index b7c6b6e..9358905 100644
--- a/commands/soundboard/soundboard.js
+++ b/commands/soundboard/soundboard.js
@@ -1,35 +1,35 @@
-import { play } from "../../utils/soundplayer.js";
-import Command from "../../classes/command.js";
-import { sounds, info } from "../../utils/collections.js";
-
-// all-in-one soundboard command
-class SoundboardAIOCommand extends Command {
- async run() {
- const soundName = this.type === "classic" ? this.args[0] : this.optionsArray[0].name;
- if (!sounds.has(soundName)) {
- this.success = false;
- return "You need to provide a sound to play!";
- }
- const name = sounds.get(soundName);
- await this.acknowledge();
- return await play(this.client, name, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction });
- }
-
- static postInit() {
- this.flags = [];
- for (const sound of sounds.keys()) {
- this.flags.push({
- name: sound,
- type: 1,
- description: info.get(sound).description
- });
- }
- return this;
- }
-
- static description = "Plays a sound effect";
- static aliases = ["sound", "sb"];
- static directAllowed = false;
-}
-
+import { play } from "../../utils/soundplayer.js";
+import Command from "../../classes/command.js";
+import { sounds, info } from "../../utils/collections.js";
+
+// all-in-one soundboard command
+class SoundboardAIOCommand extends Command {
+ async run() {
+ const soundName = this.type === "classic" ? this.args[0] : this.optionsArray[0].name;
+ if (!sounds.has(soundName)) {
+ this.success = false;
+ return "You need to provide a sound to play!";
+ }
+ const name = sounds.get(soundName);
+ await this.acknowledge();
+ return await play(this.client, name, { channel: this.channel, member: this.member, type: this.type, interaction: this.interaction });
+ }
+
+ static postInit() {
+ this.flags = [];
+ for (const sound of sounds.keys()) {
+ this.flags.push({
+ name: sound,
+ type: 1,
+ description: info.get(sound).description
+ });
+ }
+ return this;
+ }
+
+ static description = "Plays a sound effect";
+ static aliases = ["sound", "sb"];
+ static directAllowed = false;
+}
+
export default SoundboardAIOCommand;
\ No newline at end of file
diff --git a/commands/soundboard/winxp.js b/commands/soundboard/winxp.js
index 56f4a81..4ed9b3d 100644
--- a/commands/soundboard/winxp.js
+++ b/commands/soundboard/winxp.js
@@ -1,9 +1,9 @@
-import SoundboardCommand from "../../classes/soundboardCommand.js";
-
-class WinXPCommand extends SoundboardCommand {
- static file = "./assets/audio/winxp.ogg";
- static description = "Plays the Windows XP startup sound";
- static aliases = ["windows", "xp"];
-}
-
+import SoundboardCommand from "../../classes/soundboardCommand.js";
+
+class WinXPCommand extends SoundboardCommand {
+ static file = "./assets/audio/winxp.ogg";
+ static description = "Plays the Windows XP startup sound";
+ static aliases = ["windows", "xp"];
+}
+
export default WinXPCommand;
\ No newline at end of file
diff --git a/commands/tags/tags.js b/commands/tags/tags.js
index 6d62ca4..3d3f87e 100644
--- a/commands/tags/tags.js
+++ b/commands/tags/tags.js
@@ -1,169 +1,169 @@
-import database from "../../utils/database.js";
-import paginator from "../../utils/pagination/pagination.js";
-import { random } from "../../utils/misc.js";
-import Command from "../../classes/command.js";
-const blacklist = ["create", "add", "edit", "remove", "delete", "list", "random", "own", "owner"];
-
-class TagsCommand extends Command {
- // todo: attempt to not make this file the worst thing that human eyes have ever seen
- async run() {
- this.success = false;
- if (!this.guild) return "This command only works in servers!";
- const cmd = this.type === "classic" ? (this.args[0] ?? "").toLowerCase() : this.optionsArray[0].name;
- if (!cmd || !cmd.trim()) return "You need to provide the name of the tag you want to view!";
- const tagName = this.type === "classic" ? this.args.slice(1)[0] : (this.optionsArray[0].options[0] ?? {}).value;
-
- if (cmd === "create" || cmd === "add") {
- if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to add!";
- if (blacklist.includes(tagName)) return "You can't make a tag with that name!";
- const getResult = await database.getTag(this.guild.id, tagName);
- if (getResult) return "This tag already exists!";
- const result = await database.setTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.member.id }, this.guild);
- this.success = true;
- if (result) return result;
- return `The tag \`${tagName}\` has been added!`;
- } else if (cmd === "delete" || cmd === "remove") {
- if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to delete!";
- const getResult = await database.getTag(this.guild.id, tagName);
- if (!getResult) return "This tag doesn't exist!";
- const owners = process.env.OWNER.split(",");
- if (getResult.author !== this.author.id && !this.member.permissions.has("MANAGE_MESSAGES") && !owners.includes(this.author.id)) return "You don't own this tag!";
- await database.removeTag(tagName, this.guild);
- this.success = true;
- return `The tag \`${tagName}\` has been deleted!`;
- } else if (cmd === "edit") {
- if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to edit!";
- const getResult = await database.getTag(this.guild.id, tagName);
- if (!getResult) return "This tag doesn't exist!";
- const owners = process.env.OWNER.split(",");
- if (getResult.author !== this.author.id && !this.member.permissions.has("MANAGE_MESSAGES") && !owners.includes(this.author.id)) return "You don't own this tag!";
- await database.editTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.member.id }, this.guild);
- this.success = true;
- return `The tag \`${tagName}\` has been edited!`;
- } else if (cmd === "own" || cmd === "owner") {
- if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to check the owner of!";
- const getResult = await database.getTag(this.guild.id, tagName);
- if (!getResult) return "This tag doesn't exist!";
- const user = this.client.users.get(getResult.author);
- this.success = true;
- if (!user) {
- try {
- const restUser = await this.client.rest.users.get(getResult.author);
- return `This tag is owned by **${restUser.username}#${restUser.discriminator}** (\`${getResult.author}\`).`;
- } catch {
- return `I couldn't find exactly who owns this tag, but I was able to get their ID: \`${getResult.author}\``;
- }
- } else {
- return `This tag is owned by **${user.username}#${user.discriminator}** (\`${getResult.author}\`).`;
- }
- } else if (cmd === "list") {
- if (!this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
- const tagList = await database.getTags(this.guild.id);
- const embeds = [];
- const groups = Object.keys(tagList).map((item, index) => {
- return index % 15 === 0 ? Object.keys(tagList).slice(index, index + 15) : null;
- }).filter((item) => {
- return item;
- });
- for (const [i, value] of groups.entries()) {
- embeds.push({
- embeds: [{
- title: "Tag List",
- color: 16711680,
- footer: {
- text: `Page ${i + 1} of ${groups.length}`
- },
- description: value.join("\n"),
- author: {
- name: this.author.username,
- iconURL: this.author.avatarURL()
- }
- }]
- });
- }
- if (embeds.length === 0) return "I couldn't find any tags!";
- this.success = true;
- return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
- } else {
- let getResult;
- if (cmd === "random") {
- const tagList = await database.getTags(this.guild.id);
- getResult = tagList[random(Object.keys(tagList))];
- } else {
- getResult = await database.getTag(this.guild.id, this.type === "classic" ? cmd : tagName);
- }
- if (!getResult) return "This tag doesn't exist!";
- this.success = true;
- if (getResult.content.length > 2000) {
- return {
- embeds: [{
- color: 16711680,
- description: getResult.content
- }],
- };
- }
- return getResult.content;
- }
- }
-
- static description = "Manage tags";
- static aliases = ["t", "tag", "ta"];
- static arguments = {
- default: ["[name]"],
- add: ["[name]", "[content]"],
- delete: ["[name]"],
- edit: ["[name]", "[content]"],
- owner: ["[name]"]
- };
-
- static subArgs = [{
- name: "name",
- type: 3,
- description: "The name of the tag",
- required: true
- }, {
- name: "content",
- type: 3,
- description: "The content of the tag",
- required: true
- }];
-
- static flags = [{
- name: "add",
- type: 1,
- description: "Adds a new tag",
- options: this.subArgs
- }, {
- name: "delete",
- type: 1,
- description: "Deletes a tag",
- options: [this.subArgs[0]]
- }, {
- name: "edit",
- type: 1,
- description: "Edits an existing tag",
- options: this.subArgs
- }, {
- name: "get",
- type: 1,
- description: "Gets a tag",
- options: [this.subArgs[0]]
- }, {
- name: "list",
- type: 1,
- description: "Lists every tag in this server"
- }, {
- name: "owner",
- type: 1,
- description: "Gets the owner of a tag",
- options: [this.subArgs[0]]
- }, {
- name: "random",
- type: 1,
- description: "Gets a random tag"
- }];
- static directAllowed = false;
- static dbRequired = true;
-}
-
-export default TagsCommand;
+import database from "../../utils/database.js";
+import paginator from "../../utils/pagination/pagination.js";
+import { random } from "../../utils/misc.js";
+import Command from "../../classes/command.js";
+const blacklist = ["create", "add", "edit", "remove", "delete", "list", "random", "own", "owner"];
+
+class TagsCommand extends Command {
+ // todo: attempt to not make this file the worst thing that human eyes have ever seen
+ async run() {
+ this.success = false;
+ if (!this.guild) return "This command only works in servers!";
+ const cmd = this.type === "classic" ? (this.args[0] ?? "").toLowerCase() : this.optionsArray[0].name;
+ if (!cmd || !cmd.trim()) return "You need to provide the name of the tag you want to view!";
+ const tagName = this.type === "classic" ? this.args.slice(1)[0] : (this.optionsArray[0].options[0] ?? {}).value;
+
+ if (cmd === "create" || cmd === "add") {
+ if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to add!";
+ if (blacklist.includes(tagName)) return "You can't make a tag with that name!";
+ const getResult = await database.getTag(this.guild.id, tagName);
+ if (getResult) return "This tag already exists!";
+ const result = await database.setTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.member.id }, this.guild);
+ this.success = true;
+ if (result) return result;
+ return `The tag \`${tagName}\` has been added!`;
+ } else if (cmd === "delete" || cmd === "remove") {
+ if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to delete!";
+ const getResult = await database.getTag(this.guild.id, tagName);
+ if (!getResult) return "This tag doesn't exist!";
+ const owners = process.env.OWNER.split(",");
+ if (getResult.author !== this.author.id && !this.member.permissions.has("MANAGE_MESSAGES") && !owners.includes(this.author.id)) return "You don't own this tag!";
+ await database.removeTag(tagName, this.guild);
+ this.success = true;
+ return `The tag \`${tagName}\` has been deleted!`;
+ } else if (cmd === "edit") {
+ if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to edit!";
+ const getResult = await database.getTag(this.guild.id, tagName);
+ if (!getResult) return "This tag doesn't exist!";
+ const owners = process.env.OWNER.split(",");
+ if (getResult.author !== this.author.id && !this.member.permissions.has("MANAGE_MESSAGES") && !owners.includes(this.author.id)) return "You don't own this tag!";
+ await database.editTag(tagName, { content: this.type === "classic" ? this.args.slice(2).join(" ") : this.optionsArray[0].options[1].value, author: this.member.id }, this.guild);
+ this.success = true;
+ return `The tag \`${tagName}\` has been edited!`;
+ } else if (cmd === "own" || cmd === "owner") {
+ if (!tagName || !tagName.trim()) return "You need to provide the name of the tag you want to check the owner of!";
+ const getResult = await database.getTag(this.guild.id, tagName);
+ if (!getResult) return "This tag doesn't exist!";
+ const user = this.client.users.get(getResult.author);
+ this.success = true;
+ if (!user) {
+ try {
+ const restUser = await this.client.rest.users.get(getResult.author);
+ return `This tag is owned by **${restUser.username}#${restUser.discriminator}** (\`${getResult.author}\`).`;
+ } catch {
+ return `I couldn't find exactly who owns this tag, but I was able to get their ID: \`${getResult.author}\``;
+ }
+ } else {
+ return `This tag is owned by **${user.username}#${user.discriminator}** (\`${getResult.author}\`).`;
+ }
+ } else if (cmd === "list") {
+ if (!this.channel.permissionsOf(this.client.user.id.toString()).has("EMBED_LINKS")) return "I don't have the `Embed Links` permission!";
+ const tagList = await database.getTags(this.guild.id);
+ const embeds = [];
+ const groups = Object.keys(tagList).map((item, index) => {
+ return index % 15 === 0 ? Object.keys(tagList).slice(index, index + 15) : null;
+ }).filter((item) => {
+ return item;
+ });
+ for (const [i, value] of groups.entries()) {
+ embeds.push({
+ embeds: [{
+ title: "Tag List",
+ color: 16711680,
+ footer: {
+ text: `Page ${i + 1} of ${groups.length}`
+ },
+ description: value.join("\n"),
+ author: {
+ name: this.author.username,
+ iconURL: this.author.avatarURL()
+ }
+ }]
+ });
+ }
+ if (embeds.length === 0) return "I couldn't find any tags!";
+ this.success = true;
+ return paginator(this.client, { type: this.type, message: this.message, interaction: this.interaction, channel: this.channel, author: this.author }, embeds);
+ } else {
+ let getResult;
+ if (cmd === "random") {
+ const tagList = await database.getTags(this.guild.id);
+ getResult = tagList[random(Object.keys(tagList))];
+ } else {
+ getResult = await database.getTag(this.guild.id, this.type === "classic" ? cmd : tagName);
+ }
+ if (!getResult) return "This tag doesn't exist!";
+ this.success = true;
+ if (getResult.content.length > 2000) {
+ return {
+ embeds: [{
+ color: 16711680,
+ description: getResult.content
+ }],
+ };
+ }
+ return getResult.content;
+ }
+ }
+
+ static description = "Manage tags";
+ static aliases = ["t", "tag", "ta"];
+ static arguments = {
+ default: ["[name]"],
+ add: ["[name]", "[content]"],
+ delete: ["[name]"],
+ edit: ["[name]", "[content]"],
+ owner: ["[name]"]
+ };
+
+ static subArgs = [{
+ name: "name",
+ type: 3,
+ description: "The name of the tag",
+ required: true
+ }, {
+ name: "content",
+ type: 3,
+ description: "The content of the tag",
+ required: true
+ }];
+
+ static flags = [{
+ name: "add",
+ type: 1,
+ description: "Adds a new tag",
+ options: this.subArgs
+ }, {
+ name: "delete",
+ type: 1,
+ description: "Deletes a tag",
+ options: [this.subArgs[0]]
+ }, {
+ name: "edit",
+ type: 1,
+ description: "Edits an existing tag",
+ options: this.subArgs
+ }, {
+ name: "get",
+ type: 1,
+ description: "Gets a tag",
+ options: [this.subArgs[0]]
+ }, {
+ name: "list",
+ type: 1,
+ description: "Lists every tag in this server"
+ }, {
+ name: "owner",
+ type: 1,
+ description: "Gets the owner of a tag",
+ options: [this.subArgs[0]]
+ }, {
+ name: "random",
+ type: 1,
+ description: "Gets a random tag"
+ }];
+ static directAllowed = false;
+ static dbRequired = true;
+}
+
+export default TagsCommand;
diff --git a/config/commands.json b/config/commands.json
index 5294ada..c7bfe24 100644
--- a/config/commands.json
+++ b/config/commands.json
@@ -1,7 +1,7 @@
-{
- "types": {
- "classic": true,
- "application": true
- },
- "blacklist": []
+{
+ "types": {
+ "classic": true,
+ "application": false
+ },
+ "blacklist": []
}
\ No newline at end of file
diff --git a/config/messages.json b/config/messages.json
index 4c6f16f..4331d7b 100644
--- a/config/messages.json
+++ b/config/messages.json
@@ -1,202 +1,202 @@
-{
- "emotes": [
- "",
- "",
- "",
- "",
- "",
- ""
- ],
- "messages": [
- "with your sanity",
- "h",
- "Club Penguin",
- "Skype",
- "with yo mama",
- "with a bootleg plug-and-play",
- "FL Studio: SoundCloud Rapper Edition",
- "Fake Download Button Simulator",
- "quick i need playing lines for my discord bot",
- "a game",
- "anime",
- "absolutely nothing",
- "Mozilla Firefox",
- "Google Chrome",
- "music bot now I guess",
- "Fortnut",
- "epic mashups bro",
- "Netscape Navigator",
- "Ubuntu",
- "Linux",
- "Hello Kitty Island Adventure",
- "with the Infinity Gauntlet",
- "BLJ Simulator",
- "Jake Paul videos on repeat",
- "gniyalP",
- "HaaH WaaW",
- "Shrek Extra Large",
- "dQw4w9WgXcQ",
- "Hong Kong 97",
- "Reddit",
- "Super Smash Bros. Ultimate",
- "Ryujinx",
- "Battletoads for Wii",
- "MS Paint",
- "Roblox",
- "Minecraft",
- "Desert Bus",
- "Mega Man Legends 3",
- "Sonic's Schoolhouse",
- "Action 52",
- "the funny memes epic",
- "Nintendoâĸ",
- "Wario World",
- "the Cat Piano",
- "Pac-Man Championship Edition DX+",
- "Pac-Man Championship Edition 2",
- "Bottom Text",
- "The Elder Scrolls 6",
- "Skyrim",
- "Game Boy Advance Video",
- "Nintendo Switch Online",
- "lol 7",
- "Meme Run",
- "Yoshi for the NES",
- "Family Guy",
- "Deltarune",
- "subscribe to obama",
- "yeah",
- "semicolon",
- "Super Mario Maker 2",
- "jeff",
- "TikTok",
- "woo yeah",
- "Mario",
- "Microsoft Internet Explorer",
- "joe mama",
- "Sonic 06",
- "Wii Speak Channel",
- "Metal Gear Solid 4",
- "iPod Music",
- "Liquid Sun",
- "with your Discord server",
- "Scatman's World",
- "with a stone, Luigi.",
- "Doin' Your Mom by FAttY Spins",
- "with a broken god",
- "games with the mortals",
- "#BringBackNationalSex",
- "chiptune",
- "foobar2000",
- "XMPlay",
- "OpenMPT",
- "follow @esmBot@wetdry.world",
- "with GIFs",
- "check out the website at esmbot.net",
- "the",
- "you just lost the game",
- "Yandere Simulator",
- "PogChamp",
- "yourself",
- "sentience",
- "with Brody Foxx",
- "AOL Instant Messenger",
- "beep boop",
- "Animal Crossing: New Horizons",
- "Hello, Gordon!",
- "the j",
- "Want esmBot to play some new games? Send suggestions!",
- "MilkyTracker",
- "with chimps",
- "with the TF2 source code",
- "alvin chipmunk nightcore",
- "Troll",
- "ay yo the pizza here",
- "100 gecs",
- "with limited resources",
- "messages from 2018",
- "&caption get real",
- "Open Fortress",
- "btw I use arch",
- "Friday Night Funkin",
- "fgsfds",
- "Doilus Stage",
- "please report any issues you find thank you",
- "xfce real",
- "OpenRCT2",
- "Sus? As in the popular video game Among Us?",
- "$19 Fortnite Card",
- "Wild Woody",
- "RDI Halcyon",
- "KFC",
- "Cave Story",
- "YouTube ads",
- "there are federal agents outside my house",
- "WhatsApp",
- "Half Life 3",
- "Tower Defense Simulator",
- "trans rights",
- "balls",
- "Vivaldi",
- "Space Channel 5: Part 2",
- "Vib Ribbon",
- "[[Hyperlink Blocked]]",
- "Steam Deck",
- "Something big is coming.",
- "This image has expired.",
- "The GIF File Format",
- "Scrimblo Bimblo",
- "Babagee",
- "Quilt",
- "Minecraft Alpha 1.0.16.05",
- "dame da ne",
- "Fall Guys",
- "with a box of wind",
- "The Incredibles",
- "AVIF",
- "Sega Nomad",
- "Item Asylum",
- "TIC-80",
- "Ghetto Smosh",
- "Splatoon 3",
- "changed",
- "Chutes and Ladders",
- "i'm gonna break my monitor i swear",
- "The Simpsons: Hit and Run",
- "Plants vs. Zombies",
- "Neverball",
- "joe biden 300 dollar fish",
- "The Bron Jame",
- "VMWare Workstation 16 Pro",
- "outside",
- "Sonic 3 and Knuckles",
- "The Binding of Isaac",
- "Lego Island",
- "on Windows 1.00",
- "Sonic Mania Plus",
- "Rhythm Tengoku",
- "with the ThinkPadâĸ TrackPointâĸ",
- "Mort the Chicken",
- "Yakuza 0",
- "GregTech",
- "a sick guitar riff",
- "Visual Studio Code",
- "Luigi's Mansion",
- "Postal 2",
- "Geometry Dash",
- "FTL: Faster Than Light",
- "Bad Apple",
- "Ultrakill",
- "with marbles",
- "Pikmin 3",
- "Trials Rising",
- "Pizza Tower",
- "ANTONBLAST",
- "[object Object]",
- "Xonotic",
- "Lario",
- "Hi-Fi Rush",
- "Calckey",
- "The clock is ticking."
- ]
-}
+{
+ "emotes": [
+ "",
+ "",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "messages": [
+ "with your sanity",
+ "h",
+ "Club Penguin",
+ "Skype",
+ "with yo mama",
+ "with a bootleg plug-and-play",
+ "FL Studio: SoundCloud Rapper Edition",
+ "Fake Download Button Simulator",
+ "quick i need playing lines for my discord bot",
+ "a game",
+ "anime",
+ "absolutely nothing",
+ "Mozilla Firefox",
+ "Google Chrome",
+ "music bot now I guess",
+ "Fortnut",
+ "epic mashups bro",
+ "Netscape Navigator",
+ "Ubuntu",
+ "Linux",
+ "Hello Kitty Island Adventure",
+ "with the Infinity Gauntlet",
+ "BLJ Simulator",
+ "Jake Paul videos on repeat",
+ "gniyalP",
+ "HaaH WaaW",
+ "Shrek Extra Large",
+ "dQw4w9WgXcQ",
+ "Hong Kong 97",
+ "Reddit",
+ "Super Smash Bros. Ultimate",
+ "Ryujinx",
+ "Battletoads for Wii",
+ "MS Paint",
+ "Roblox",
+ "Minecraft",
+ "Desert Bus",
+ "Mega Man Legends 3",
+ "Sonic's Schoolhouse",
+ "Action 52",
+ "the funny memes epic",
+ "Nintendoâĸ",
+ "Wario World",
+ "the Cat Piano",
+ "Pac-Man Championship Edition DX+",
+ "Pac-Man Championship Edition 2",
+ "Bottom Text",
+ "The Elder Scrolls 6",
+ "Skyrim",
+ "Game Boy Advance Video",
+ "Nintendo Switch Online",
+ "lol 7",
+ "Meme Run",
+ "Yoshi for the NES",
+ "Family Guy",
+ "Deltarune",
+ "subscribe to obama",
+ "yeah",
+ "semicolon",
+ "Super Mario Maker 2",
+ "jeff",
+ "TikTok",
+ "woo yeah",
+ "Mario",
+ "Microsoft Internet Explorer",
+ "joe mama",
+ "Sonic 06",
+ "Wii Speak Channel",
+ "Metal Gear Solid 4",
+ "iPod Music",
+ "Liquid Sun",
+ "with your Discord server",
+ "Scatman's World",
+ "with a stone, Luigi.",
+ "Doin' Your Mom by FAttY Spins",
+ "with a broken god",
+ "games with the mortals",
+ "#BringBackNationalSex",
+ "chiptune",
+ "foobar2000",
+ "XMPlay",
+ "OpenMPT",
+ "follow @esmBot@wetdry.world",
+ "with GIFs",
+ "check out the website at esmbot.net",
+ "the",
+ "you just lost the game",
+ "Yandere Simulator",
+ "PogChamp",
+ "yourself",
+ "sentience",
+ "with Brody Foxx",
+ "AOL Instant Messenger",
+ "beep boop",
+ "Animal Crossing: New Horizons",
+ "Hello, Gordon!",
+ "the j",
+ "Want esmBot to play some new games? Send suggestions!",
+ "MilkyTracker",
+ "with chimps",
+ "with the TF2 source code",
+ "alvin chipmunk nightcore",
+ "Troll",
+ "ay yo the pizza here",
+ "100 gecs",
+ "with limited resources",
+ "messages from 2018",
+ "&caption get real",
+ "Open Fortress",
+ "btw I use arch",
+ "Friday Night Funkin",
+ "fgsfds",
+ "Doilus Stage",
+ "please report any issues you find thank you",
+ "xfce real",
+ "OpenRCT2",
+ "Sus? As in the popular video game Among Us?",
+ "$19 Fortnite Card",
+ "Wild Woody",
+ "RDI Halcyon",
+ "KFC",
+ "Cave Story",
+ "YouTube ads",
+ "there are federal agents outside my house",
+ "WhatsApp",
+ "Half Life 3",
+ "Tower Defense Simulator",
+ "trans rights",
+ "balls",
+ "Vivaldi",
+ "Space Channel 5: Part 2",
+ "Vib Ribbon",
+ "[[Hyperlink Blocked]]",
+ "Steam Deck",
+ "Something big is coming.",
+ "This image has expired.",
+ "The GIF File Format",
+ "Scrimblo Bimblo",
+ "Babagee",
+ "Quilt",
+ "Minecraft Alpha 1.0.16.05",
+ "dame da ne",
+ "Fall Guys",
+ "with a box of wind",
+ "The Incredibles",
+ "AVIF",
+ "Sega Nomad",
+ "Item Asylum",
+ "TIC-80",
+ "Ghetto Smosh",
+ "Splatoon 3",
+ "changed",
+ "Chutes and Ladders",
+ "i'm gonna break my monitor i swear",
+ "The Simpsons: Hit and Run",
+ "Plants vs. Zombies",
+ "Neverball",
+ "joe biden 300 dollar fish",
+ "The Bron Jame",
+ "VMWare Workstation 16 Pro",
+ "outside",
+ "Sonic 3 and Knuckles",
+ "The Binding of Isaac",
+ "Lego Island",
+ "on Windows 1.00",
+ "Sonic Mania Plus",
+ "Rhythm Tengoku",
+ "with the ThinkPadâĸ TrackPointâĸ",
+ "Mort the Chicken",
+ "Yakuza 0",
+ "GregTech",
+ "a sick guitar riff",
+ "Visual Studio Code",
+ "Luigi's Mansion",
+ "Postal 2",
+ "Geometry Dash",
+ "FTL: Faster Than Light",
+ "Bad Apple",
+ "Ultrakill",
+ "with marbles",
+ "Pikmin 3",
+ "Trials Rising",
+ "Pizza Tower",
+ "ANTONBLAST",
+ "[object Object]",
+ "Xonotic",
+ "Lario",
+ "Hi-Fi Rush",
+ "Calckey",
+ "The clock is ticking."
+ ]
+}
diff --git a/config/servers.json b/config/servers.json
index cada2f4..2e272e0 100644
--- a/config/servers.json
+++ b/config/servers.json
@@ -1,11 +1,11 @@
-{
- "lava": [
- { "name": "localhost", "url": "localhost:2333", "auth": "youshallnotpass", "local": true }
- ],
- "image": [
- { "server": "localhost", "auth": "verycoolpass100", "tls": false }
- ],
- "searx": [
- "https://searx.projectlounge.pw"
- ]
+{
+ "lava": [
+ { "name": "localhost", "url": "localhost:2333", "auth": "youshallnotpass", "local": true }
+ ],
+ "image": [
+ { "server": "localhost", "auth": "verycoolpass100", "tls": false }
+ ],
+ "searx": [
+ "https://searx.projectlounge.pw"
+ ]
}
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 93fa2c8..4e47eb9 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,84 +1,84 @@
-version: '3.0'
-
-services:
- bot:
- build:
- context: .
- image: esmbot
- restart: unless-stopped
- volumes:
- - ./logs:/home/esmBot/.internal/logs
- - ./bot-help:/home/esmBot/help
- - ./bot-temp:/home/esmBot/temp
- - ./config:/home/esmBot/.internal/config
- env_file:
- - .env
- environment:
- OUTPUT: /home/esmBot/help/help.md
- TEMPDIR: /home/esmBot/temp
- user: root
- links:
- - lavalink
- depends_on:
- lavalink:
- condition: service_healthy
- postgres:
- condition: service_started
-
- networks:
- esmbot:
- ipv4_address: 172.20.0.2
-
- lavalink:
- container_name: lavalink
- image: fredboat/lavalink:dev
- restart: unless-stopped
- volumes:
- - ./application.yml:/opt/Lavalink/application.yml
- - ./assets:/opt/Lavalink/assets
- healthcheck:
- test: "curl -H \"Authorization: $$(cat /opt/Lavalink/application.yml | grep password: | sed 's/^ *password: //g' | tr -d '\"')\" -f http://localhost:2333/version"
- interval: 10s
- timeout: 10s
- retries: 5
- start_period: 10s
- networks:
- esmbot:
- ipv4_address: 172.20.0.3
-
- postgres:
- container_name: postgres
- image: postgres:13-alpine
- restart: unless-stopped
- volumes:
- - pg-data:/var/lib/postgresql/data
- environment:
- POSTGRES_PASSWORD: verycoolpass100
- POSTGRES_USER: esmbot
- POSTGRES_DB: esmbot
- networks:
- esmbot:
- ipv4_address: 172.20.0.4
-
- adminer:
- image: adminer
- restart: unless-stopped
- depends_on:
- - postgres
- ports:
- - 8888:8080
- networks:
- esmbot:
- ipv4_address: 172.20.0.5
-
-volumes:
- bot-help:
- bot-temp:
- pg-data:
-
-networks:
- esmbot:
- driver: bridge
- ipam:
- config:
+version: '3.0'
+
+services:
+ bot:
+ build:
+ context: .
+ image: esmbot
+ restart: unless-stopped
+ volumes:
+ - ./logs:/home/esmBot/.internal/logs
+ - ./bot-help:/home/esmBot/help
+ - ./bot-temp:/home/esmBot/temp
+ - ./config:/home/esmBot/.internal/config
+ env_file:
+ - .env
+ environment:
+ OUTPUT: /home/esmBot/help/help.md
+ TEMPDIR: /home/esmBot/temp
+ user: root
+ links:
+ - lavalink
+ depends_on:
+ lavalink:
+ condition: service_healthy
+ postgres:
+ condition: service_started
+
+ networks:
+ esmbot:
+ ipv4_address: 172.20.0.2
+
+ lavalink:
+ container_name: lavalink
+ image: fredboat/lavalink:dev
+ restart: unless-stopped
+ volumes:
+ - ./application.yml:/opt/Lavalink/application.yml
+ - ./assets:/opt/Lavalink/assets
+ healthcheck:
+ test: "curl -H \"Authorization: $$(cat /opt/Lavalink/application.yml | grep password: | sed 's/^ *password: //g' | tr -d '\"')\" -f http://localhost:2333/version"
+ interval: 10s
+ timeout: 10s
+ retries: 5
+ start_period: 10s
+ networks:
+ esmbot:
+ ipv4_address: 172.20.0.3
+
+ postgres:
+ container_name: postgres
+ image: postgres:13-alpine
+ restart: unless-stopped
+ volumes:
+ - pg-data:/var/lib/postgresql/data
+ environment:
+ POSTGRES_PASSWORD: verycoolpass100
+ POSTGRES_USER: esmbot
+ POSTGRES_DB: esmbot
+ networks:
+ esmbot:
+ ipv4_address: 172.20.0.4
+
+ adminer:
+ image: adminer
+ restart: unless-stopped
+ depends_on:
+ - postgres
+ ports:
+ - 8888:8080
+ networks:
+ esmbot:
+ ipv4_address: 172.20.0.5
+
+volumes:
+ bot-help:
+ bot-temp:
+ pg-data:
+
+networks:
+ esmbot:
+ driver: bridge
+ ipam:
+ config:
- subnet: 172.20.0.0/24
\ No newline at end of file
diff --git a/docs/config.md b/docs/config.md
index 061a9f4..107dbde 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -1,78 +1,78 @@
-# Config
-esmBot uses a mix of environment variables and JSON for configuration.
-
-## Environment Variables (.env)
-To make managing environment variables easier, an example `.env` file is included with the bot at `.env.example` and can be used to load the variables on startup.
-
-### Required
-- `NODE_ENV`: Used for tuning the bot to different environments. If you don't know what to set it to, leave it as is.
-- `TOKEN`: Your bot's token. You can find this [here](https://discord.com/developers/applications) under your application's Bot tab.
-- `DB`: The database connection string. By default the `sqlite` and `postgresql` protocols are available, but this can be expanded by putting proper DB driver scripts into `utils/database/`.
-- `OWNER`: Your Discord user ID. This is used for granting yourself access to certain management commands. Adding multiple users is supported by separating the IDs with a comma; however, this is not recommended for security purposes.
-- `PREFIX`: The bot's default command prefix for classic commands. Note that servers can set their own individual prefixes via the `prefix` command.
-
-### Optional
-These variables that are not necessarily required for the bot to run, but can greatly enhance its functionality:
-
-- `STAYVC`: Set this to true if you want the bot to stay in voice chat after playing music/a sound effect. You can make it leave by using the stop command.
-- `TENOR`: An API token from [Tenor](https://tenor.com/gifapi). This is required for using GIFs from Tenor.
-- `OUTPUT`: A directory to output the help documentation in Markdown format to. It's recommended to set this to a directory being served by a web server.
-- `TEMPDIR`: A directory that will store generated images larger than 8MB. It's recommended to set this to a directory being served by a web server.
-- `TMP_DOMAIN`: The root domain/directory that the images larger than 8MB are stored at. Example: `https://projectlounge.pw/tmp`
-- `THRESHOLD`: A filesize threshold that the bot will start deleting old files in `TEMPDIR` at.
-- `METRICS`: The HTTP port to serve [Prometheus](https://prometheus.io/)-compatible metrics on.
-- `API_TYPE`: Set this to "none" if you want to process all images locally. Alternatively, set it to "ws" to use an image API server specified in the `image` block of `config/servers.json`.
-- `ADMIN_SERVER`: A Discord server/guild ID to limit owner-only commands such as eval to.
-
-## JSON
-The JSON-based configuration files are located in `config/`.
-
-### commands.json
-```js
-{
- "types": {
- "classic": false, // Enable/disable "classic" (prefixed) commands, note that classic commands in direct messages will still work
- "application": true // Enable/disable application commands (slash and context menu commands)
- },
- "blacklist": [
- // Names of commands that you don't want the bot to load
- ]
-}
-```
-
-### messages.json
-```js
-{
- "emotes": [
- // Discord emote strings to use in the "Processing... this may take a while" messages, e.g. "" or "âī¸"
- ],
- "messages": [
- // Strings to use in the bot's activity message/playing status
- ]
-}
-```
-
-### servers.json
-```js
-{
- "lava": [ // Objects containing info for connecting to Lavalink audio server(s)
- {
- "name": "test", // A human-friendly name for the server
- "url": "localhost:2333", // IP address/domain name and port for the server
- "auth": "youshallnotpass", // Password/authorization code for the server
- "local": false // Whether or not the esmBot "assets" folder is located next to the Lavalink jar file
- }
- ],
- "image": [ // Objects containing info for connecting to WS image server(s)
- {
- "server": "localhost", // IP address or domain name for the server
- "auth": "verycoolpass100", // Password/authorization code for the server
- "tls": false // Whether or not this is a secure TLS/wss connection
- }
- ],
- "searx": [
- // URLs for Searx/SearXNG instances used for image/YouTube searches, e.g. "https://searx.projectlounge.pw"
- // Note: instances must support getting results over JSON
- ]
-}
-```
+# Config
+esmBot uses a mix of environment variables and JSON for configuration.
+
+## Environment Variables (.env)
+To make managing environment variables easier, an example `.env` file is included with the bot at `.env.example` and can be used to load the variables on startup.
+
+### Required
+- `NODE_ENV`: Used for tuning the bot to different environments. If you don't know what to set it to, leave it as is.
+- `TOKEN`: Your bot's token. You can find this [here](https://discord.com/developers/applications) under your application's Bot tab.
+- `DB`: The database connection string. By default the `sqlite` and `postgresql` protocols are available, but this can be expanded by putting proper DB driver scripts into `utils/database/`.
+- `OWNER`: Your Discord user ID. This is used for granting yourself access to certain management commands. Adding multiple users is supported by separating the IDs with a comma; however, this is not recommended for security purposes.
+- `PREFIX`: The bot's default command prefix for classic commands. Note that servers can set their own individual prefixes via the `prefix` command.
+
+### Optional
+These variables that are not necessarily required for the bot to run, but can greatly enhance its functionality:
+
+- `STAYVC`: Set this to true if you want the bot to stay in voice chat after playing music/a sound effect. You can make it leave by using the stop command.
+- `TENOR`: An API token from [Tenor](https://tenor.com/gifapi). This is required for using GIFs from Tenor.
+- `OUTPUT`: A directory to output the help documentation in Markdown format to. It's recommended to set this to a directory being served by a web server.
+- `TEMPDIR`: A directory that will store generated images larger than 8MB. It's recommended to set this to a directory being served by a web server.
+- `TMP_DOMAIN`: The root domain/directory that the images larger than 8MB are stored at. Example: `https://projectlounge.pw/tmp`
+- `THRESHOLD`: A filesize threshold that the bot will start deleting old files in `TEMPDIR` at.
+- `METRICS`: The HTTP port to serve [Prometheus](https://prometheus.io/)-compatible metrics on.
+- `API_TYPE`: Set this to "none" if you want to process all images locally. Alternatively, set it to "ws" to use an image API server specified in the `image` block of `config/servers.json`.
+- `ADMIN_SERVER`: A Discord server/guild ID to limit owner-only commands such as eval to.
+
+## JSON
+The JSON-based configuration files are located in `config/`.
+
+### commands.json
+```js
+{
+ "types": {
+ "classic": false, // Enable/disable "classic" (prefixed) commands, note that classic commands in direct messages will still work
+ "application": true // Enable/disable application commands (slash and context menu commands)
+ },
+ "blacklist": [
+ // Names of commands that you don't want the bot to load
+ ]
+}
+```
+
+### messages.json
+```js
+{
+ "emotes": [
+ // Discord emote strings to use in the "Processing... this may take a while" messages, e.g. "" or "âī¸"
+ ],
+ "messages": [
+ // Strings to use in the bot's activity message/playing status
+ ]
+}
+```
+
+### servers.json
+```js
+{
+ "lava": [ // Objects containing info for connecting to Lavalink audio server(s)
+ {
+ "name": "test", // A human-friendly name for the server
+ "url": "localhost:2333", // IP address/domain name and port for the server
+ "auth": "youshallnotpass", // Password/authorization code for the server
+ "local": false // Whether or not the esmBot "assets" folder is located next to the Lavalink jar file
+ }
+ ],
+ "image": [ // Objects containing info for connecting to WS image server(s)
+ {
+ "server": "localhost", // IP address or domain name for the server
+ "auth": "verycoolpass100", // Password/authorization code for the server
+ "tls": false // Whether or not this is a secure TLS/wss connection
+ }
+ ],
+ "searx": [
+ // URLs for Searx/SearXNG instances used for image/YouTube searches, e.g. "https://searx.projectlounge.pw"
+ // Note: instances must support getting results over JSON
+ ]
+}
+```
diff --git a/docs/custom-commands.md b/docs/custom-commands.md
index 2cce3e9..6594c63 100644
--- a/docs/custom-commands.md
+++ b/docs/custom-commands.md
@@ -1,88 +1,88 @@
-# Custom Commands
-esmBot has a powerful and flexible command handler, allowing you to create new commands and categories simply by creating new files. This page will provide a reference for creating new commands.
-
-## Directory Structure
-The bot loads commands from subdirectories inside of the `commands` directory, which looks something like this by default:
-```
-commands/
- - fun
- > cat.js
- > ...
- - general
- > help.js
- > ping.js
- > ...
- - image-editing
- > caption.js
- > speed.js
- > ...
-```
-As you can see, each command is grouped into categories, which are represented by subdirectories. To create a new category, you can simply create a new directory inside of the `commands` directory, and to create a new command, you can create a new JS file under one of those subdirectories.
-
-!!! tip
- The `message` category is special; commands in here act as right-click context menu message commands instead of "classic" or slash commands.
-
-## Command Structure
-It's recommended to use the `Command` class located in `classes/command.js` to create a new command in most cases. This class provides various parameters and fields that will likely be useful when creating a command. Here is a simple example of a working command file:
-```js
-import Command from "../../classes/command.js";
-
-class HelloCommand extends Command {
- async run() {
- return "Hello world!";
- }
-
- static description = "A simple command example";
- static aliases = ["helloworld"];
-}
-
-export default HelloCommand;
-```
-As you can see, the first thing we do is import the Command class. We then create a new class for the command that extends that class to provide the needed parameters. We then define the command function, which is named `run`. Some static parameters, including the command description and an alias for the command, `helloworld`, are also defined. Finally, once everything in the command class is defined, we export the new class to be loaded as a module by the command handler.
-
-The default command name is the same as the filename that you save it as, excluding the `.js` file extension. If you ever want to change the name of the command, just rename the file.
-
-The parameters available to your command consist of the following:
-
-- `this.client`: An instance of an Oceanic [`Client`](https://docs.oceanic.ws/dev/classes/Client.Client.html), useful for getting info or performing lower-level communication with the Discord API.
-- `this.origOptions`: The raw options object provided to the command by the command handler.
-- `this.type`: The type of message that activated the command. Can be "classic" (a regular message) or "application" (slash/context menu commands).
-- `this.channel`: An Oceanic [`TextChannel`](https://docs.oceanic.ws/dev/classes/TextChannel.TextChannel.html) object of the channel that the command was run in, useful for getting info about a server and how to respond to a message.
-- `this.guild`: An Oceanic [`Guild`](https://docs.oceanic.ws/dev/classes/Guild.Guild.html) object of the guild that the command was run in. This is undefined in DMs.
-- `this.author`: An Oceanic [`User`](https://docs.oceanic.ws/dev/classes/User.User.html) object of the user who ran the command, or a [`Member`](https://docs.oceanic.ws/dev/classes/Member.Member.html) object identical to `this.member` if run in a server as a slash command.
-- `this.member`: An Oceanic [`Member`](https://docs.oceanic.ws/dev/classes/Member.Member.html) object of the server member who ran the command. When running the command outside of a server, this parameter is undefined when run as a "classic" command or a [`User`](https://docs.oceanic.ws/dev/classes/User.User.html) object identical to `this.author` when run as a slash command.
-- `this.options`: When run as a "classic" command, this is an object of special arguments (e.g. `--argument=true`) passed to the command. These arguments are stored in a key/value format, so following the previous example, `this.options.argument` would return true. When run as a slash command, this is an object of every argument passed to the command.
-
-Some options are only available depending on the context/original message type, which can be checked with `this.type`. The options only available with "classic" messages are listed below:
-
-- `this.message`: An Oceanic [`Message`](https://docs.oceanic.ws/dev/classes/Message.Message.html) object of the message that the command was run from, useful for interaction.
-- `this.args`: An array of text arguments passed to the command.
-- `this.content`: A string of the raw content of the command message, excluding the prefix and command name.
-- `this.reference`: An object that's useful if you ever decide to reply to a user inside the command. You can use [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) to combine your message content with this parameter.
-
-The options only available with application (slash and context menu) commands are listed below:
-
-- `this.interaction`: An Oceanic [`CommandInteraction`](https://docs.oceanic.ws/dev/classes/CommandInteraction.CommandInteraction.html) object of the incoming slash command data.
-- `this.optionsArray`: A raw array of command options. Should rarely be used.
-- `this.success`: A boolean value that causes the bot to respond with a normal message when `true`, or an "ephemeral" message (a message that's only visible to the person who ran the command) when `false`.
-
-Some static fields are also available and can be set depending on your command. These fields are listed below:
-
-- `description`: Your command's description, which is shown in the help command.
-- `aliases`: An array of command aliases. People will be able to run the command using these as well as the normal command name.
-- `arguments`: An array of command argument types, which are shown in the help command.
-- `flags`: An array of objects specifying command flags, or special arguments, that will be shown when running `help ` or a slash command. Example:
-```js
-static flags = [{
- name: "argument",
- type: Constants.ApplicationCommandOptionTypes.STRING, // translates to 3, see https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
- description: "Does a thing",
- ...
-}];
-```
-- `slashAllowed`: Specifies whether or not the command is available via slash commands.
-- `directAllowed`: Specifies whether or not a command is available in direct messages.
-- `adminOnly`: Specifies whether or not a command should be limited to the bot owner(s).
-
-## The `run` Function
+# Custom Commands
+esmBot has a powerful and flexible command handler, allowing you to create new commands and categories simply by creating new files. This page will provide a reference for creating new commands.
+
+## Directory Structure
+The bot loads commands from subdirectories inside of the `commands` directory, which looks something like this by default:
+```
+commands/
+ - fun
+ > cat.js
+ > ...
+ - general
+ > help.js
+ > ping.js
+ > ...
+ - image-editing
+ > caption.js
+ > speed.js
+ > ...
+```
+As you can see, each command is grouped into categories, which are represented by subdirectories. To create a new category, you can simply create a new directory inside of the `commands` directory, and to create a new command, you can create a new JS file under one of those subdirectories.
+
+!!! tip
+ The `message` category is special; commands in here act as right-click context menu message commands instead of "classic" or slash commands.
+
+## Command Structure
+It's recommended to use the `Command` class located in `classes/command.js` to create a new command in most cases. This class provides various parameters and fields that will likely be useful when creating a command. Here is a simple example of a working command file:
+```js
+import Command from "../../classes/command.js";
+
+class HelloCommand extends Command {
+ async run() {
+ return "Hello world!";
+ }
+
+ static description = "A simple command example";
+ static aliases = ["helloworld"];
+}
+
+export default HelloCommand;
+```
+As you can see, the first thing we do is import the Command class. We then create a new class for the command that extends that class to provide the needed parameters. We then define the command function, which is named `run`. Some static parameters, including the command description and an alias for the command, `helloworld`, are also defined. Finally, once everything in the command class is defined, we export the new class to be loaded as a module by the command handler.
+
+The default command name is the same as the filename that you save it as, excluding the `.js` file extension. If you ever want to change the name of the command, just rename the file.
+
+The parameters available to your command consist of the following:
+
+- `this.client`: An instance of an Oceanic [`Client`](https://docs.oceanic.ws/dev/classes/Client.Client.html), useful for getting info or performing lower-level communication with the Discord API.
+- `this.origOptions`: The raw options object provided to the command by the command handler.
+- `this.type`: The type of message that activated the command. Can be "classic" (a regular message) or "application" (slash/context menu commands).
+- `this.channel`: An Oceanic [`TextChannel`](https://docs.oceanic.ws/dev/classes/TextChannel.TextChannel.html) object of the channel that the command was run in, useful for getting info about a server and how to respond to a message.
+- `this.guild`: An Oceanic [`Guild`](https://docs.oceanic.ws/dev/classes/Guild.Guild.html) object of the guild that the command was run in. This is undefined in DMs.
+- `this.author`: An Oceanic [`User`](https://docs.oceanic.ws/dev/classes/User.User.html) object of the user who ran the command, or a [`Member`](https://docs.oceanic.ws/dev/classes/Member.Member.html) object identical to `this.member` if run in a server as a slash command.
+- `this.member`: An Oceanic [`Member`](https://docs.oceanic.ws/dev/classes/Member.Member.html) object of the server member who ran the command. When running the command outside of a server, this parameter is undefined when run as a "classic" command or a [`User`](https://docs.oceanic.ws/dev/classes/User.User.html) object identical to `this.author` when run as a slash command.
+- `this.options`: When run as a "classic" command, this is an object of special arguments (e.g. `--argument=true`) passed to the command. These arguments are stored in a key/value format, so following the previous example, `this.options.argument` would return true. When run as a slash command, this is an object of every argument passed to the command.
+
+Some options are only available depending on the context/original message type, which can be checked with `this.type`. The options only available with "classic" messages are listed below:
+
+- `this.message`: An Oceanic [`Message`](https://docs.oceanic.ws/dev/classes/Message.Message.html) object of the message that the command was run from, useful for interaction.
+- `this.args`: An array of text arguments passed to the command.
+- `this.content`: A string of the raw content of the command message, excluding the prefix and command name.
+- `this.reference`: An object that's useful if you ever decide to reply to a user inside the command. You can use [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) to combine your message content with this parameter.
+
+The options only available with application (slash and context menu) commands are listed below:
+
+- `this.interaction`: An Oceanic [`CommandInteraction`](https://docs.oceanic.ws/dev/classes/CommandInteraction.CommandInteraction.html) object of the incoming slash command data.
+- `this.optionsArray`: A raw array of command options. Should rarely be used.
+- `this.success`: A boolean value that causes the bot to respond with a normal message when `true`, or an "ephemeral" message (a message that's only visible to the person who ran the command) when `false`.
+
+Some static fields are also available and can be set depending on your command. These fields are listed below:
+
+- `description`: Your command's description, which is shown in the help command.
+- `aliases`: An array of command aliases. People will be able to run the command using these as well as the normal command name.
+- `arguments`: An array of command argument types, which are shown in the help command.
+- `flags`: An array of objects specifying command flags, or special arguments, that will be shown when running `help ` or a slash command. Example:
+```js
+static flags = [{
+ name: "argument",
+ type: Constants.ApplicationCommandOptionTypes.STRING, // translates to 3, see https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-type
+ description: "Does a thing",
+ ...
+}];
+```
+- `slashAllowed`: Specifies whether or not the command is available via slash commands.
+- `directAllowed`: Specifies whether or not a command is available in direct messages.
+- `adminOnly`: Specifies whether or not a command should be limited to the bot owner(s).
+
+## The `run` Function
The main JS code of your command is specified in the `run` function. This function should return a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) of your command output, which is why the `run` function [is an async function by default](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). The return value inside the `Promise` should be either a string or an object; you should return a string whenever you intend to reply with plain text, or an object if you intend to reply with something else, such as an embed or attachment.
\ No newline at end of file
diff --git a/docs/docker.md b/docs/docker.md
index 0f9a8a1..f9b5f37 100644
--- a/docs/docker.md
+++ b/docs/docker.md
@@ -1,27 +1,27 @@
-# Docker
-You can run the bot as well as its dependencies as a series of Docker containers. However, the manual setup is still recommended if you want more control over the bot.
-
-[To start, install Docker on your system via the instructions here.](https://docs.docker.com/engine/install/#server)
-
-Once you've installed Docker, you should clone the esmBot repo:
-```sh
-cd ~
-git clone --recurse-submodules https://github.com/esmBot/esmBot
-cd esmBot
-```
-Modify the `.env` file as described in step 7 of the manual setup. Make sure to change the `DB` option to this, however:
-```
-DB=postgresql://esmbot:verycoolpass100@postgres:5432/esmbot
-```
-You should then modify the `config/servers.json` file to change the IP addresses of the servers to match the Docker containers. Example:
-```json
-{
- "lava": [
- { "name": "localhost", "url": "lavalink:2333", "auth": "youshallnotpass", "local": true }
- ],
- "image": [
- { "server": "api", "auth": "verycoolpass100", "tls": false }
- ]
-}
-```
+# Docker
+You can run the bot as well as its dependencies as a series of Docker containers. However, the manual setup is still recommended if you want more control over the bot.
+
+[To start, install Docker on your system via the instructions here.](https://docs.docker.com/engine/install/#server)
+
+Once you've installed Docker, you should clone the esmBot repo:
+```sh
+cd ~
+git clone --recurse-submodules https://github.com/esmBot/esmBot
+cd esmBot
+```
+Modify the `.env` file as described in step 7 of the manual setup. Make sure to change the `DB` option to this, however:
+```
+DB=postgresql://esmbot:verycoolpass100@postgres:5432/esmbot
+```
+You should then modify the `config/servers.json` file to change the IP addresses of the servers to match the Docker containers. Example:
+```json
+{
+ "lava": [
+ { "name": "localhost", "url": "lavalink:2333", "auth": "youshallnotpass", "local": true }
+ ],
+ "image": [
+ { "server": "api", "auth": "verycoolpass100", "tls": false }
+ ]
+}
+```
Finally, start the bot by running `docker-compose up -d`.
\ No newline at end of file
diff --git a/docs/index.md b/docs/index.md
index 822cfcc..9c55a79 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,3 +1,3 @@
-Welcome to the esmBot documentation site!
-
+Welcome to the esmBot documentation site!
+
You're probably looking for the [Setup](setup.md) page. If you're an end user looking to invite the bot, head over to [https://esmbot.net/invite](https://esmbot.net/invite).
\ No newline at end of file
diff --git a/docs/postgresql.md b/docs/postgresql.md
index 7868d7f..8bd4e8e 100644
--- a/docs/postgresql.md
+++ b/docs/postgresql.md
@@ -1,65 +1,65 @@
-# PostgreSQL
-Here are some instructions for setting up PostgreSQL for use with esmBot.
-
-### 1. Install PostgreSQL.
-
-=== "Debian/Ubuntu"
- ```sh
- sudo apt-get install postgresql postgresql-client
- ```
-=== "Fedora/RHEL"
- ```sh
- sudo dnf install postgresql postgresql-server
- ```
-=== "Alpine"
- ```sh
- doas apk add postgresql
- ```
-=== "Arch/Manjaro"
- ```sh
- sudo pacman -S postgresql
- ```
-
-***
-
-### 2. (Optional) Tune PostgreSQL.
-
-[PGTune](https://pgtune.leopard.in.ua/) is a useful tool for generating configuration files for your PostgreSQL database. It is highly recommended that you generate a config using this tool as it can increase stability and performance.
-
-***
-
-### 3. Create the bot user and database.
-
-When you install PostgreSQL, it'll create a new user on your system that acts as the "superuser" of the database. You'll need to run Postgres commands as this user; however, you can run a command as that user without switching to it by using `sudo`.
-
-First, you'll need to create a user that the bot can interact with as well as the database itself:
-```sh
-sudo su - postgres -c "createuser esmbot"
-sudo su - postgres -c "createdb esmbot"
-```
-Then, launch the PostgreSQL shell for the next few commands:
-```sh
-sudo -u postgres psql
-```
-If you want to give the user a password, you can do so like this:
-```sql
-ALTER USER esmbot WITH PASSWORD 'new_password';
-```
-Once you're inside the shell, you'll need to make sure the bot owns the database and has permissions:
-```sql
-ALTER DATABASE esmbot OWNER TO esmbot;
-```
-
-You're done!
-
-***
-
-### Troubleshooting
-If you get an error like `error: permission denied for table counts` when attempting to run the bot, try running these commands in the PostgreSQL shell:
-```sql
-\c esmbot
-GRANT ALL PRIVILEGES ON guilds TO esmbot;
-GRANT ALL PRIVILEGES ON counts TO esmbot;
-GRANT ALL PRIVILEGES ON tags TO esmbot;
-\q
-```
+# PostgreSQL
+Here are some instructions for setting up PostgreSQL for use with esmBot.
+
+### 1. Install PostgreSQL.
+
+=== "Debian/Ubuntu"
+ ```sh
+ sudo apt-get install postgresql postgresql-client
+ ```
+=== "Fedora/RHEL"
+ ```sh
+ sudo dnf install postgresql postgresql-server
+ ```
+=== "Alpine"
+ ```sh
+ doas apk add postgresql
+ ```
+=== "Arch/Manjaro"
+ ```sh
+ sudo pacman -S postgresql
+ ```
+
+***
+
+### 2. (Optional) Tune PostgreSQL.
+
+[PGTune](https://pgtune.leopard.in.ua/) is a useful tool for generating configuration files for your PostgreSQL database. It is highly recommended that you generate a config using this tool as it can increase stability and performance.
+
+***
+
+### 3. Create the bot user and database.
+
+When you install PostgreSQL, it'll create a new user on your system that acts as the "superuser" of the database. You'll need to run Postgres commands as this user; however, you can run a command as that user without switching to it by using `sudo`.
+
+First, you'll need to create a user that the bot can interact with as well as the database itself:
+```sh
+sudo su - postgres -c "createuser esmbot"
+sudo su - postgres -c "createdb esmbot"
+```
+Then, launch the PostgreSQL shell for the next few commands:
+```sh
+sudo -u postgres psql
+```
+If you want to give the user a password, you can do so like this:
+```sql
+ALTER USER esmbot WITH PASSWORD 'new_password';
+```
+Once you're inside the shell, you'll need to make sure the bot owns the database and has permissions:
+```sql
+ALTER DATABASE esmbot OWNER TO esmbot;
+```
+
+You're done!
+
+***
+
+### Troubleshooting
+If you get an error like `error: permission denied for table counts` when attempting to run the bot, try running these commands in the PostgreSQL shell:
+```sql
+\c esmbot
+GRANT ALL PRIVILEGES ON guilds TO esmbot;
+GRANT ALL PRIVILEGES ON counts TO esmbot;
+GRANT ALL PRIVILEGES ON tags TO esmbot;
+\q
+```
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 5919752..386bc86 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,2 +1,2 @@
-mkdocs-glightbox
+mkdocs-glightbox
mkdocs-git-revision-date-localized-plugin
\ No newline at end of file
diff --git a/docs/setup.md b/docs/setup.md
index 28212ce..926b16e 100644
--- a/docs/setup.md
+++ b/docs/setup.md
@@ -1,237 +1,237 @@
-# Setup
-Here are some instructions to get esmBot up and running from source.
-
-??? check "Recommended system requirements"
- - 64-bit CPU/operating system
- - Quad-core CPU or better
- - 1GB or more of RAM
- - Linux-based operating system or virtual machine ([Ubuntu 22.04 LTS](https://ubuntu.com/download/server) or [Fedora 36](https://getfedora.org/) are recommended)
-
-!!! warning
- If you want to run the bot on Windows, [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) is recommended. This guide is somewhat Linux-centric, so for now you're mostly on your own if you decide not to use WSL.
-
-If you have any further questions regarding setup, feel free to ask in the #support channel on the [esmBot Support server](https://esmbot.net/support).
-
-!!! tip
- You can run the bot using Docker for a somewhat simpler setup experience. [Click here to go to the Docker setup guide.](https://docs.esmbot.net/docker)
-
-### 1. Install the required native dependencies.
-Choose the distro you're using below for insallation instructions.
-=== "Debian/Ubuntu"
- These instructions apply to Debian version 12 (bookworm) or Ubuntu version 22.04 (jammy) or later.
- ```sh
- sudo apt-get install git curl build-essential cmake ffmpeg sqlite3 ttf-mscorefonts-installer libmagick++-dev libvips-dev libcgif-dev libgirepository1.0-dev fonts-noto-color-emoji libimagequant-dev meson
- ```
- On older Debian/Ubuntu versions, you may need to install some of these packages (notably libcgif-dev and meson) through alternative methods.
-=== "Fedora/RHEL"
- These instructions apply to Fedora 36/RHEL 9 or later.
-
- Some of these packages require that you add the RPM Fusion and/or EPEL repositories. You can find instructions on how to add them [here](https://rpmfusion.org/Configuration).
- ```sh
- sudo dnf install git curl cmake ffmpeg sqlite gcc-c++ libcgif-devel ImageMagick-c++-devel vips-devel libimagequant-devel gobject-introspection-devel google-noto-emoji-color-fonts meson
- ```
- On RHEL-based distros like AlmaLinux and Rocky Linux, you may need to add [Remi's RPM Repository](https://rpms.remirepo.net) for the vips package.
-=== "Alpine"
- These instructions apply to the current Edge versions.
- ```sh
- doas apk add git curl msttcorefonts-installer python3 sqlite3 alpine-sdk cmake ffmpeg imagemagick-dev vips-dev font-noto-emoji gobject-introspection-dev cgif-dev libimagequant-dev meson
- ```
-=== "Arch/Manjaro"
- ```sh
- sudo pacman -S git curl cmake pango ffmpeg npm imagemagick libvips sqlite3 libltdl noto-fonts-emoji gobject-introspection libcgif libimagequant meson
- ```
- You'll also need to install [`ttf-ms-win10-auto`](https://aur.archlinux.org/packages/ttf-ms-win10-auto/) from the AUR.
-
-***
-
-### 2. Install libvips.
-
-[libvips](https://github.com/libvips/libvips) is the core of esmBot's image processing commands. Version 8.13.0 or higher is recommended because it contains fixes to GIF handling and support for the freeze command; however, this version isn't packaged for most distros yet. To fix this, you'll need to build libvips from source.
-
-!!! note
- Alpine, Arch, RHEL **(not Fedora!)**, and Ubuntu 22.10 (Kinetic Kudu) users can skip this step, since these distros now have 8.13.0 packaged.
-
-First, download the source and move into it:
-```sh
-git clone https://github.com/libvips/libvips
-cd libvips
-```
-From here, you can set up the build:
-```sh
-meson setup --prefix=/usr --buildtype=release -Dnsgif=true build
-```
-If that command finishes with no errors, you can compile and install it:
-```sh
-cd build
-meson compile
-sudo meson install
-```
-
-***
-
-### 3. Install Node.js.
-
-Node.js is the runtime that esmBot is built on top of. The bot requires version 16 or above to run.
-
-First things first, we'll need to install pnpm, the package manager used by the bot. Run the following to install it:
-```sh
-curl -fsSL https://get.pnpm.io/install.sh | sh -
-```
-
-Once you've done that, continue with the instructions for your operating system below.
-
-=== "Debian/Ubuntu"
- You'll need a more recent version than what's provided in most Debian/Ubuntu-based distros. You can add a repository that contains a supported version by running this command:
- ```sh
- curl -fsSL https://deb.nodesource.com/setup_16.x | sudo bash -
- ```
- After that, you can install Node.js with this command:
- ```sh
- sudo apt-get install nodejs
- ```
-=== "Fedora/RHEL"
- ```sh
- sudo dnf install nodejs
- ```
-=== "Alpine"
- ```sh
- doas apk add nodejs
- ```
-=== "Arch/Manjaro"
- ```sh
- sudo pacman -S nodejs
- ```
-
-***
-
-### 4. Set up the database.
-
-esmBot officially supports two database systems: SQLite and PostgreSQL. While SQLite is smaller and requires no initial setup, PostgreSQL has better performance (especially in large environments).
-
-!!! tip
- If you're new to databases and self-hosting, choose SQLite.
-
-If you would like to use the SQLite database, no configuration is needed and you can move on to the next step.
-
-If you would like to use the PostgreSQL database, view the setup instructions [here](https://docs.esmbot.net/postgresql) and come back here when you're finished.
-
-***
-
-### 5. Clone the repo and install the required Node modules.
-```sh
-cd ~
-git clone --recursive https://github.com/esmBot/esmBot
-cd esmBot
-pnpm i -g node-gyp
-pnpm install
-pnpm build
-```
-
-***
-
-### 6. (Optional) Set up Lavalink.
-
-Lavalink is the audio server used by esmBot for soundboard commands and music playback. If you do not plan on using these features, you can safely skip this step.
-
-!!! warning
- There are websites out there providing lists of public Lavalink instances that can be used with the bot. However, these are not recommended due to performance/security concerns and missing features, and it is highly recommended to set one up yourself instead using the steps below.
-
-Lavalink requires a Java (11 or later) installation. You can use [SDKMAN](https://sdkman.io) to install Eclipse Temurin, a popular Java distribution:
-```sh
-sdk install java 11.0.15-tem
-```
-
-Initial setup is like this:
-```sh
-cd ~
-mkdir Lavalink
-cd Lavalink
-curl -OL https://github.com/freyacodes/Lavalink/releases/latest/download/Lavalink.jar
-cp ~/esmBot/application.yml .
-ln -s ~/esmBot/assets assets
-```
-To run Lavalink, you can use this command:
-```sh
-java -Djdk.tls.client.protocols=TLSv1.2 -jar Lavalink.jar
-```
-
-!!! info
- You'll need to run Lavalink alongside the bot in order to use it. There are a few methods to do this, such as the `screen` command, creating a new systemd service, or simply just opening a new terminal session alongside your current one.
-
-***
-
-### 7. Configure the bot.
-
-Configuration is done via environment variables which can be specified through a `.env` file. Copy `.env.example` to get a starter config file:
-```sh
-cp .env.example .env
-```
-
-!!! tip
- If you can't see either of these files, don't worry - Linux treats files whose names start with a . as hidden files.
-
-To edit this file in the terminal, run this command:
-```sh
-nano .env
-```
-This will launch a text editor with the file ready to go. Create a Discord application [here](https://discord.com/developers/applications) and select the Bot tab on the left, then create a bot user. Once you've done this, copy the token it gives you and put it in the `TOKEN` variable.
-
-When you're finished editing the file, press Ctrl + X, then Y and Enter.
-
-An overview of each of the variables in the `.env` file can be found [here](https://docs.esmbot.net/config).
-
-***
-
-### 8. Run the bot.
-
-Once everything else is set up, you can start the bot like so:
-```sh
-pnpm start
-```
-If the bot starts successfully, you're done! You can invite the bot to your server by generating an invite link under OAuth -> URL Generator in the Discord application dashboard.
-
-!!! note
- You will need to select the `bot` and `applications.commands` scopes.
- The following permissions are needed in most cases for the bot to work properly:
-
-
-
-If you want the bot to run 24/7, you can use the [PM2](https://pm2.keymetrics.io) process manager. Install it using the following command:
-```sh
-pnpm add -g pm2
-```
-
-Once you've done that, you can start the bot using the following command:
-```sh
-pm2 start ecosystem.config.cjs
-```
-
-!!! tip
- If you wish to update the bot to the latest version/commit at any time, just run `git pull` and `pnpm install`.
-
-***
-
-## Troubleshooting
-??? faq "Error: Cannot find module './build/Release/image.node'"
- The native image functions haven't been built. Run `pnpm run build` to build them.
-
-??? faq "`pnpm install` or `pnpm build` fails with error 'ELIFECYCLEâ Command failed.'"
- You seem to be missing node-gyp. This can be fixed by running:
- ```sh
- pnpm i -g node-gyp
- rm -rf node_modules
- pnpm install
- ```
-
-??? faq "Error: connect ECONNREFUSED 127.0.0.1:5432"
- PostgreSQL isn't running, you should be able to start it with `sudo systemctl start postgresql`. If you don't intend to use PostgreSQL, you should take another look at your `DB` variable in the .env file.
-
-??? faq "Gifs from Tenor result in a "no decode delegate for this image format" or "improper image header" error"
- Tenor GIFs are actually stored as MP4s, which libvips can't decode most of the time. You'll need to get a Tenor API key from [here](https://developers.google.com/tenor/guides/quickstart) and put it in the `TENOR` variable in .env.
-
-***
-
-If you have any further questions regarding self-hosting, feel free to ask in the #support channel on the [esmBot Support server](https://esmbot.net/support).
+# Setup
+Here are some instructions to get esmBot up and running from source.
+
+??? check "Recommended system requirements"
+ - 64-bit CPU/operating system
+ - Quad-core CPU or better
+ - 1GB or more of RAM
+ - Linux-based operating system or virtual machine ([Ubuntu 22.04 LTS](https://ubuntu.com/download/server) or [Fedora 36](https://getfedora.org/) are recommended)
+
+!!! warning
+ If you want to run the bot on Windows, [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) is recommended. This guide is somewhat Linux-centric, so for now you're mostly on your own if you decide not to use WSL.
+
+If you have any further questions regarding setup, feel free to ask in the #support channel on the [esmBot Support server](https://esmbot.net/support).
+
+!!! tip
+ You can run the bot using Docker for a somewhat simpler setup experience. [Click here to go to the Docker setup guide.](https://docs.esmbot.net/docker)
+
+### 1. Install the required native dependencies.
+Choose the distro you're using below for insallation instructions.
+=== "Debian/Ubuntu"
+ These instructions apply to Debian version 12 (bookworm) or Ubuntu version 22.04 (jammy) or later.
+ ```sh
+ sudo apt-get install git curl build-essential cmake ffmpeg sqlite3 ttf-mscorefonts-installer libmagick++-dev libvips-dev libcgif-dev libgirepository1.0-dev fonts-noto-color-emoji libimagequant-dev meson
+ ```
+ On older Debian/Ubuntu versions, you may need to install some of these packages (notably libcgif-dev and meson) through alternative methods.
+=== "Fedora/RHEL"
+ These instructions apply to Fedora 36/RHEL 9 or later.
+
+ Some of these packages require that you add the RPM Fusion and/or EPEL repositories. You can find instructions on how to add them [here](https://rpmfusion.org/Configuration).
+ ```sh
+ sudo dnf install git curl cmake ffmpeg sqlite gcc-c++ libcgif-devel ImageMagick-c++-devel vips-devel libimagequant-devel gobject-introspection-devel google-noto-emoji-color-fonts meson
+ ```
+ On RHEL-based distros like AlmaLinux and Rocky Linux, you may need to add [Remi's RPM Repository](https://rpms.remirepo.net) for the vips package.
+=== "Alpine"
+ These instructions apply to the current Edge versions.
+ ```sh
+ doas apk add git curl msttcorefonts-installer python3 sqlite3 alpine-sdk cmake ffmpeg imagemagick-dev vips-dev font-noto-emoji gobject-introspection-dev cgif-dev libimagequant-dev meson
+ ```
+=== "Arch/Manjaro"
+ ```sh
+ sudo pacman -S git curl cmake pango ffmpeg npm imagemagick libvips sqlite3 libltdl noto-fonts-emoji gobject-introspection libcgif libimagequant meson
+ ```
+ You'll also need to install [`ttf-ms-win10-auto`](https://aur.archlinux.org/packages/ttf-ms-win10-auto/) from the AUR.
+
+***
+
+### 2. Install libvips.
+
+[libvips](https://github.com/libvips/libvips) is the core of esmBot's image processing commands. Version 8.13.0 or higher is recommended because it contains fixes to GIF handling and support for the freeze command; however, this version isn't packaged for most distros yet. To fix this, you'll need to build libvips from source.
+
+!!! note
+ Alpine, Arch, RHEL **(not Fedora!)**, and Ubuntu 22.10 (Kinetic Kudu) users can skip this step, since these distros now have 8.13.0 packaged.
+
+First, download the source and move into it:
+```sh
+git clone https://github.com/libvips/libvips
+cd libvips
+```
+From here, you can set up the build:
+```sh
+meson setup --prefix=/usr --buildtype=release -Dnsgif=true build
+```
+If that command finishes with no errors, you can compile and install it:
+```sh
+cd build
+meson compile
+sudo meson install
+```
+
+***
+
+### 3. Install Node.js.
+
+Node.js is the runtime that esmBot is built on top of. The bot requires version 16 or above to run.
+
+First things first, we'll need to install pnpm, the package manager used by the bot. Run the following to install it:
+```sh
+curl -fsSL https://get.pnpm.io/install.sh | sh -
+```
+
+Once you've done that, continue with the instructions for your operating system below.
+
+=== "Debian/Ubuntu"
+ You'll need a more recent version than what's provided in most Debian/Ubuntu-based distros. You can add a repository that contains a supported version by running this command:
+ ```sh
+ curl -fsSL https://deb.nodesource.com/setup_16.x | sudo bash -
+ ```
+ After that, you can install Node.js with this command:
+ ```sh
+ sudo apt-get install nodejs
+ ```
+=== "Fedora/RHEL"
+ ```sh
+ sudo dnf install nodejs
+ ```
+=== "Alpine"
+ ```sh
+ doas apk add nodejs
+ ```
+=== "Arch/Manjaro"
+ ```sh
+ sudo pacman -S nodejs
+ ```
+
+***
+
+### 4. Set up the database.
+
+esmBot officially supports two database systems: SQLite and PostgreSQL. While SQLite is smaller and requires no initial setup, PostgreSQL has better performance (especially in large environments).
+
+!!! tip
+ If you're new to databases and self-hosting, choose SQLite.
+
+If you would like to use the SQLite database, no configuration is needed and you can move on to the next step.
+
+If you would like to use the PostgreSQL database, view the setup instructions [here](https://docs.esmbot.net/postgresql) and come back here when you're finished.
+
+***
+
+### 5. Clone the repo and install the required Node modules.
+```sh
+cd ~
+git clone --recursive https://github.com/esmBot/esmBot
+cd esmBot
+pnpm i -g node-gyp
+pnpm install
+pnpm build
+```
+
+***
+
+### 6. (Optional) Set up Lavalink.
+
+Lavalink is the audio server used by esmBot for soundboard commands and music playback. If you do not plan on using these features, you can safely skip this step.
+
+!!! warning
+ There are websites out there providing lists of public Lavalink instances that can be used with the bot. However, these are not recommended due to performance/security concerns and missing features, and it is highly recommended to set one up yourself instead using the steps below.
+
+Lavalink requires a Java (11 or later) installation. You can use [SDKMAN](https://sdkman.io) to install Eclipse Temurin, a popular Java distribution:
+```sh
+sdk install java 11.0.15-tem
+```
+
+Initial setup is like this:
+```sh
+cd ~
+mkdir Lavalink
+cd Lavalink
+curl -OL https://github.com/freyacodes/Lavalink/releases/latest/download/Lavalink.jar
+cp ~/esmBot/application.yml .
+ln -s ~/esmBot/assets assets
+```
+To run Lavalink, you can use this command:
+```sh
+java -Djdk.tls.client.protocols=TLSv1.2 -jar Lavalink.jar
+```
+
+!!! info
+ You'll need to run Lavalink alongside the bot in order to use it. There are a few methods to do this, such as the `screen` command, creating a new systemd service, or simply just opening a new terminal session alongside your current one.
+
+***
+
+### 7. Configure the bot.
+
+Configuration is done via environment variables which can be specified through a `.env` file. Copy `.env.example` to get a starter config file:
+```sh
+cp .env.example .env
+```
+
+!!! tip
+ If you can't see either of these files, don't worry - Linux treats files whose names start with a . as hidden files.
+
+To edit this file in the terminal, run this command:
+```sh
+nano .env
+```
+This will launch a text editor with the file ready to go. Create a Discord application [here](https://discord.com/developers/applications) and select the Bot tab on the left, then create a bot user. Once you've done this, copy the token it gives you and put it in the `TOKEN` variable.
+
+When you're finished editing the file, press Ctrl + X, then Y and Enter.
+
+An overview of each of the variables in the `.env` file can be found [here](https://docs.esmbot.net/config).
+
+***
+
+### 8. Run the bot.
+
+Once everything else is set up, you can start the bot like so:
+```sh
+pnpm start
+```
+If the bot starts successfully, you're done! You can invite the bot to your server by generating an invite link under OAuth -> URL Generator in the Discord application dashboard.
+
+!!! note
+ You will need to select the `bot` and `applications.commands` scopes.
+ The following permissions are needed in most cases for the bot to work properly:
+
+
+
+If you want the bot to run 24/7, you can use the [PM2](https://pm2.keymetrics.io) process manager. Install it using the following command:
+```sh
+pnpm add -g pm2
+```
+
+Once you've done that, you can start the bot using the following command:
+```sh
+pm2 start ecosystem.config.cjs
+```
+
+!!! tip
+ If you wish to update the bot to the latest version/commit at any time, just run `git pull` and `pnpm install`.
+
+***
+
+## Troubleshooting
+??? faq "Error: Cannot find module './build/Release/image.node'"
+ The native image functions haven't been built. Run `pnpm run build` to build them.
+
+??? faq "`pnpm install` or `pnpm build` fails with error 'ELIFECYCLEâ Command failed.'"
+ You seem to be missing node-gyp. This can be fixed by running:
+ ```sh
+ pnpm i -g node-gyp
+ rm -rf node_modules
+ pnpm install
+ ```
+
+??? faq "Error: connect ECONNREFUSED 127.0.0.1:5432"
+ PostgreSQL isn't running, you should be able to start it with `sudo systemctl start postgresql`. If you don't intend to use PostgreSQL, you should take another look at your `DB` variable in the .env file.
+
+??? faq "Gifs from Tenor result in a "no decode delegate for this image format" or "improper image header" error"
+ Tenor GIFs are actually stored as MP4s, which libvips can't decode most of the time. You'll need to get a Tenor API key from [here](https://developers.google.com/tenor/guides/quickstart) and put it in the `TENOR` variable in .env.
+
+***
+
+If you have any further questions regarding self-hosting, feel free to ask in the #support channel on the [esmBot Support server](https://esmbot.net/support).
diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs
index bc19548..721f94b 100644
--- a/ecosystem.config.cjs
+++ b/ecosystem.config.cjs
@@ -1,10 +1,10 @@
-module.exports = {
- apps: [{
- name: "esmBot-manager",
- script: "utils/pm2/ext.js",
- autorestart: true,
- exp_backoff_restart_delay: 1000,
- watch: false,
- exec_mode: "fork"
- }]
+module.exports = {
+ apps: [{
+ name: "esmBot-manager",
+ script: "utils/pm2/ext.js",
+ autorestart: true,
+ exp_backoff_restart_delay: 1000,
+ watch: false,
+ exec_mode: "fork"
+ }]
};
\ No newline at end of file
diff --git a/events/debug.js b/events/debug.js
index aa77abb..ac9663b 100644
--- a/events/debug.js
+++ b/events/debug.js
@@ -1,5 +1,5 @@
-import { debug } from "../utils/logger.js";
-
-export default async (client, message) => {
- debug(message);
+import { debug } from "../utils/logger.js";
+
+export default async (client, message) => {
+ debug(message);
};
\ No newline at end of file
diff --git a/events/error.js b/events/error.js
index 71e1e84..91eec74 100644
--- a/events/error.js
+++ b/events/error.js
@@ -1,5 +1,5 @@
-import { error } from "../utils/logger.js";
-
-export default async (client, message) => {
- error(message);
+import { error } from "../utils/logger.js";
+
+export default async (client, message) => {
+ error(message);
};
\ No newline at end of file
diff --git a/events/guildCreate.js b/events/guildCreate.js
deleted file mode 100644
index f63ca10..0000000
--- a/events/guildCreate.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import { log } from "../utils/logger.js";
-
-// run when the bot is added to a guild
-export default async (client, guild) => {
- log(`[GUILD JOIN] ${guild.name} (${guild.id}) added the bot.`);
-};
diff --git a/events/guildDelete.js b/events/guildDelete.js
deleted file mode 100644
index 8bb2352..0000000
--- a/events/guildDelete.js
+++ /dev/null
@@ -1,6 +0,0 @@
-import { log } from "../utils/logger.js";
-
-// run when the bot is removed from a guild
-export default async (client, guild) => {
- log(`[GUILD LEAVE] ${guild.name} (${guild.id}) removed the bot.`);
-};
diff --git a/events/interactionCreate.js b/events/interactionCreate.js
deleted file mode 100644
index 845317b..0000000
--- a/events/interactionCreate.js
+++ /dev/null
@@ -1,89 +0,0 @@
-import database from "../utils/database.js";
-import * as logger from "../utils/logger.js";
-import { commands, messageCommands } from "../utils/collections.js";
-import { clean } from "../utils/misc.js";
-import { upload } from "../utils/tempimages.js";
-
-// run when a slash command is executed
-export default async (client, interaction) => {
- if (interaction?.type !== 2) return;
-
- // check if command exists and if it's enabled
- const command = interaction.data.name;
- let cmd = commands.get(command);
- if (!cmd) {
- cmd = messageCommands.get(command);
- if (!cmd) return;
- }
- if (cmd.dbRequired && !database) {
- await interaction["createMessage"]({ content: "This command is unavailable on stateless instances of esmBot.", flags: 64 });
- return;
- }
-
- const invoker = interaction.member ?? interaction.user;
-
- // actually run the command
- logger.log("log", `${invoker.username} (${invoker.id}) ran application command ${command}`);
- try {
- if (database) {
- await database.addCount(command);
- }
- // eslint-disable-next-line no-unused-vars
- const commandClass = new cmd(client, { type: "application", interaction });
- const result = await commandClass.run();
- const replyMethod = interaction.acknowledged ? "editOriginal" : "createMessage";
- if (typeof result === "string") {
- await interaction[replyMethod]({
- content: result,
- flags: commandClass.success ? 0 : 64
- });
- } else if (typeof result === "object") {
- if (result.contents && result.name) {
- const fileSize = 8388119;
- if (result.contents.length > fileSize) {
- if (process.env.TEMPDIR && process.env.TEMPDIR !== "") {
- await upload(client, result, interaction, true);
- } else {
- await interaction[replyMethod]({
- content: "The resulting image was more than 8MB in size, so I can't upload it.",
- flags: 64
- });
- }
- } else {
- await interaction[replyMethod](result.text ? result.text : { files: [result] });
- }
- } else {
- await interaction[replyMethod](Object.assign({
- flags: result.flags ?? (commandClass.success ? 0 : 64)
- }, result));
- }
- } else {
- logger.warn(`Unknown return type for command ${command}: ${result} (${typeof result})`);
- await interaction[replyMethod](Object.assign({
- flags: commandClass.success ? 0 : 64
- }, result));
- }
- } catch (error) {
- const replyMethod = interaction.acknowledged ? "editOriginal" : "createMessage";
- if (error.toString().includes("Request entity too large")) {
- await interaction[replyMethod]({ content: "The resulting file was too large to upload. Try again with a smaller image if possible.", flags: 64 });
- } else if (error.toString().includes("Job ended prematurely")) {
- await interaction[replyMethod]({ content: "Something happened to the image servers before I could receive the image. Try running your command again.", flags: 64 });
- } else {
- logger.error(`Error occurred with application command ${command} with arguments ${JSON.stringify(interaction.data.optionsArray)}: ${error.stack || error}`);
- try {
- let err = error;
- if (error?.constructor?.name == "Promise") err = await error;
- await interaction[replyMethod]({
- content: "Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: ",
- files: [{
- contents: `Message: ${clean(err)}\n\nStack Trace: ${clean(err.stack)}`,
- name: "error.txt"
- }]
- });
- } catch (e) {
- logger.error(`While attempting to send the previous error message, another error occurred: ${e.stack || e}`);
- }
- }
- }
-};
diff --git a/events/messageCreate.js b/events/messageCreate.js
deleted file mode 100644
index 614fdc9..0000000
--- a/events/messageCreate.js
+++ /dev/null
@@ -1,184 +0,0 @@
-import database from "../utils/database.js";
-import { log, error as _error } from "../utils/logger.js";
-import { prefixCache, aliases, disabledCache, disabledCmdCache, commands } from "../utils/collections.js";
-import parseCommand from "../utils/parseCommand.js";
-import { clean } from "../utils/misc.js";
-import { upload } from "../utils/tempimages.js";
-import { ThreadChannel } from "oceanic.js";
-
-let mentionRegex;
-
-// run when someone sends a message
-export default async (client, message) => {
- // ignore other bots
- if (message.author.bot) return;
-
- // don't run command if bot can't send messages
- let permChannel = message.channel;
- if (permChannel instanceof ThreadChannel && !permChannel.parent) {
- try {
- permChannel = await client.rest.channels.get(message.channel.parentID);
- } catch {
- return;
- }
- }
- if (message.guildID && !permChannel.permissionsOf(client.user.id.toString()).has("SEND_MESSAGES")) return;
-
- if (!mentionRegex) mentionRegex = new RegExp(`^<@!?${client.user.id}> `);
-
- let guildDB;
- let text;
- const mentionResult = message.content.match(mentionRegex);
- if (mentionResult) {
- text = message.content.substring(mentionResult[0].length).trim();
- } else if (message.guildID && database) {
- const cachedPrefix = prefixCache.get(message.guildID);
- if (cachedPrefix && message.content.startsWith(cachedPrefix)) {
- text = message.content.substring(cachedPrefix.length).trim();
- } else {
- guildDB = await database.getGuild(message.guildID);
- if (message.content.startsWith(guildDB.prefix)) {
- text = message.content.substring(guildDB.prefix.length).trim();
- prefixCache.set(message.guildID, guildDB.prefix);
- } else {
- return;
- }
- }
- } else if (message.content.startsWith(process.env.PREFIX)) {
- text = message.content.substring(process.env.PREFIX.length).trim();
- } else if (!message.guildID) {
- text = message.content;
- } else {
- return;
- }
-
- // separate commands and args
- const preArgs = text.split(/\s+/g);
- const command = preArgs.shift().toLowerCase();
- const aliased = aliases.get(command);
-
- // check if command exists and if it's enabled
- const cmd = commands.get(aliased ?? command);
- if (!cmd) return;
-
- // block certain commands from running in DMs
- if (!cmd.directAllowed && !message.guildID) return;
-
- if (cmd.dbRequired && !database) {
- await client.rest.channels.createMessage(message.channelID, {
- content: "This command is unavailable on stateless instances of esmBot."
- });
- return;
- }
-
- // don't run if message is in a disabled channel
- if (message.guildID && database) {
- let disabled = disabledCache.get(message.guildID);
- if (!disabled) {
- if (!guildDB) guildDB = await database.getGuild(message.guildID);
- disabledCache.set(message.guildID, guildDB.disabled);
- disabled = guildDB.disabled;
- }
- if (disabled.includes(message.channelID) && command != "channel") return;
-
- let disabledCmds = disabledCmdCache.get(message.guildID);
- if (!disabledCmds) {
- if (!guildDB) guildDB = await database.getGuild(message.guildID);
- disabledCmdCache.set(message.guildID, guildDB.disabled_commands ?? guildDB.disabledCommands);
- disabledCmds = guildDB.disabled_commands ?? guildDB.disabledCommands;
- }
- if (disabledCmds.includes(aliased ?? command)) return;
- }
-
- // actually run the command
- log("log", `${message.author.username} (${message.author.id}) ran classic command ${command}`);
- const reference = {
- messageReference: {
- channelID: message.channelID,
- messageID: message.id,
- guildID: message.guildID ?? undefined,
- failIfNotExists: false
- },
- allowedMentions: {
- repliedUser: false
- }
- };
- try {
- // parse args
- const parsed = parseCommand(preArgs);
- if (database) {
- await database.addCount(aliases.get(command) ?? command);
- }
- const startTime = new Date();
- // eslint-disable-next-line no-unused-vars
- const commandClass = new cmd(client, { type: "classic", message, args: parsed._, content: text.replace(command, "").trim(), specialArgs: (({ _, ...o }) => o)(parsed) }); // we also provide the message content as a parameter for cases where we need more accuracy
- const result = await commandClass.run();
- const endTime = new Date();
- if ((endTime - startTime) >= 180000) reference.allowedMentions.repliedUser = true;
- if (typeof result === "string") {
- reference.allowedMentions.repliedUser = true;
- await client.rest.channels.createMessage(message.channelID, Object.assign({
- content: result
- }, reference));
- } else if (typeof result === "object") {
- if (result.contents && result.name) {
- let fileSize = 8388119;
- if (message.guildID) {
- switch (message.guild.premiumTier) {
- case 2:
- fileSize = 52428308;
- break;
- case 3:
- fileSize = 104856616;
- break;
- }
- }
- if (result.contents.length > fileSize) {
- if (process.env.TEMPDIR && process.env.TEMPDIR !== "") {
- await upload(client, result, message);
- } else {
- await client.rest.channels.createMessage(message.channelID, {
- content: "The resulting image was more than 8MB in size, so I can't upload it."
- });
- }
- } else {
- await client.rest.channels.createMessage(message.channelID, Object.assign({
- content: result.text ? result.text : undefined,
- files: [result]
- }, reference));
- }
- } else {
- await client.rest.channels.createMessage(message.channelID, Object.assign(result, reference));
- }
- }
- } catch (error) {
- if (error.toString().includes("Request entity too large")) {
- await client.rest.channels.createMessage(message.channelID, Object.assign({
- content: "The resulting file was too large to upload. Try again with a smaller image if possible."
- }, reference));
- } else if (error.toString().includes("Job ended prematurely")) {
- await client.rest.channels.createMessage(message.channelID, Object.assign({
- content: "Something happened to the image servers before I could receive the image. Try running your command again."
- }, reference));
- } else if (error.toString().includes("Timed out")) {
- await client.rest.channels.createMessage(message.channelID, Object.assign({
- content: "The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size."
- }, reference));
- } else {
- _error(`Error occurred with command message ${message.content}: ${error.stack || error}`);
- try {
- let err = error;
- if (error?.constructor?.name == "Promise") err = await error;
- await client.rest.channels.createMessage(message.channelID, Object.assign({
- content: "Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: ",
- files: [{
- contents: `Message: ${clean(err)}\n\nStack Trace: ${clean(err.stack)}`,
- name: "error.txt"
- }]
- }, reference));
- } catch (e) {
- _error(`While attempting to send the previous error message, another error occurred: ${e.stack || e}`);
- }
- }
- }
-};
diff --git a/events/ready.js b/events/ready.js
index 81d2435..c9d909e 100644
--- a/events/ready.js
+++ b/events/ready.js
@@ -1,38 +1,38 @@
-import { activityChanger, checkBroadcast } from "../utils/misc.js";
-import { send } from "../utils/handler.js";
-import { generateList, createPage } from "../utils/help.js";
-import { logger } from "../utils/logger.js";
-import { readFileSync } from "fs";
-
-const { types } = JSON.parse(readFileSync(new URL("../config/commands.json", import.meta.url)));
-let ready = false;
-
-export default async (client) => {
- if (ready) return;
-
- // send slash command data
- if (types.application) {
- try {
- await send(client);
- } catch (e) {
- logger.log("error", e);
- logger.log("error", "Failed to send command data to Discord, slash/message commands may be unavailable.");
- }
- }
-
- // generate docs
- if (process.env.OUTPUT && process.env.OUTPUT !== "") {
- generateList();
- await createPage(process.env.OUTPUT);
- logger.log("info", "The help docs have been generated.");
- }
-
- await checkBroadcast(client);
- activityChanger(client);
-
- ready = true;
-
- if (process.env.PM2_USAGE) process.send("ready");
-
- logger.log("info", "Started esmBot.");
+import { activityChanger, checkBroadcast } from "../utils/misc.js";
+import { send } from "../utils/handler.js";
+import { generateList, createPage } from "../utils/help.js";
+import { logger } from "../utils/logger.js";
+import { readFileSync } from "fs";
+
+const { types } = JSON.parse(readFileSync(new URL("../config/commands.json", import.meta.url)));
+let ready = false;
+
+export default async (client) => {
+ if (ready) return;
+
+ // send slash command data
+ if (types.application) {
+ try {
+ await send(client);
+ } catch (e) {
+ logger.log("error", e);
+ logger.log("error", "Failed to send command data to Discord, slash/message commands may be unavailable.");
+ }
+ }
+
+ // generate docs
+ if (process.env.OUTPUT && process.env.OUTPUT !== "") {
+ generateList();
+ await createPage(process.env.OUTPUT);
+ logger.log("info", "The help docs have been generated.");
+ }
+
+ await checkBroadcast(client);
+ activityChanger(client);
+
+ ready = true;
+
+ if (process.env.PM2_USAGE) process.send("ready");
+
+ logger.log("info", "Started esmBot.");
};
\ No newline at end of file
diff --git a/events/roommessage.js b/events/roommessage.js
new file mode 100644
index 0000000..b90e8c9
--- /dev/null
+++ b/events/roommessage.js
@@ -0,0 +1,135 @@
+import database from "../utils/database.js";
+import { log, error as _error, logger } from "../utils/logger.js";
+import { prefixCache, aliases, disabledCache, disabledCmdCache, commands } from "../utils/collections.js";
+import parseCommand from "../utils/parseCommand.js";
+import { clean } from "../utils/misc.js";
+import sizeOf from "image-size";
+// import { upload } from "../utils/tempimages.js";
+// import { ThreadChannel } from "oceanic.js";
+
+let mentionRegex;
+
+// run when someone sends a message
+export default async function (matrixClient, event, room, toStartOfTimeline) {
+ // console.log(matrixClient)
+ if (event.getType() == "m.room.message") {
+ if (toStartOfTimeline) {
+ return; // don't act on paginated results
+ }
+ if (event.event.sender == process.env.MATRIX_USERNAME) return;
+ // console.log(event.event);
+ let text;
+ text = event.event.content.body;
+ // if a reply, strip the reply from the formatting
+ text = text.replace(/.*\n\n/g, "")
+ if (text.startsWith(process.env.PREFIX)) {
+ text = text.substring(process.env.PREFIX.length).trim();
+ } else {
+ return;
+ }
+
+ // separate commands and args
+ const preArgs = text.split(/\s+/g);
+ const command = preArgs.shift().toLowerCase();
+ const aliased = aliases.get(command);
+
+ const cmd = commands.get(aliased ?? command);
+ if (!cmd) return;
+
+ // command time :peachtime:
+ log("log", `${event.sender.name} (${event.event.sender}) ran command ${command}`);
+ const reference = {
+ messageReference: {
+ channelID: event.event.room_id,
+ messageID: event.event.event_id,
+ guildID: undefined,
+ failIfNotExists: false
+ },
+ allowedMentions: {
+ repliedUser: false
+ }
+ };
+ try {
+ // parse args
+ const parsed = parseCommand(preArgs);
+ // if (database) {
+ // await database.addCount(aliases.get(command) ?? command);
+ // }
+ const startTime = new Date();
+ // eslint-disable-next-line no-unused-vars
+ const commandClass = new cmd(matrixClient, { type: "classic", message: event.event, args: parsed._, content: text.replace(command, "").trim(), specialArgs: (({ _, ...o }) => o)(parsed) }); // we also provide the message content as a parameter for cases where we need more accuracy
+ const result = await commandClass.run();
+ const endTime = new Date();
+ if ((endTime - startTime) >= 180000) reference.allowedMentions.repliedUser = true;
+ if (typeof result === "string") {
+ const content = {
+ body: result,
+ msgtype: "m.text",
+ };
+ matrixClient.sendEvent(event.event.room_id, "m.room.message", content, "", (err, res) => {
+ console.log(err);
+ });
+ } else if (typeof result === "object") {
+ // console.log(result)
+ if (result.contents && result.name) {
+ let fileSize = 52428308;
+ if (result.contents.length > fileSize) {
+ if (process.env.TEMPDIR && process.env.TEMPDIR !== "") {
+ await upload(client, result, message);
+ } else {
+ const content = {
+ body: "imag too big :(",
+ msgtype: "m.text",
+ };
+ matrixClient.sendEvent(event.event.room_id, "m.room.message", content, "", (err, res) => {
+ console.log(err);
+ });
+ }
+ } else {
+ const mxcUri = await matrixClient.uploadContent(result.contents);
+ console.log(mxcUri.content_uri)
+ // TODO: make info object get width, height, and mime from natives so i dont need to read the buffer
+ const imgsize = sizeOf(result.contents)
+ await matrixClient.sendImageMessage(event.event.room_id, mxcUri.content_uri, {h: imgsize.height, w: imgsize.width, mimetype: `image/${imgsize.type}`, size: result.contents.length, thumbnail_info: {h: imgsize.height, w: imgsize.width, mimetype: `image/${imgsize.type}`, size: result.contents.length}}, result.name)
+ }
+ } else {
+ // await client.rest.channels.createMessage(message.channelID, Object.assign(result, reference));
+ }
+ } else {
+ console.log(typeof result)
+ }
+ } catch (error) {
+ logger.log("error", error.stack)
+ // if (error.toString().includes("Request entity too large")) {
+ // await client.rest.channels.createMessage(event.event.room_id, Object.assign({
+ // content: "The resulting file was too large to upload. Try again with a smaller image if possible."
+ // }, reference));
+ // } else if (error.toString().includes("Job ended prematurely")) {
+ // await client.rest.channels.createMessage(event.event.room_id, Object.assign({
+ // content: "Something happened to the image servers before I could receive the image. Try running your command again."
+ // }, reference));
+ // } else if (error.toString().includes("Timed out")) {
+ // await client.rest.channels.createMessage(event.event.room_id, Object.assign({
+ // content: "The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size."
+ // }, reference));
+ // } else {
+ // _error(`Error occurred with command message ${event.event.content.body}: ${error.stack || error}`);
+ // try {
+ // let err = error;
+ // if (error?.constructor?.name == "Promise") err = await error;
+ // await client.rest.channels.createMessage(event.event.room_id, Object.assign({
+ // content: "Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: ",
+ // files: [{
+ // contents: `Message: ${clean(err)}\n\nStack Trace: ${clean(err.stack)}`,
+ // name: "error.txt"
+ // }]
+ // }, reference));
+ // } catch (e) {
+ // _error(`While attempting to send the previous error message, another error occurred: ${e.stack || e}`);
+ // }
+ // }
+ }
+ return;
+ }
+ return;
+};
\ No newline at end of file
diff --git a/events/shardReady.js b/events/shardReady.js
deleted file mode 100644
index 0df70b4..0000000
--- a/events/shardReady.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { players, errHandle } from "../utils/soundplayer.js";
-
-export default async (client, id) => {
- for (const player of players.values()) {
- if (id !== player.voiceChannel.guild.shard.id) return;
- try {
- await player.player.connection.connect({
- guildId: player.voiceChannel.guildID,
- channelId: player.voiceChannel.id,
- shardId: player.voiceChannel.guild.shard.id,
- deaf: true
- });
- } catch (e) {
- errHandle(e, client, player.player, player.playingMessage, player.voiceChannel, { type: "classic" }, true);
- }
- }
-};
\ No newline at end of file
diff --git a/events/voiceChannelLeave.js b/events/voiceChannelLeave.js
deleted file mode 100644
index 00e8fdf..0000000
--- a/events/voiceChannelLeave.js
+++ /dev/null
@@ -1,115 +0,0 @@
-import { players, queues, skipVotes } from "../utils/soundplayer.js";
-import AwaitRejoin from "../utils/awaitrejoin.js";
-import { random } from "../utils/misc.js";
-import { logger } from "../utils/logger.js";
-
-const isWaiting = new Map();
-
-export default async (client, member, oldChannel) => {
- if (!oldChannel) return;
- const connection = players.get(oldChannel.guildID);
- if (oldChannel.id === connection?.voiceChannel.id) {
- if (oldChannel.voiceMembers.filter((i) => i.id !== client.user.id && !i.bot).length === 0) {
- if (isWaiting.has(oldChannel.id)) return;
- isWaiting.set(oldChannel.id, true);
- connection.player.setPaused(true);
- const waitMessage = await client.rest.channels.createMessage(connection.originalChannel.id, {
- content: "đ Waiting 10 seconds for someone to return..."
- });
- const awaitRejoin = new AwaitRejoin(oldChannel, true, member.id);
- awaitRejoin.once("end", async (rejoined, newMember, cancel) => {
- isWaiting.delete(oldChannel.id);
- if (rejoined) {
- if (cancel) return;
- connection.player.setPaused(false);
- if (member.id !== newMember.id) {
- players.set(connection.voiceChannel.guildID, { player: connection.player, type: connection.type, host: newMember.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel, loop: connection.loop, shuffle: connection.shuffle, playMessage: connection.playMessage });
- waitMessage.edit({
- content: `đ ${newMember.mention} is the new voice channel host.`
- });
- } else {
- try {
- await waitMessage.delete();
- } catch {
- logger.warn(`Failed to delete wait message ${waitMessage.id}`);
- }
- }
- } else {
- try {
- if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete();
- } catch {
- logger.warn(`Failed to delete wait message ${waitMessage.id}`);
- }
- if (cancel) return;
- try {
- connection.player.node.leaveChannel(connection.originalChannel.guildID);
- } catch {
- logger.warn(`Failed to leave voice channel ${connection.originalChannel.guildID}`);
- }
- players.delete(connection.originalChannel.guildID);
- queues.delete(connection.originalChannel.guildID);
- skipVotes.delete(connection.originalChannel.guildID);
- client.rest.channels.createMessage(connection.originalChannel.id, {
- content: `đ The voice channel session in \`${connection.voiceChannel.name}\` has ended.`
- });
- }
- });
- } else if (member.id === connection.host) {
- if (isWaiting.has(oldChannel.id)) return;
- isWaiting.set(oldChannel.id, true);
- const waitMessage = await client.rest.channels.createMessage(connection.originalChannel.id, {
- content: "đ Waiting 10 seconds for the host to return..."
- });
- const awaitRejoin = new AwaitRejoin(oldChannel, false, member.id);
- awaitRejoin.once("end", async (rejoined) => {
- isWaiting.delete(oldChannel.id);
- if (rejoined) {
- try {
- if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete();
- } catch {
- logger.warn(`Failed to delete wait message ${waitMessage.id}`);
- }
- } else {
- const members = oldChannel.voiceMembers.filter((i) => i.id !== client.user.id && !i.bot);
- if (members.length === 0) {
- try {
- if (waitMessage.channel.messages.has(waitMessage.id)) await waitMessage.delete();
- } catch {
- logger.warn(`Failed to delete wait message ${waitMessage.id}`);
- }
- try {
- connection.player.node.leaveChannel(connection.originalChannel.guildID);
- } catch {
- logger.warn(`Failed to leave voice channel ${connection.originalChannel.guildID}`);
- }
- players.delete(connection.originalChannel.guildID);
- queues.delete(connection.originalChannel.guildID);
- skipVotes.delete(connection.originalChannel.guildID);
- client.rest.channels.createMessage(connection.originalChannel.id, {
- content: `đ The voice channel session in \`${connection.voiceChannel.name}\` has ended.`
- });
- } else {
- const randomMember = random(members);
- players.set(connection.voiceChannel.guildID, { player: connection.player, type: connection.type, host: randomMember.id, voiceChannel: connection.voiceChannel, originalChannel: connection.originalChannel, loop: connection.loop, shuffle: connection.shuffle, playMessage: connection.playMessage });
- waitMessage.edit({
- content: `đ ${randomMember.mention} is the new voice channel host.`
- });
- }
- }
- });
- } else if (member.id === client.user.id) {
- isWaiting.delete(oldChannel.id);
- try {
- connection.player.node.leaveChannel(connection.originalChannel.guildID);
- } catch {
- logger.warn(`Failed to leave voice channel ${connection.originalChannel.guildID}`);
- }
- players.delete(connection.originalChannel.guildID);
- queues.delete(connection.originalChannel.guildID);
- skipVotes.delete(connection.originalChannel.guildID);
- await client.rest.channels.createMessage(connection.originalChannel.id, {
- content: `đ The voice channel session in \`${connection.voiceChannel.name}\` has ended.`
- });
- }
- }
-};
diff --git a/events/voiceChannelSwitch.js b/events/voiceChannelSwitch.js
deleted file mode 100644
index 3ab416e..0000000
--- a/events/voiceChannelSwitch.js
+++ /dev/null
@@ -1,5 +0,0 @@
-import leaveHandler from "./voiceChannelLeave.js";
-
-export default async (client, member, newChannel, oldChannel) => {
- await leaveHandler(client, member, oldChannel);
-};
\ No newline at end of file
diff --git a/events/warn.js b/events/warn.js
index ca1556e..0a467f8 100644
--- a/events/warn.js
+++ b/events/warn.js
@@ -1,5 +1,5 @@
-import { warn } from "../utils/logger.js";
-
-export default async (client, message) => {
- warn(message);
+import { warn } from "../utils/logger.js";
+
+export default async (client, message) => {
+ warn(message);
};
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
index 7f68add..28bea5e 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -1,51 +1,51 @@
-site_name: esmBot
-docs_dir: docs/
-repo_name: 'esmBot/esmBot'
-repo_url: 'https://github.com/esmBot/esmBot'
-copyright: Copyright © 2018 - 2023 Essem
-nav:
- - Home: index.md
- - setup.md
- - config.md
- - custom-commands.md
- - docker.md
- - postgresql.md
-markdown_extensions:
- - def_list
- - attr_list
- - pymdownx.tasklist:
- custom_checkbox: true
- - admonition
- - pymdownx.details
- - pymdownx.superfences
- - pymdownx.tabbed:
- alternate_style: true
-theme:
- name: 'material'
- features:
- - toc.integrate
- - content.tabs.link
- logo: assets/esmbot.png
- favicon: assets/esmbot.png
- palette:
- - media: "(prefers-color-scheme: light)"
- scheme: default
- toggle:
- icon: material/weather-night
- name: Switch to dark mode
- - media: "(prefers-color-scheme: dark)"
- scheme: slate
- toggle:
- icon: material/weather-sunny
- name: Switch to light mode
-plugins:
- - glightbox
- - git-revision-date-localized
-extra:
- social:
- - icon: fontawesome/brands/mastodon
- link: https://wetdry.world/@esmBot
- - icon: fontawesome/brands/github
- link: https://github.com/esmBot
- - icon: fontawesome/brands/patreon
+site_name: esmBot
+docs_dir: docs/
+repo_name: 'esmBot/esmBot'
+repo_url: 'https://github.com/esmBot/esmBot'
+copyright: Copyright © 2018 - 2023 Essem
+nav:
+ - Home: index.md
+ - setup.md
+ - config.md
+ - custom-commands.md
+ - docker.md
+ - postgresql.md
+markdown_extensions:
+ - def_list
+ - attr_list
+ - pymdownx.tasklist:
+ custom_checkbox: true
+ - admonition
+ - pymdownx.details
+ - pymdownx.superfences
+ - pymdownx.tabbed:
+ alternate_style: true
+theme:
+ name: 'material'
+ features:
+ - toc.integrate
+ - content.tabs.link
+ logo: assets/esmbot.png
+ favicon: assets/esmbot.png
+ palette:
+ - media: "(prefers-color-scheme: light)"
+ scheme: default
+ toggle:
+ icon: material/weather-night
+ name: Switch to dark mode
+ - media: "(prefers-color-scheme: dark)"
+ scheme: slate
+ toggle:
+ icon: material/weather-sunny
+ name: Switch to light mode
+plugins:
+ - glightbox
+ - git-revision-date-localized
+extra:
+ social:
+ - icon: fontawesome/brands/mastodon
+ link: https://wetdry.world/@esmBot
+ - icon: fontawesome/brands/github
+ link: https://github.com/esmBot
+ - icon: fontawesome/brands/patreon
link: https://patreon.com/TheEssem
\ No newline at end of file
diff --git a/natives/blur.cc b/natives/blur.cc
index 5347f8e..3d19460 100644
--- a/natives/blur.cc
+++ b/natives/blur.cc
@@ -1,31 +1,31 @@
-#include