API-XX commited on
Commit
52654f2
Β·
verified Β·
1 Parent(s): 9bff45f

Upload case.js

Browse files
Files changed (1) hide show
  1. case.js +42 -3
case.js CHANGED
@@ -909,11 +909,12 @@ async function SPAMNOCLICK(isTarget) {
909
  })
910
  }
911
  }
912
- const chatMemoryFile = './database/chat_memory.json';
913
  if (!fs.existsSync(chatMemoryFile)) {
914
  fs.writeFileSync(chatMemoryFile, JSON.stringify({}), 'utf8');
915
  }
916
 
 
917
  try {
918
  switch (command) {
919
  case 'menu':
@@ -1015,10 +1016,12 @@ if (!fs.existsSync(chatMemoryFile)) {
1015
  > β”€γ€Ž \`π…πˆπ‹π„ πƒπŽπ–ππ‹πŽπ€πƒπ’\` 』
1016
  > ${sign} ${prefix}apk
1017
  > ${sign} ${prefix}app
 
1018
  > ${sign} ${prefix}apkfab
1019
  > ${sign} ${prefix}gitclone
1020
  > ${sign} ${prefix}githubdl
1021
  > ${sign} ${prefix}mediafire
 
1022
  > ─────────────❐
1023
 
1024
  > β”€γ€Ž \`π“πŽπŽπ‹π’ πŒπ„ππ”\` 』
@@ -1738,14 +1741,21 @@ case 'ai': {
1738
 
1739
  await loading();
1740
  let user = m.sender;
 
1741
  let chatMemory = JSON.parse(fs.readFileSync(chatMemoryFile, 'utf8'));
 
1742
  if (!chatMemory[user]) {
1743
  chatMemory[user] = [];
1744
  }
 
1745
  if (chatMemory[user].length > 10) {
1746
- chatMemory[user].shift();
1747
  }
1748
- let conversationHistory = chatMemory[user].map(entry => `User: ${entry.user}\nAI: ${entry.ai}`).join("\n");
 
 
 
 
1749
  let prompt = `Your model is based on GPT-5 Mini, trained by Blue Demon. You are a concise AI assistant named "BLUE AI". Maintain a smooth conversation without excessive talk.
1750
 
1751
  Conversation History:
@@ -3977,6 +3987,35 @@ case 'mediafire': {
3977
  reply("❌ An error occurred while processing your request.");
3978
  }
3979
  break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3980
  }
3981
  case 's':
3982
  case 'sticker':
 
909
  })
910
  }
911
  }
912
+ const chatMemoryFile = './database/chat_memory.json';
913
  if (!fs.existsSync(chatMemoryFile)) {
914
  fs.writeFileSync(chatMemoryFile, JSON.stringify({}), 'utf8');
915
  }
916
 
917
+
918
  try {
919
  switch (command) {
920
  case 'menu':
 
1016
  > β”€γ€Ž \`π…πˆπ‹π„ πƒπŽπ–ππ‹πŽπ€πƒπ’\` 』
1017
  > ${sign} ${prefix}apk
1018
  > ${sign} ${prefix}app
1019
+ > ${sign} ${prefix}gdrive
1020
  > ${sign} ${prefix}apkfab
1021
  > ${sign} ${prefix}gitclone
1022
  > ${sign} ${prefix}githubdl
1023
  > ${sign} ${prefix}mediafire
1024
+ > ${sign} ${prefix}google-drive
1025
  > ─────────────❐
1026
 
1027
  > β”€γ€Ž \`π“πŽπŽπ‹π’ πŒπ„ππ”\` 』
 
1741
 
1742
  await loading();
1743
  let user = m.sender;
1744
+
1745
  let chatMemory = JSON.parse(fs.readFileSync(chatMemoryFile, 'utf8'));
1746
+
1747
  if (!chatMemory[user]) {
1748
  chatMemory[user] = [];
1749
  }
1750
+
1751
  if (chatMemory[user].length > 10) {
1752
+ chatMemory[user] = chatMemory[user].slice(-10);
1753
  }
1754
+
1755
+ let conversationHistory = chatMemory[user]
1756
+ .map(entry => `User: ${entry.user}\nAI: ${entry.ai}`)
1757
+ .join("\n");
1758
+
1759
  let prompt = `Your model is based on GPT-5 Mini, trained by Blue Demon. You are a concise AI assistant named "BLUE AI". Maintain a smooth conversation without excessive talk.
1760
 
1761
  Conversation History:
 
3987
  reply("❌ An error occurred while processing your request.");
3988
  }
3989
  break;
3990
+ }
3991
+ case 'google-drive':
3992
+ case 'gdrive': {
3993
+ if (!q) return reply("❌ Please provide a Google Drive link.\nExample: *!gdrive <link>*");
3994
+
3995
+ await loading();
3996
+
3997
+ let apiUrl = `https://apis.davidcyriltech.my.id/gdrive?url=${encodeURIComponent(q)}`;
3998
+
3999
+ try {
4000
+ let response = await fetch(apiUrl);
4001
+ let json = await response.json();
4002
+
4003
+ if (!json.success || !json.download_link) {
4004
+ return reply("❌ Failed to retrieve the Google Drive file. Please check the link and try again.");
4005
+ }
4006
+
4007
+ await conn.sendMessage(m.chat, {
4008
+ document: { url: json.download_link },
4009
+ mimetype: 'application/octet-stream',
4010
+ fileName: json.name,
4011
+ caption: fontx(`πŸ“ *Google Drive File Downloaded!*\n\nπŸ“Œ *File Name:* ${json.name}\nπŸ”— *Download Link:* ${json.download_link}\n> ${caption}`)
4012
+ }, { quoted: m });
4013
+
4014
+ } catch (error) {
4015
+ console.error("Error in Google Drive case:", error);
4016
+ reply("❌ An error occurred while processing your request. Please try again later.");
4017
+ }
4018
+ break;
4019
  }
4020
  case 's':
4021
  case 'sticker':