devstok commited on
Commit
df9482c
·
verified ·
1 Parent(s): 47ab1ce

Delete plugins/animeupdate.js

Browse files
Files changed (1) hide show
  1. plugins/animeupdate.js +0 -122
plugins/animeupdate.js DELETED
@@ -1,122 +0,0 @@
1
- const fetch = require('node-fetch');
2
- const { generateWAMessageFromContent, prepareWAMessageMedia } = require('@adiwajshing/baileys');
3
- const { proto } = require('@adiwajshing/baileys');
4
-
5
- let handler = async (m, { conn, text, usedPrefix, command }) => {
6
- let response = await fetch("https://api.jikan.moe/v4/seasons/now?filter=tv");
7
- let data = await response.json();
8
-
9
- // Ambil data anime dengan detail
10
- let animeList = await Promise.all(data.data.map(async anime => {
11
- return {
12
- imageUrl: anime.images.jpg.large_image_url,
13
- title: anime.title,
14
- genres: anime.genres,
15
- type: anime.type,
16
- season: anime.season,
17
- year: anime.year,
18
- source: anime.source,
19
- episodes: anime.episodes,
20
- status: anime.status,
21
- duration: anime.duration,
22
- studios: anime.studios,
23
- rating: anime.rating,
24
- score: anime.score,
25
- popularity: anime.popularity
26
- };
27
- }));
28
-
29
- const createImageMessage = async (url) => {
30
- const { imageMessage } = await prepareWAMessageMedia({ image: { url } }, { upload: conn.waUploadToServer });
31
- return imageMessage;
32
- }
33
-
34
- const cards = await Promise.all(animeList.map(async (a) => {
35
- const imageMessage = await createImageMessage(a.imageUrl);
36
-
37
- // Deskripsi anime yang lebih lengkap
38
- const description = `*• Title:* ${a.title}
39
- *• Genre:* *[ ${a.genres.map(g => g.name).join(", ")} ]*
40
- *• Type:* ${a.type}
41
- *• Season:* ${a.season} *[ ${a.year} ]*
42
- *• Source:* ${a.source}
43
- *• Total episodes:* ${a.episodes}
44
- *• Status:* ${a.status}
45
- *• Duration:* ${a.duration}
46
- *• Studio:* *[ ${a.studios.map(s => s.name).join(", ")} ]*
47
- *• Rating:* ${a.rating}
48
- *• Score:* ${a.score}/10.0
49
- *• Popularity:* ${a.popularity}`;
50
-
51
- return {
52
- body: proto.Message.InteractiveMessage.Body.fromObject({
53
- text: description,
54
- }),
55
- footer: proto.Message.InteractiveMessage.Footer.fromObject({
56
- text: "Powered by Jikan API",
57
- }),
58
- header: proto.Message.InteractiveMessage.Header.fromObject({
59
- title: '',
60
- hasMediaAttachment: true,
61
- imageMessage: imageMessage,
62
- }),
63
- nativeFlowMessage: proto.Message.InteractiveMessage.NativeFlowMessage.fromObject({
64
- buttons: [
65
- {
66
- name: "cta_url",
67
- buttonParamsJson: JSON.stringify({
68
- display_text: "Lihat Gambar",
69
- cta_type: "1",
70
- url: a.imageUrl
71
- })
72
- }
73
- // Tombol "SEARCH AGAIN" dihapus
74
- ]
75
- })
76
- };
77
- }));
78
-
79
- // Kirim pesan interaktif
80
- const interactiveMessage = proto.Message.InteractiveMessage.create({
81
- body: proto.Message.InteractiveMessage.Body.fromObject({
82
- text: "List of Anime Images",
83
- }),
84
- footer: proto.Message.InteractiveMessage.Footer.fromObject({
85
- text: "Powered by Jikan API",
86
- }),
87
- header: proto.Message.InteractiveMessage.Header.fromObject({
88
- title: "Anime Carousel",
89
- hasMediaAttachment: false,
90
- }),
91
- carouselMessage: proto.Message.InteractiveMessage.CarouselMessage.fromObject({
92
- cards: cards,
93
- }),
94
- });
95
-
96
- const messageContent = proto.Message.fromObject({
97
- viewOnceMessage: {
98
- message: {
99
- messageContextInfo: {
100
- deviceListMetadata: {},
101
- deviceListMetadataVersion: 2,
102
- },
103
- interactiveMessage,
104
- },
105
- },
106
- });
107
-
108
- const msgs = await generateWAMessageFromContent(m.chat, messageContent, {
109
- userJid: conn.user.jid,
110
- quoted: m,
111
- upload: conn.waUploadToServer,
112
- });
113
-
114
- await conn.relayMessage(m.chat, msgs.message, {
115
- messageId: msgs.key.id,
116
- });
117
- };
118
-
119
- handler.help = ["animeupdate"];
120
- handler.tags = ["anime"];
121
- handler.command = ["animeupdate"];
122
- module.exports = handler;