Upload case.js
Browse files
case.js
CHANGED
@@ -2977,62 +2977,52 @@ ${listAdmin}
|
|
2977 |
});
|
2978 |
break;
|
2979 |
}
|
2980 |
-
|
2981 |
-
|
2982 |
-
|
2983 |
-
|
2984 |
-
|
2985 |
-
|
2986 |
|
2987 |
-
|
2988 |
-
let [anime, episode] = q.split('|').map(x => x.trim());
|
2989 |
-
let apiUrl = `https://api-xx-xi.hf.space/api/animedl?name=${encodeURIComponent(anime)}&episode=${encodeURIComponent(episode)}`;
|
2990 |
-
let response = await fetch(apiUrl);
|
2991 |
-
let json = await response.json();
|
2992 |
|
2993 |
-
|
2994 |
-
|
2995 |
-
|
2996 |
-
});
|
2997 |
-
}
|
2998 |
|
2999 |
-
|
3000 |
-
|
3001 |
-
if (!match) return Infinity;
|
3002 |
-
let value = parseFloat(match[1]);
|
3003 |
-
return match[2].toLowerCase() === 'gb' ? value * 1024 : value;
|
3004 |
-
}
|
3005 |
|
3006 |
-
|
3007 |
-
|
3008 |
-
|
|
|
|
|
3009 |
|
3010 |
-
|
3011 |
-
|
3012 |
-
size
|
3013 |
-
} = bestMatch;
|
3014 |
|
3015 |
-
|
3016 |
-
|
3017 |
-
|
|
|
3018 |
|
3019 |
-
|
3020 |
-
|
3021 |
-
|
3022 |
-
|
3023 |
-
|
3024 |
-
|
3025 |
-
|
3026 |
-
});
|
3027 |
|
3028 |
-
|
3029 |
-
|
3030 |
-
|
3031 |
-
|
3032 |
-
|
3033 |
-
|
3034 |
-
|
3035 |
-
|
3036 |
case 'play':
|
3037 |
case 'songs': {
|
3038 |
if (!text) {
|
|
|
2977 |
});
|
2978 |
break;
|
2979 |
}
|
2980 |
+
case 'animedl': {
|
2981 |
+
if (!q.includes('|')) {
|
2982 |
+
return conn.sendMessage(m.chat, {
|
2983 |
+
text: `\`Invalid format\`\nExample: *${prefix + command} solo leveling|1*`
|
2984 |
+
});
|
2985 |
+
}
|
2986 |
|
2987 |
+
await loading();
|
|
|
|
|
|
|
|
|
2988 |
|
2989 |
+
try {
|
2990 |
+
let [anime, episode] = q.split('|').map(x => x.trim());
|
2991 |
+
let apiUrl = `https://api-xx-xi.hf.space/api/animedl?name=${encodeURIComponent(anime)}&episode=${encodeURIComponent(episode)}`;
|
|
|
|
|
2992 |
|
2993 |
+
let response = await fetch(apiUrl);
|
2994 |
+
let json = await response.json();
|
|
|
|
|
|
|
|
|
2995 |
|
2996 |
+
if (!json.success || !json.download_link) {
|
2997 |
+
return conn.sendMessage(m.chat, {
|
2998 |
+
text: `β *No download link found for ${anime} Episode ${episode}.*`
|
2999 |
+
});
|
3000 |
+
}
|
3001 |
|
3002 |
+
let downloadLink = json.download_link;
|
3003 |
+
let title = json.title || `${anime} - Episode ${episode}`;
|
|
|
|
|
3004 |
|
3005 |
+
// Notify the user
|
3006 |
+
await conn.sendMessage(m.chat, {
|
3007 |
+
text: fontx(`π₯ *Fetching ${title}*\nβ³ Please wait...`)
|
3008 |
+
});
|
3009 |
|
3010 |
+
// Send the episode as a file
|
3011 |
+
await conn.sendMessage(m.chat, {
|
3012 |
+
document: { url: downloadLink },
|
3013 |
+
mimetype: 'video/mp4',
|
3014 |
+
fileName: `${title}.mp4`,
|
3015 |
+
caption: fontx(`π¬ *${title}*\nπ₯ *Download Complete!*`)
|
3016 |
+
});
|
|
|
3017 |
|
3018 |
+
} catch (error) {
|
3019 |
+
console.error("Error in animedl case:", error);
|
3020 |
+
conn.sendMessage(m.chat, {
|
3021 |
+
text: "β An error occurred while fetching the anime. Please try again later."
|
3022 |
+
});
|
3023 |
+
}
|
3024 |
+
break;
|
3025 |
+
}
|
3026 |
case 'play':
|
3027 |
case 'songs': {
|
3028 |
if (!text) {
|