-
Notifications
You must be signed in to change notification settings - Fork 13
/
animeSearch_MOD.js
136 lines (133 loc) · 2.99 KB
/
animeSearch_MOD.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
Anime Search mod by qschnitzel
Licensed under MIT License
Search for animes and get the best result with more details.
*/
module.exports = {
data: {
name: "Anime Search",
},
info: {
source: "https://github.com/RatWasHere/bmods/tree/master/Actions",
creator: "qschnitzel",
donate: "https://ko-fi.com/qschnitzel",
},
category: "Anime",
UI: [
{
element: "input",
storeAs: "animeSearch",
name: "Search for",
},
"-",
{
element: "storageInput",
storeAs: "title",
name: "Title",
},
"-",
{
element: "storageInput",
storeAs: "japanesetitle",
name: "Japanese Title",
},
"-",
{
element: "storageInput",
storeAs: "malid",
name: "MAL ID",
},
"-",
{
element: "storageInput",
storeAs: "malurl",
name: "MAL URL",
},
"-",
{
element: "storageInput",
storeAs: "image",
name: "Cover Image",
},
"-",
{
element: "storageInput",
storeAs: "youtubetrailer",
name: "Youtube Trailer URL",
},
"-",
{
element: "storageInput",
storeAs: "status",
name: "Status",
},
"-",
{
element: "storageInput",
storeAs: "episodes",
name: "Total Episodes",
},
"-",
{
element: "storageInput",
storeAs: "rating",
name: "Rating",
},
"-",
{
element: "storageInput",
storeAs: "score",
name: "Score",
},
"-",
{
element: "storageInput",
storeAs: "rank",
name: "Rank",
},
"-",
{
element: "storageInput",
storeAs: "popularity",
name: "Popularity",
},
"-",
{
element: "storageInput",
storeAs: "synopsis",
name: "Synopsis",
},
"-",
{
element: "storageInput",
storeAs: "release",
name: "Release Year",
},
],
async run(values, interaction, client, bridge) {
const query = bridge.transf(values.animeSearch);
await fetch(
`https://api.jikan.moe/v4/anime?q=${query.replace(" ", "%20")}&sfw`
).then(async (response) => {
const res = await response.json();
let data = res.data[0];
bridge.store(values.title, data.title);
bridge.store(values.japanesetitle, data.title_japanese);
bridge.store(values.malid, data.mal_id);
bridge.store(values.malurl, data.url);
bridge.store(values.image, data.images.jpg.large_image_url);
bridge.store(values.youtubetrailer, data.trailer.url);
bridge.store(values.status, data.status);
bridge.store(values.episodes, data.episodes);
bridge.store(values.rating, data.rating);
bridge.store(values.score, data.score);
bridge.store(values.rank, data.rank);
bridge.store(values.popularity, data.popularity);
bridge.store(
values.synopsis,
data.synopsis.replace("\n", "").replace("[Written by MAL Rewrite]", "")
);
bridge.store(values.release, data.year);
});
},
};