API-XX commited on
Commit
166e279
Β·
verified Β·
1 Parent(s): 3171013

Upload case.js

Browse files
Files changed (1) hide show
  1. case.js +85 -4
case.js CHANGED
@@ -994,10 +994,10 @@ module.exports = async (conn, dev, chatUpdate, store) => {
994
  > ─────────────❐
995
 
996
  > β”€γ€Ž \`πŒπ„πƒπˆπ€ πƒπŽπ–ππ‹πŽπ€πƒπ’\` 』
997
- > ${sign} ${prefix}play
998
- > ${sign} ${prefix}video
999
  > ${sign} ${prefix}animedl
1000
-
1001
 
1002
  > ─────────────❐
1003
 
@@ -1056,7 +1056,7 @@ module.exports = async (conn, dev, chatUpdate, store) => {
1056
  > ─────────────❐
1057
 
1058
  > β”€γ€Ž \`𝐍𝐒𝐅𝐖 πŒπ„ππ”\` 』
1059
-
1060
  > ─────────────❐
1061
 
1062
  > β”€γ€Ž \`π‘π€ππƒπŽπŒ π‚πŒπƒπ’\` 』
@@ -3000,8 +3000,89 @@ case 'play':
3000
 
3001
  break;
3002
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3003
 
 
 
 
 
 
 
 
 
 
3004
 
 
 
 
 
 
 
 
 
 
 
 
3005
 
3006
 
3007
 
 
994
  > ─────────────❐
995
 
996
  > β”€γ€Ž \`πŒπ„πƒπˆπ€ πƒπŽπ–ππ‹πŽπ€πƒπ’\` 』
997
+ > ${sign} ${prefix}play x
998
+ > ${sign} ${prefix}video x
999
  > ${sign} ${prefix}animedl
1000
+ > ${sign} ${prefix}yts
1001
 
1002
  > ─────────────❐
1003
 
 
1056
  > ─────────────❐
1057
 
1058
  > β”€γ€Ž \`𝐍𝐒𝐅𝐖 πŒπ„ππ”\` 』
1059
+ > ${sign} ${prefix}waifu
1060
  > ─────────────❐
1061
 
1062
  > β”€γ€Ž \`π‘π€ππƒπŽπŒ π‚πŒπƒπ’\` 』
 
3000
 
3001
  break;
3002
  }
3003
+ case 'yts': {
3004
+ if (!q) return reply("Please provide a search query.");
3005
+ await loading()
3006
+
3007
+ try {
3008
+ const searchResults = await yts(q);
3009
+ const videoResults = searchResults.all.filter((v) => v.type === 'video');
3010
+ if (!videoResults || videoResults.length === 0) return reply("No videos found.");
3011
+
3012
+ const videoID = videoResults[0].videoId;
3013
+ const thumbnail = `https://i.ytimg.com/vi/${videoID}/mqdefault.jpg`;
3014
+
3015
+ let responseMessage = `πŸ”Ž *YouTube Search Results:*\n`;
3016
+ for (let video of videoResults) {
3017
+ responseMessage += `
3018
+ πŸ“œ *Title:* ${video.title}
3019
+ πŸ“ˆ *Views:* ${video.views}
3020
+ πŸ“… *Uploaded:* ${video.ago}
3021
+ ⏱️ *Duration:* ${video.timestamp}
3022
+ πŸŽ₯ *Channel:* ${video.author.name}
3023
+ πŸ”— *Link:* ${video.url}\n\n`;
3024
+ }
3025
+ await conn.sendMessage(
3026
+ from, {
3027
+ caption: responseMessage.trim(),
3028
+ image: {
3029
+ url: thumbnail
3030
+ },
3031
+ }, {
3032
+ quoted: dev
3033
+ }
3034
+ );
3035
+ } catch (error) {
3036
+ console.error(error);
3037
+ reply("An error occurred while fetching the YouTube search results.");
3038
+ }
3039
+ break;
3040
+ }
3041
+ case 'nsfw': {
3042
+ if (!isGroup) return reply(mess.only.group)
3043
+ if (!isGroupAdmins && !isOwner) return reply(mess.only.admin)
3044
+ if (args.length < 1) return reply('*Enable or disable? Use: ᴏɴ/ᴏꜰꜰ*')
3045
+ if (args[0] === 'on') {
3046
+ db.data.chats[from].nsfw = true
3047
+ reply(`*\`${command} has been enabled in this group\`*`)
3048
+ let warning = fontx(`
3049
+ *γ€Œ ⚠️ π–π€π‘ππˆππ† ⚠️ 」*\nThe NSFW (Not Safe For Work) feature has been activated in this group. As a result, explicit content may be accessible through the bot. Please proceed with caution and ensure compliance with community guidelines.
3050
+ `)
3051
+ m.reply(warning)
3052
+ } else if (args[0] === 'off') {
3053
+ db.data.chats[from].nsfw = false
3054
+ reply(`*\`${command} has been disabled in this group\`*`)
3055
+ }
3056
+ }
3057
+ break
3058
+ case 'waifu': {
3059
+ if (!isGroup) return reply(mess.only.group)
3060
+ if (!isAntiNsfw) return reply(mess.nsfw)
3061
+ await loading();
3062
+ let query = q ? encodeURIComponent(q) : 'pussy';
3063
+ let apiUrl = `https://api-xx-xi.hf.space/api/waifu?q=${query}`;
3064
 
3065
+ try {
3066
+ let response = await fetch(apiUrl);
3067
+ let json = await response.json();
3068
+
3069
+ if (!json.success || !json.images.length) {
3070
+ return conn.sendMessage(m.chat, { text: fontx(`❌ No waifu images found for *${query}*. Try another category!`) });
3071
+ }
3072
+
3073
+ let randomImage = json.images[Math.floor(Math.random() * json.images.length)];
3074
 
3075
+ await conn.sendMessage(m.chat, {
3076
+ image: { url: randomImage },
3077
+ caption: fontx(`πŸ–ΌοΈ *Waifu Image*\nπŸ” *Category:* ${json.category}\n> ${caption}`)
3078
+ });
3079
+
3080
+ } catch (error) {
3081
+ console.error("Error fetching waifu image:", error);
3082
+ conn.sendMessage(m.chat, { text: fontx("❌ An error occurred while fetching the waifu image.") });
3083
+ }
3084
+ break;
3085
+ }
3086
 
3087
 
3088