From 69e2aa42e2a7c053793c5fff3e4a44cbf88745e6 Mon Sep 17 00:00:00 2001 From: zachey <63107653+zachey01@users.noreply.github.com> Date: Sat, 4 May 2024 21:04:51 +0500 Subject: [PATCH] Big update --- .env.example | 1 - .gitignore | 3 +-- .npmrc | 1 + bot.js | 7 ++----- commands/nswf/hentai-img.js | 15 +++++++-------- commands/nswf/trap-img.js | 15 +++++++++------ commands/nswf/yaoi-img.js | 14 +++++++++----- commands/other/start.js | 0 package.json | 20 +++++--------------- 9 files changed, 34 insertions(+), 42 deletions(-) create mode 100644 .npmrc delete mode 100644 commands/other/start.js diff --git a/.env.example b/.env.example index ef87480..154985d 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1 @@ TELEGTAM_TOKEN= -NIGHT_API_TOKEN= \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4d53a27..6fe20f0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ node_modules .env -package-lock.json -test.js \ No newline at end of file +package-lock.json \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..9cf9495 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/bot.js b/bot.js index 80d396e..5cdeeb2 100644 --- a/bot.js +++ b/bot.js @@ -1,15 +1,12 @@ const { Telegraf } = require("telegraf"); -const { Keyboard } = require("telegram-keyboard"); -const axios = require("axios"); const bot = new Telegraf(process.env.TELEGTAM_TOKEN); -// Require сommands + let nswfYaoiImg = require("./commands/nswf/yaoi-img"); let nswfTrapImg = require("./commands/nswf/trap-img"); let nswfHentaiImg = require("./commands/nswf/hentai-img"); let startBtn = require("./handlers/buttons/start-btn"); let nswfImagesBtn = require("./handlers/buttons/nswfImages-btn"); -// Сommands bot.start(startBtn); bot.command("back", startBtn); bot.command("yaoi_img", nswfYaoiImg); @@ -17,5 +14,5 @@ bot.command("trap_img", nswfTrapImg); bot.command("hentai_img", nswfHentaiImg); bot.command("images", nswfImagesBtn); bot.command("videos", (ctx) => ctx.reply("coming soon...")); -// Launch + bot.launch(); diff --git a/commands/nswf/hentai-img.js b/commands/nswf/hentai-img.js index 527ac2e..8f883f3 100644 --- a/commands/nswf/hentai-img.js +++ b/commands/nswf/hentai-img.js @@ -1,13 +1,12 @@ -const axios = require("axios"); +const nswfparse = require("nswfparse"); module.exports = async (ctx) => { - axios - .get("https://api.night-api.com/images/nsfw/hentai", { - headers: { - authorization: process.env.NIGHT_API_TOKEN, - }, + nswfparse.reddit.hentai + .hentai() + .then((payload) => { + return ctx.replyWithPhoto(payload.url); }) - .then(function (response) { - return ctx.replyWithPhoto(response.data.content.url); + .catch((error) => { + console.error(error); }); }; diff --git a/commands/nswf/trap-img.js b/commands/nswf/trap-img.js index 48673bd..295e22d 100644 --- a/commands/nswf/trap-img.js +++ b/commands/nswf/trap-img.js @@ -1,9 +1,12 @@ -const { Telegraf } = require("telegraf"); -const { message } = require("telegraf/filters"); -const axios = require("axios"); +const nswfparse = require("nswfparse"); module.exports = async (ctx) => { - axios.get("https://api.waifu.pics/nsfw/trap", {}).then(function (response) { - return ctx.replyWithPhoto(response.data.url); - }); + nswfparse.reddit.hentai + .femboy() + .then((payload) => { + return ctx.replyWithPhoto(payload.url); + }) + .catch((error) => { + console.error(error); + }); }; diff --git a/commands/nswf/yaoi-img.js b/commands/nswf/yaoi-img.js index fcdea22..b9bf28c 100644 --- a/commands/nswf/yaoi-img.js +++ b/commands/nswf/yaoi-img.js @@ -1,8 +1,12 @@ -const { Telegraf } = require("telegraf"); -const { message } = require("telegraf/filters"); -const r34API = require("r34.api"); +const nswfparse = require("nswfparse"); module.exports = async (ctx) => { - let image = await r34API.rule34(["yaoi"]); - return ctx.replyWithPhoto(image.replace(/"/gi, "")); + nswfparse.reddit.hentai + .yaoi() + .then((payload) => { + return ctx.replyWithPhoto(payload.url); + }) + .catch((error) => { + console.error(error); + }); }; diff --git a/commands/other/start.js b/commands/other/start.js deleted file mode 100644 index e69de29..0000000 diff --git a/package.json b/package.json index f509745..86f9901 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "NSWF-tg-bot", + "name": "nswf-tg-bot", "version": "1.0.0", "description": "", "main": "index.js", @@ -10,19 +10,9 @@ "author": "", "license": "ISC", "dependencies": { - "axios": "^1.4.0", - "dotenv": "^16.0.3", - "naughty-videos": "^1.0.2", - "porn-lib": "^1.4.1", - "r34.api": "^1.6.0", - "telegraf": "^4.12.2", - "telegram-keyboard": "^2.3.2", - "tslib": "^2.5.0", - "xvideos": "^0.0.4", - "xvideos-lib": "^1.1.21", - "xvideos-scraper": "^1.0.4" - }, - "devDependencies": { - "nodemon": "^2.0.22" + "dotenv": "^16.4.5", + "nswfparse": "^3.1.2", + "telegraf": "^4.16.3", + "telegram-keyboard": "^2.3.5" } }