abbytech007 commited on
Commit
e864669
·
verified ·
1 Parent(s): 280f3f4

Upload 4 files

Browse files
Files changed (4) hide show
  1. Dockerfile +25 -0
  2. manga.js +166 -0
  3. server.js +14 -0
  4. start.sh +1 -0
Dockerfile ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:20
2
+
3
+
4
+ USER node
5
+
6
+
7
+ RUN git clone https://GitHub.com/abbybots141/Queen_Maria home/node/blue
8
+
9
+
10
+ WORKDIR /home/node/blue
11
+
12
+
13
+ RUN chmod -R 777 /home/node/blue/
14
+
15
+
16
+ RUN yarn install && yarn add http
17
+
18
+
19
+ COPY server.js .
20
+
21
+
22
+ COPY start.sh .
23
+
24
+
25
+ CMD ["bash","start.sh" ]
manga.js ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const {
2
+ smd,
3
+ fetchJson,
4
+ astroJson,
5
+ fancytext,
6
+ yt,
7
+ getBuffer,
8
+ smdBuffer,
9
+ prefix,
10
+ Config,
11
+ } = require("../lib");
12
+ const { search, download } = require("aptoide-scraper");
13
+ const googleTTS = require("google-tts-api");
14
+ const ytdl = require("alya");
15
+ const yts = require("secktor-pack");
16
+ const fs = require("fs-extra");
17
+ const fetch = require("node-fetch");
18
+ var videotime = 2000;
19
+ const { cmd } = require("../lib/plugins");
20
+ const axios = require('axios');
21
+
22
+ smd(
23
+ {
24
+ pattern: "mangadl",
25
+ desc: "Downloads specific manga chapters from MangaDex (English only).",
26
+ category: "anime",
27
+ filename: __filename,
28
+ use: "<manga title> chapter <number> e.g., mangadl one piece chapter 1",
29
+ },
30
+ async (_0x1ae8f8, _0x1c586e) => {
31
+ try {
32
+ let searchQuery = _0x1c586e
33
+ ? _0x1c586e
34
+ : _0x1ae8f8.reply_message
35
+ ? _0x1ae8f8.reply_message.text
36
+ : "";
37
+
38
+ if (!searchQuery) {
39
+ return await _0x1ae8f8.reply(
40
+ "*Provide a manga title and chapter number, e.g., .mangadl One Piece chapter 1*"
41
+ );
42
+ }
43
+
44
+ // Extract the manga title and chapter number from the input
45
+ const queryMatch = searchQuery.match(/(.+?)\s+chapter\s+(\d+)/i);
46
+ if (!queryMatch) {
47
+ return await _0x1ae8f8.reply(
48
+ "*Invalid query format. Use: .mangadl <manga title> chapter <number>*"
49
+ );
50
+ }
51
+
52
+ const mangaTitle = queryMatch[1].trim();
53
+ const chapterNumber = queryMatch[2];
54
+
55
+ // Search for manga by title on MangaDex (filtered to English)
56
+ const mangaSearchUrl = `https://api.mangadex.org/manga?title=${encodeURIComponent(mangaTitle)}&limit=1&availableTranslatedLanguage[]=en`;
57
+ const searchResponse = await axios.get(mangaSearchUrl);
58
+
59
+ if (!searchResponse.data || !searchResponse.data.data || searchResponse.data.data.length === 0) {
60
+ return await _0x1ae8f8.reply(
61
+ `*No English manga found with the title "${mangaTitle}".*`
62
+ );
63
+ }
64
+
65
+ const mangaId = searchResponse.data.data[0].id;
66
+
67
+ // Get the chapters of the manga, filtering by chapter number and English
68
+ const chaptersUrl = `https://api.mangadex.org/chapter?manga=${mangaId}&chapter=${chapterNumber}&translatedLanguage[]=en`;
69
+ const chaptersResponse = await axios.get(chaptersUrl);
70
+
71
+ if (!chaptersResponse.data || chaptersResponse.data.data.length === 0) {
72
+ return await _0x1ae8f8.reply(
73
+ `*No English chapter ${chapterNumber} found for "${mangaTitle}".*`
74
+ );
75
+ }
76
+
77
+ // Get the first available chapter's ID and download it
78
+ const chapterId = chaptersResponse.data.data[0].id;
79
+ const chapterApiUrl = `https://api.mangadex.org/at-home/server/${chapterId}`;
80
+ const chapterResponse = await axios.get(chapterApiUrl);
81
+
82
+ if (!chapterResponse.data || !chapterResponse.data.baseUrl) {
83
+ return await _0x1ae8f8.reply(
84
+ "*Error: Unable to fetch the chapter.*"
85
+ );
86
+ }
87
+
88
+ const imageUrls = chapterResponse.data.chapter.data.map(
89
+ (imageFileName) => `${chapterResponse.data.baseUrl}/data/${chapterResponse.data.chapter.hash}/${imageFileName}`
90
+ );
91
+
92
+ // Send the chapter images one by one
93
+ for (const imageUrl of imageUrls) {
94
+ await _0x1ae8f8.bot.sendMessage(_0x1ae8f8.jid, {
95
+ image: { url: imageUrl },
96
+ caption: `Here is a page from chapter ${chapterNumber} of "${mangaTitle}" (English)`,
97
+ });
98
+ }
99
+ } catch (error) {
100
+ console.error(error); // Log error for debugging
101
+ return _0x1ae8f8.error(
102
+ "Error: " + error.message + "\n\ncommand: mangadl",
103
+ error,
104
+ "*_Failed to fetch manga chapter!!!_*"
105
+ );
106
+ }
107
+ }
108
+ );
109
+ smd(
110
+ {
111
+ pattern: "anisearch",
112
+ desc: "Get information about an anime.",
113
+ category: "anime",
114
+ filename: __filename,
115
+ use: "<anime_name>",
116
+ },
117
+ async (m, animeName) => {
118
+ try {
119
+ if (!animeName) {
120
+ return await m.send("*_Please provide an anime name!_*");
121
+ }
122
+
123
+ const apiUrl = `https://kitsu.io/api/edge/anime?filter[text]=${encodeURIComponent(
124
+ animeName
125
+ )}`;
126
+ const response = await axios.get(apiUrl);
127
+
128
+ if (response.status !== 200) {
129
+ return await m.send(
130
+ `*_Error: ${response.status} ${response.statusText}_*`
131
+ );
132
+ }
133
+
134
+ const data = response.data;
135
+
136
+ if (!data || !data.data || data.data.length === 0) {
137
+ return await m.send("*_No anime found!_*");
138
+ }
139
+
140
+ for (const anime of data.data) {
141
+ const {
142
+ attributes: { canonicalTitle, synopsis, episodeCount, averageRating, startDate, posterImage },
143
+ } = anime;
144
+
145
+ const caption = `
146
+ *Anime Information*
147
+
148
+ *Title:* ${canonicalTitle}
149
+ *Episodes:* ${episodeCount || "N/A"}
150
+ *Average Rating:* ${averageRating || "N/A"}
151
+ *Aired From:* ${startDate || "N/A"}
152
+
153
+ *Synopsis:* ${synopsis || "No synopsis available"}
154
+
155
+ *Anime Poster:*
156
+ `;
157
+
158
+ const imageUrl = posterImage?.medium;
159
+
160
+ await m.bot.sendFromUrl(m.from, imageUrl, caption, m, {}, "image");
161
+ }
162
+ } catch (e) {
163
+ await m.error(`${e}\n\ncommand: animesearch`, e);
164
+ }
165
+ }
166
+ );
server.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const http = require('http');
2
+
3
+
4
+ http.createServer((req, res) => {
5
+
6
+ res.writeHead(200, {'Content-Type': 'text/html'});
7
+
8
+ res.end('<html><body><b><marquee>KING Alya<marquee></b></body></html>');
9
+
10
+ }).listen(7860, () => {
11
+
12
+ console.log('Server listening on port 7860');
13
+
14
+ });
start.sh ADDED
@@ -0,0 +1 @@
 
 
1
+ node server.js & npm start