diff --git a/.github/workflows/pr-request.yml b/.github/workflows/pr-request.yml index 6e9e426..0d6e9bc 100644 --- a/.github/workflows/pr-request.yml +++ b/.github/workflows/pr-request.yml @@ -35,8 +35,5 @@ jobs: - name: Install dependencies run: pnpm install - - name: Format Check - run: pnpm run format:check - - - name: Lint Check - run: pnpm run lint + - name: Lint/Format Check + run: pnpm run check diff --git a/.husky/pre-commit b/.husky/pre-commit index aa4778c..6c60fd7 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1 @@ -pnpm run format:check -pnpm run lint +pnpm run check diff --git a/.lintstagedrc b/.lintstagedrc deleted file mode 100644 index b603750..0000000 --- a/.lintstagedrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "**/*.{ts,js}": ["eslint", "prettier --check"] -} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index c9114a6..0000000 --- a/.prettierignore +++ /dev/null @@ -1,8 +0,0 @@ -pnpm-lock.yaml -package-lock.json -bun.lockb -yarn.lock -node_modules/ -dist/ -tmp/ -.vscode/extensions.json diff --git a/.prettierrc.mjs b/.prettierrc.mjs deleted file mode 100644 index 53556f9..0000000 --- a/.prettierrc.mjs +++ /dev/null @@ -1,28 +0,0 @@ -/** @type {import("prettier").Config} */ -export default { - printWidth: 100, - semi: true, - singleQuote: false, - jsxSingleQuote: false, - quoteProps: "consistent", - tabWidth: 2, - trailingComma: "all", - bracketSpacing: true, - bracketSameLine: false, - rangeStart: 0, - useTabs: false, - endOfLine: "lf", - proseWrap: "preserve", - vueIndentScriptAndStyle: false, - embeddedLanguageFormatting: "auto", - singleAttributePerLine: false, - arrowParens: "always", - overrides: [ - { - files: ["*.json", "*.md", "*.toml", "*.yml"], - options: { - useTabs: false, - }, - }, - ], -}; diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 7efca3f..118580c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,6 @@ { "recommendations": [ "dbaeumer.vscode-eslint", - "esbenp.prettier-vscode" + "biomejs.biome" ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index a77b2b4..a32348d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,9 +10,8 @@ "editor.codeActionsOnSave": { "source.organizeImports": "explicit" }, - "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.defaultFormatter": "biomejs.biome", "editor.formatOnSave": true, - "eslint.validate": ["javascript", "typescript"], "javascript.format.insertSpaceBeforeFunctionParenthesis": false, "typescript.format.insertSpaceBeforeFunctionParenthesis": false, "javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false, @@ -20,6 +19,6 @@ "editor.insertSpaces": false, "editor.detectIndentation": false, "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "biomejs.biome" } } diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..28dad55 --- /dev/null +++ b/biome.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.7.3/schema.json", + "formatter": { + "enabled": true, + "formatWithErrors": false, + "indentStyle": "space", + "indentWidth": 2, + "lineEnding": "lf", + "lineWidth": 100, + "attributePosition": "auto", + "ignore": [ + "**/pnpm-lock.yaml", + "**/package-lock.json", + "**/bun.lockb", + "**/yarn.lock", + "**/node_modules/", + "**/dist/", + "**/tmp/", + ".vscode/extensions.json" + ] + }, + "organizeImports": { "enabled": true }, + "linter": { + "enabled": true, + "rules": { "recommended": false, "style": { "useBlockStatements": "off" } } + }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingComma": "all", + "semicolons": "always", + "arrowParentheses": "always", + "bracketSpacing": true, + "bracketSameLine": false, + "quoteStyle": "double", + "attributePosition": "auto" + } + }, + "overrides": [ + { + "include": ["*.json", "*.md", "*.toml", "*.yml"], + "formatter": { "indentStyle": "space" } + } + ] +} diff --git a/eslint.config.mjs b/eslint.config.mjs deleted file mode 100644 index 4371da5..0000000 --- a/eslint.config.mjs +++ /dev/null @@ -1,405 +0,0 @@ -import eslintConfigPrettier from "eslint-config-prettier"; -import functional from "eslint-plugin-functional"; -import imprt from "eslint-plugin-import"; -import pluginN from "eslint-plugin-n"; -import pluginPromise from "eslint-plugin-promise"; - -export default [ - eslintConfigPrettier, - { - files: ["**/*.{ts,js}"], - plugins: { - functional, - n: pluginN, - import: imprt, - promise: pluginPromise, - }, - languageOptions: { - ecmaVersion: "latest", - parserOptions: { - ecmaFeatures: { modules: true, jsx: true }, - ecmaVersion: "latest", - }, - globals: { - ...{ - __dirname: false, - __filename: false, - AbortController: false, - AbortSignal: false, - atob: false, - Blob: false, - BroadcastChannel: false, - btoa: false, - Buffer: false, - ByteLengthQueuingStrategy: false, - clearImmediate: false, - clearInterval: false, - clearTimeout: false, - CompressionStream: false, - console: false, - CountQueuingStrategy: false, - crypto: false, - Crypto: false, - CryptoKey: false, - CustomEvent: false, - DecompressionStream: false, - DOMException: false, - Event: false, - EventTarget: false, - exports: true, - fetch: false, - File: false, - FormData: false, - global: false, - Headers: false, - Iterator: false, - MessageChannel: false, - MessageEvent: false, - MessagePort: false, - module: false, - navigator: false, - Navigator: false, - performance: false, - Performance: false, - PerformanceEntry: false, - PerformanceMark: false, - PerformanceMeasure: false, - PerformanceObserver: false, - PerformanceObserverEntryList: false, - PerformanceResourceTiming: false, - process: false, - queueMicrotask: false, - ReadableByteStreamController: false, - ReadableStream: false, - ReadableStreamBYOBReader: false, - ReadableStreamBYOBRequest: false, - ReadableStreamDefaultController: false, - ReadableStreamDefaultReader: false, - Request: false, - require: false, - Response: false, - setImmediate: false, - setInterval: false, - setTimeout: false, - structuredClone: false, - SubtleCrypto: false, - TextDecoder: false, - TextDecoderStream: false, - TextEncoder: false, - TextEncoderStream: false, - TransformStream: false, - TransformStreamDefaultController: false, - URL: false, - URLSearchParams: false, - WebAssembly: false, - WebSocket: false, - WritableStream: false, - WritableStreamDefaultController: false, - WritableStreamDefaultWriter: false, - }, - ...{ - AggregateError: false, - Array: false, - ArrayBuffer: false, - Atomics: false, - BigInt: false, - BigInt64Array: false, - BigUint64Array: false, - Boolean: false, - DataView: false, - Date: false, - decodeURI: false, - decodeURIComponent: false, - encodeURI: false, - encodeURIComponent: false, - Error: false, - escape: false, - eval: false, - EvalError: false, - FinalizationRegistry: false, - Float32Array: false, - Float64Array: false, - Function: false, - globalThis: false, - Infinity: false, - Int16Array: false, - Int32Array: false, - Int8Array: false, - Intl: false, - isFinite: false, - isNaN: false, - JSON: false, - Map: false, - Math: false, - NaN: false, - Number: false, - Object: false, - parseFloat: false, - parseInt: false, - Promise: false, - Proxy: false, - RangeError: false, - ReferenceError: false, - Reflect: false, - RegExp: false, - Set: false, - SharedArrayBuffer: false, - String: false, - Symbol: false, - SyntaxError: false, - TypeError: false, - Uint16Array: false, - Uint32Array: false, - Uint8Array: false, - Uint8ClampedArray: false, - undefined: false, - unescape: false, - URIError: false, - WeakMap: false, - WeakRef: false, - WeakSet: false, - }, - }, - }, - rules: { - "eol-last": "error", - "quotes": "off", - "semi": "off", - "no-constant-binary-expression": "warn", - "no-var": "warn", - "no-new": "error", - "no-eval": "error", - "no-void": "error", - "no-tabs": "error", - "no-with": "error", - "no-undef": "error", - "no-octal": "error", - "no-proto": "error", - "no-caller": "error", - "no-console": "off", - "no-iterator": "error", - "no-debugger": "warn", - "no-new-func": "error", - "quote-props": ["error", "consistent"], - "no-dupe-keys": "error", - "no-obj-calls": "error", - "no-new-object": "error", - "no-multi-str": "error", - "no-sequences": "error", - "no-ex-assign": "error", - "no-dupe-args": "error", - "no-sequences": "warn", - "no-delete-var": "error", - "no-undef-init": "error", - "no-extra-bind": "error", - "no-new-symbol": "error", - "no-fallthrough": "error", - "no-unreachable": "error", - "no-func-assign": "error", - "no-cond-assign": "error", - "no-const-assign": "error", - "no-implied-eval": "error", - "no-octal-escape": "error", - "no-class-assign": "error", - "no-new-wrappers": "error", - "no-useless-call": "error", - "no-multi-spaces": "error", - "no-self-compare": "error", - "space-infix-ops": "error", - "no-regex-spaces": "error", - "no-import-assign": "error", - "no-global-assign": "error", - "no-sparse-arrays": "error", - "no-throw-literal": "error", - "no-control-regex": "error", - "no-useless-catch": "error", - "no-extend-native": "error", - "no-empty-pattern": "error", - "no-import-assign": "warn", - "no-extend-native": "warn", - "no-unsafe-finally": "error", - "no-invalid-regexp": "error", - "no-useless-escape": "error", - "no-useless-rename": "error", - "no-useless-return": "error", - "no-duplicate-case": "error", - "symbol-description": "error", - "no-trailing-spaces": "error", - "no-unsafe-negation": "error", - "no-compare-neg-zero": "error", - "no-unreachable-loop": "error", - "no-case-declarations": "warn", - "no-array-constructor": "error", - "no-this-before-super": "error", - "no-loss-of-precision": "error", - "no-prototype-builtins": "error", - "no-extra-boolean-cast": "error", - "no-dupe-class-members": "error", - "no-prototype-builtins": "warn", - "no-unused-expressions": "warn", - "no-useless-constructor": "error", - "no-unexpected-multiline": "error", - "no-irregular-whitespace": "error", - "no-useless-computed-key": "error", - "no-irregular-whitespace": "error", - "no-useless-backreference": "error", - "no-mixed-spaces-and-tabs": "error", - "no-async-promise-executor": "off", - "no-empty-character-class": "error", - "no-shadow-restricted-names": "error", - "no-template-curly-in-string": "error", - "no-unmodified-loop-condition": "error", - "prefer-promise-reject-errors": "error", - "no-misleading-character-class": "error", - "no-whitespace-before-property": "error", - "yoda": ["error", "never"], - "unicode-bom": ["error", "never"], - "space-in-parens": ["error", "never"], - "yield-star-spacing": ["error", "both"], - "no-extra-parens": ["error", "functions"], - "rest-spread-spacing": ["error", "never"], - "space-before-blocks": ["error", "always"], - "template-tag-spacing": ["error", "never"], - "object-curly-spacing": ["error", "always"], - "template-curly-spacing": ["error", "never"], - "space-before-function-paren": ["error", "always"], - "no-return-assign": ["error", "except-parens"], - "no-self-assign": ["error", { props: true }], - "one-var": ["error", { initialized: "never" }], - "no-empty": ["error", { allowEmptyCatch: true }], - "prefer-const": ["error", { destructuring: "all" }], - "no-redeclare": ["error", { builtinGlobals: false }], - "semi-spacing": ["error", { before: false, after: true }], - "no-constant-condition": ["error", { checkLoops: false }], - "valid-typeof": ["error", { requireStringLiterals: true }], - "space-unary-ops": ["error", { words: true, nonwords: false }], - "no-unneeded-ternary": ["error", { defaultAssignment: false }], - "no-labels": ["error", { allowLoop: false, allowSwitch: false }], - "wrap-iife": ["error", "any", { functionPrototypeMethods: true }], - "no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }], - "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }], - "object-curly-newline": ["error", { multiline: true, consistent: true }], - "object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }], - "padded-blocks": ["error", { blocks: "never", switches: "never", classes: "never" }], - "no-use-before-define": ["error", { functions: false, classes: false, variables: false }], - "use-isnan": [ - "error", - { - enforceForSwitchCase: true, - enforceForIndexOf: true, - }, - ], - "operator-linebreak": [ - "error", - "after", - { overrides: { "?": "before", ":": "before", "|>": "before" } }, - ], - "spaced-comment": [ - "error", - "always", - { - line: { markers: ["*package", "!", "/", ",", "="] }, - block: { - balanced: true, - markers: ["*package", "!", ",", ":", "::", "flow-include"], - exceptions: ["*"], - }, - }, - ], - "no-unused-expressions": [ - "error", - { - allowShortCircuit: true, - allowTernary: true, - allowTaggedTemplates: true, - }, - ], - "no-unused-vars": [ - "error", - { - args: "none", - caughtErrors: "none", - ignoreRestSiblings: true, - vars: "all", - }, - ], - "no-mixed-operators": [ - "error", - { - groups: [ - ["==", "!=", "===", "!==", ">", ">=", "<", "<="], - ["&&", "||"], - ["in", "instanceof"], - ], - allowSamePrecedence: true, - }, - ], - "no-floating-decimal": "error", - "no-lone-blocks": "error", - "space-before-function-paren": "off", - "no-unused-vars": "warn", - "object-shorthand": ["warn", "properties"], - "object-curly-newline": [ - "warn", - { - consistent: true, - multiline: true, - }, - ], - "object-curly-spacing": ["warn", "always"], - "array-element-newline": ["warn", "consistent"], - "array-bracket-newline": ["warn", "consistent"], - "accessor-pairs": ["error", { setWithoutGet: true, enforceForClassMembers: true }], - "arrow-spacing": ["error", { before: true, after: true }], - "array-bracket-spacing": ["error", "never"], - "array-callback-return": [ - "error", - { - allowImplicit: false, - checkForEach: false, - }, - ], - "block-spacing": ["error", "always"], - "brace-style": ["error", "1tbs", { allowSingleLine: true }], - "camelcase": [ - "error", - { - allow: ["^UNSAFE_"], - properties: "never", - ignoreGlobals: true, - }, - ], - "comma-spacing": ["error", { before: false, after: true }], - "comma-style": ["error", "last"], - "computed-property-spacing": ["error", "never", { enforceForClassMembers: true }], - "constructor-super": "error", - "curly": ["error", "multi-line"], - "default-case-last": "error", - "dot-location": ["error", "property"], - "dot-notation": ["error", { allowKeywords: true }], - "eqeqeq": ["error", "always", { null: "ignore" }], - "func-call-spacing": ["error", "never"], - "generator-star-spacing": ["error", { before: true, after: true }], - "key-spacing": ["error", { beforeColon: false, afterColon: true }], - "keyword-spacing": ["error", { before: true, after: true }], - "lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }], - "multiline-ternary": ["error", "always-multiline"], - "new-cap": ["error", { newIsCap: true, capIsNew: false, properties: true }], - "new-parens": "error", - "import/export": "error", - "import/first": "error", - "import/no-absolute-path": ["error", { esmodule: true, commonjs: true, amd: false }], - "import/no-duplicates": "error", - "import/no-named-default": "error", - "import/no-webpack-loader-syntax": "error", - "n/handle-callback-err": ["error", "^(err|error)$"], - "n/no-callback-literal": "error", - "n/no-deprecated-api": "error", - "n/no-exports-assign": "error", - "n/no-new-require": "error", - "n/no-path-concat": "error", - "n/process-exit-as-throw": "error", - "promise/param-names": "error", - }, - }, -]; diff --git a/hedystia.js b/hedystia.js index 5fe241f..4049f15 100644 --- a/hedystia.js +++ b/hedystia.js @@ -57,7 +57,9 @@ module.exports = async (hedystia, m) => { }); const lang = JSON.parse( - `${JSON.stringify(hedystia.langs[globalThis.db.config.select("lang", { id: "lang" })[0].value])}` + `${JSON.stringify( + hedystia.langs[globalThis.db.config.select("lang", { id: "lang" })[0].value], + )}` .replace("{0}", categories.menus) .replace("{1}", categories.images) .replace("{2}", categories.info) diff --git a/index.js b/index.js index 227e348..4aac133 100644 --- a/index.js +++ b/index.js @@ -248,7 +248,9 @@ try { for (const i of kon) { list.push({ displayName: await hedystia.getName(`${i}@s.whatsapp.net`), - vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await hedystia.getName(`${i}@s.whatsapp.net`)}\nFN:${await hedystia.getName( + vcard: `BEGIN:VCARD\nVERSION:3.0\nN:${await hedystia.getName( + `${i}@s.whatsapp.net`, + )}\nFN:${await hedystia.getName( `${i}@s.whatsapp.net`, )}\nitem1.TEL;waid=${i}:${i}\nitem1.X-ABLabel:Ponsel\nitem2.EMAIL;type=INTERNET:contact@hedystia.com\nitem2.X-ABLabel:Email\nEND:VCARD`, }); diff --git a/package.json b/package.json index 7b011bd..eeadf95 100644 --- a/package.json +++ b/package.json @@ -7,21 +7,16 @@ "scripts": { "start": "node index.js", "dev": "nodemon index.js", - "lint": "eslint . -c eslint.config.mjs", - "lint:fix": "eslint . --fix -c eslint.config.mjs", - "format": "prettier --write .", - "format:check": "prettier --check .", + "check": "biome ci .", + "lint": "biome lint --apply .", + "format": "biome format --write .", "prepare:git": "husky" }, - "keywords": [ - "baileys", - "hedystia", - "whatsapp" - ], + "keywords": ["baileys", "hedystia", "whatsapp"], "author": "contact@hedystia.com", "license": "ISC", "dependencies": { - "@hedystia/db": "^1.5.0", + "@hedystia/db": "^1.6.0", "awesome-phonenumber": "2.68.0", "baileys": "6.7.2", "file-type": "16.5.3", @@ -37,16 +32,10 @@ "ytdl-core": "^4.11.5" }, "devDependencies": { + "@biomejs/biome": "1.7.3", "@types/jsonwebtoken": "^9.0.6", "@types/node": "^20.12.10", - "eslint": "9.1.1", - "eslint-config-prettier": "9.1.0", - "eslint-plugin-functional": "6.5.1", - "eslint-plugin-import": "2.29.1", - "eslint-plugin-n": "^17.4.0", - "eslint-plugin-promise": "^6.1.1", - "husky": "9.0.11", - "prettier": "3.2.5" + "husky": "9.0.11" }, "directories": { "src": "src" diff --git a/src/commands/images/3000years.js b/src/commands/images/3000years.js index 7baf1eb..3fc5a53 100644 --- a/src/commands/images/3000years.js +++ b/src/commands/images/3000years.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/3000-years?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/3000-years?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/ad.js b/src/commands/images/ad.js index 041251e..e609801 100644 --- a/src/commands/images/ad.js +++ b/src/commands/images/ad.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/ad?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/ad?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/affect.js b/src/commands/images/affect.js index fcc8800..ed99569 100644 --- a/src/commands/images/affect.js +++ b/src/commands/images/affect.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/affect?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/affect?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/approved.js b/src/commands/images/approved.js index 4bc2771..3a77077 100644 --- a/src/commands/images/approved.js +++ b/src/commands/images/approved.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/overlays/approved?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/overlays/approved?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/batslap.js b/src/commands/images/batslap.js index 440c3d7..08305a3 100644 --- a/src/commands/images/batslap.js +++ b/src/commands/images/batslap.js @@ -14,7 +14,21 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/batslap?image1=${encodeURIComponent(await bot.profilePictureUrl(message.sender ?? message.quoted.sender).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}&image2=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}`, + `https://strangeapi.hostz.me/api/generators/batslap?image1=${encodeURIComponent( + await bot + .profilePictureUrl(message.sender ?? message.quoted.sender) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}&image2=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/beautiful.js b/src/commands/images/beautiful.js index 78038e7..575222b 100644 --- a/src/commands/images/beautiful.js +++ b/src/commands/images/beautiful.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/beautiful?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/beautiful?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/bed.js b/src/commands/images/bed.js index 227bf2d..ca71adf 100644 --- a/src/commands/images/bed.js +++ b/src/commands/images/bed.js @@ -14,7 +14,21 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/bed?image1=${encodeURIComponent(await bot.profilePictureUrl(message.sender ?? message.quoted.sender).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}&image2=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}`, + `https://strangeapi.hostz.me/api/generators/bed?image1=${encodeURIComponent( + await bot + .profilePictureUrl(message.sender ?? message.quoted.sender) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}&image2=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/blur.js b/src/commands/images/blur.js index 664da75..d657de7 100644 --- a/src/commands/images/blur.js +++ b/src/commands/images/blur.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/filters/blur?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/filters/blur?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/bobross.js b/src/commands/images/bobross.js index 45887d2..797ef5a 100644 --- a/src/commands/images/bobross.js +++ b/src/commands/images/bobross.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/bobross?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/bobross?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/circle.js b/src/commands/images/circle.js index 070c6f0..00dff28 100644 --- a/src/commands/images/circle.js +++ b/src/commands/images/circle.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/utils/circle?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/utils/circle?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/clown.js b/src/commands/images/clown.js index 9f40754..d7eda95 100644 --- a/src/commands/images/clown.js +++ b/src/commands/images/clown.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/clown?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/clown?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/delete.js b/src/commands/images/delete.js index cc17ed7..d498e62 100644 --- a/src/commands/images/delete.js +++ b/src/commands/images/delete.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/delete?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/delete?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/dexter.js b/src/commands/images/dexter.js index dc21abe..c2a2859 100644 --- a/src/commands/images/dexter.js +++ b/src/commands/images/dexter.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/dexter?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/dexter?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/facepalm.js b/src/commands/images/facepalm.js index 2ee299c..a72ca09 100644 --- a/src/commands/images/facepalm.js +++ b/src/commands/images/facepalm.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/facepalm?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/facepalm?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/invert.js b/src/commands/images/invert.js index e1b5632..348d927 100644 --- a/src/commands/images/invert.js +++ b/src/commands/images/invert.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/filters/invert?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/filters/invert?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/rejected.js b/src/commands/images/rejected.js index 682bf8b..c22a206 100644 --- a/src/commands/images/rejected.js +++ b/src/commands/images/rejected.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/overlays/rejected?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/overlays/rejected?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/wanted.js b/src/commands/images/wanted.js index f0b64a5..46609fc 100644 --- a/src/commands/images/wanted.js +++ b/src/commands/images/wanted.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/generators/wanted?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/generators/wanted?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/images/wasted.js b/src/commands/images/wasted.js index 7475be9..878ca3b 100644 --- a/src/commands/images/wasted.js +++ b/src/commands/images/wasted.js @@ -14,7 +14,14 @@ module.exports = { ? bot.user.jid : message.sender; const response = await fetch( - `https://strangeapi.hostz.me/api/overlays/wasted?image=${encodeURIComponent(await bot.profilePictureUrl(user).catch(() => "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png"))}}`, + `https://strangeapi.hostz.me/api/overlays/wasted?image=${encodeURIComponent( + await bot + .profilePictureUrl(user) + .catch( + () => + "https://w7.pngwing.com/pngs/717/24/png-transparent-computer-icons-user-profile-user-account-avatar-heroes-silhouette-black-thumbnail.png", + ), + )}}`, { headers: { Authorization: `Bearer ${global.imageToken}`, diff --git a/src/commands/interaction/feed.js b/src/commands/interaction/feed.js index afd099f..0293be9 100644 --- a/src/commands/interaction/feed.js +++ b/src/commands/interaction/feed.js @@ -16,7 +16,9 @@ module.exports = { const stiker = await sticker( null, image, - `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.feed} ${bot.getName(args[0].replace("@", ""))}`, + `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.feed} ${bot.getName( + args[0].replace("@", ""), + )}`, ); bot.sendFile(message.chat, stiker, null, { asSticker: true }); }, diff --git a/src/commands/interaction/hug.js b/src/commands/interaction/hug.js index 59effa7..842c21e 100644 --- a/src/commands/interaction/hug.js +++ b/src/commands/interaction/hug.js @@ -16,7 +16,9 @@ module.exports = { const stiker = await sticker( null, image, - `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.hug} ${bot.getName(args[0].replace("@", ""))}`, + `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.hug} ${bot.getName( + args[0].replace("@", ""), + )}`, ); bot.sendFile(message.chat, stiker, null, { asSticker: true }); }, diff --git a/src/commands/interaction/kiss.js b/src/commands/interaction/kiss.js index e790869..17f5dd6 100644 --- a/src/commands/interaction/kiss.js +++ b/src/commands/interaction/kiss.js @@ -16,7 +16,9 @@ module.exports = { const stiker = await sticker( null, image, - `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.kiss} ${bot.getName(args[0].replace("@", ""))}`, + `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.kiss} ${bot.getName( + args[0].replace("@", ""), + )}`, ); bot.sendFile(message.chat, stiker, null, { asSticker: true }); }, diff --git a/src/commands/interaction/pat.js b/src/commands/interaction/pat.js index 33d30ea..e1ed223 100644 --- a/src/commands/interaction/pat.js +++ b/src/commands/interaction/pat.js @@ -16,7 +16,9 @@ module.exports = { const stiker = await sticker( null, image, - `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.pat} ${bot.getName(args[0].replace("@", ""))}`, + `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.pat} ${bot.getName( + args[0].replace("@", ""), + )}`, ); bot.sendFile(message.chat, stiker, null, { asSticker: true }); }, diff --git a/src/commands/interaction/slap.js b/src/commands/interaction/slap.js index 616e136..7593269 100644 --- a/src/commands/interaction/slap.js +++ b/src/commands/interaction/slap.js @@ -16,7 +16,9 @@ module.exports = { const stiker = await sticker( null, image, - `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.slap} ${bot.getName(args[0].replace("@", ""))}`, + `${bot.getName(sender.replace("@s.whatsapp.net", ""))} ${lang.interaction.slap} ${bot.getName( + args[0].replace("@", ""), + )}`, ); bot.sendFile(message.chat, stiker, null, { asSticker: true }); }, diff --git a/src/lib/exif.js b/src/lib/exif.js index 0c6836a..3f93f81 100644 --- a/src/lib/exif.js +++ b/src/lib/exif.js @@ -98,7 +98,7 @@ async function writeExifImg(media, metadata) { "sticker-pack-id": "https://github.com/Zastinian/HedystiaMD", "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, - "emojis": metadata.categories ? metadata.categories : [""], + emojis: metadata.categories ? metadata.categories : [""], }; const exifAttr = Buffer.from([ 0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, @@ -133,7 +133,7 @@ async function writeExifVid(media, metadata) { "sticker-pack-id": "https://github.com/Zastinian/HedystiaMD", "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, - "emojis": metadata.categories ? metadata.categories : [""], + emojis: metadata.categories ? metadata.categories : [""], }; const exifAttr = Buffer.from([ 0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, @@ -174,7 +174,7 @@ async function writeExif(media, metadata) { "sticker-pack-id": "https://github.com/Zastinian/HedystiaMD", "sticker-pack-name": metadata.packname, "sticker-pack-publisher": metadata.author, - "emojis": metadata.categories ? metadata.categories : [""], + emojis: metadata.categories ? metadata.categories : [""], }; const exifAttr = Buffer.from([ 0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x57, 0x07, 0x00, 0x00, diff --git a/src/lib/myfunc.js b/src/lib/myfunc.js index a33b3e7..c924384 100644 --- a/src/lib/myfunc.js +++ b/src/lib/myfunc.js @@ -25,7 +25,7 @@ exports.getRandom = (ext) => { exports.getBuffer = async (url, options = {}) => { try { const headers = { - "DNT": 1, + DNT: 1, "Upgrade-Insecure-Request": 1, }; diff --git a/src/lib/sticker.js b/src/lib/sticker.js index 784f512..026b0f6 100644 --- a/src/lib/sticker.js +++ b/src/lib/sticker.js @@ -217,7 +217,7 @@ async function addExif(webpSticker, packname, author, categories = [""], extra = "sticker-pack-id": stickerPackId, "sticker-pack-name": packname, "sticker-pack-publisher": author, - "emojis": categories, + emojis: categories, ...extra, }; const exifAttr = Buffer.from([ diff --git a/src/util/memes.js b/src/util/memes.js index 99cb64e..71cd933 100644 --- a/src/util/memes.js +++ b/src/util/memes.js @@ -9,7 +9,7 @@ module.exports = async ({ locale, customSubredditName }) => { headers: { "Content-Type": "application/json", "User-Agent": "https://github.com/Zastinian/HedystiaMD", - "Authorization": "Hedystia", + Authorization: "Hedystia", }, }, );