Skip to content

Update config.dev.json#1

Open
Vincentpai-developer wants to merge 1 commit into
MarvinWariors:Kahitanofrom
Vincentpai-developer:patch-3
Open

Update config.dev.json#1
Vincentpai-developer wants to merge 1 commit into
MarvinWariors:Kahitanofrom
Vincentpai-developer:patch-3

Conversation

@Vincentpai-developer

Copy link
Copy Markdown

const axios = require('axios');
const moment = require('moment-timezone');
const NodeCache = require('node-cache');
// Initialize cache
const cache = new NodeCache({ stdTTL: 600, checkperiod: 120 });

// Add more Apis or Ai services here.
const services = [
{ url: 'http://markdevs-last-api.onrender.com/api/v2/gpt4', param: 'query' },
{ url: 'https://markdevs-last-api.onrender.com/api/v3/gpt4', param: 'ask' },
{ url: 'https://markdevs-last-api.onrender.com/gpt4', param: 'prompt', uid: 'uid' }
];

const designatedHeader = "Yanzen Ai";

const getAIResponse = async (question, messageID) => {
// Check if response is cached
const cachedResponse = cache.get(question);
if (cachedResponse) {
return { response: cachedResponse, messageID };
}

const response = await getAnswerFromAI(question.trim() || "hi");
// Cache the response
cache.set(question, response);
return { response, messageID };

};

const getAnswerFromAI = async (question) => {
const promises = services.map(({ url, param, uid }) => {
const params = uid ? { [param]: question, [uid]: '100090775159086' } : { [param]: question };
return fetchFromAI(url, params);
});

const responses = await Promise.allSettled(promises);
for (const { status, value } of responses) {
    if (status === 'fulfilled' && value) {
        return value;
    }
}

throw new Error("No valid response from any AI service");

};

const fetchFromAI = async (url, params) => {
try {
const { data } = await axios.get(url, { params });
return data.gpt4 || data.reply || data.response || data.answer || data.message;
} catch (error) {
console.error("Network Error:", error.message);
return null;
}
};

const handleCommand = async (api, event, args, message, usersData ) => {
const name = await usersData.getName(event.senderID);
try {
const question = args.join(" ").trim();
if (!question) return message.reply("Please provide a question to get an answer.");
const { response, messageID } = await getAIResponse(question, event.messageID);
api.sendMessage(𝗩𝗜𝗡𝗖𝗘𝗡𝗧 𝗕𝗢𝗧\n━━━━━━━━━━━━━━━━\n${response}\n━━━━━━━━━━━━━━━━\n🗣 Asked by: ${name}\n📆|⏰𝗥𝗲𝘀𝗽𝗼𝗻𝗱 𝗗𝗮𝘁𝗲&𝗧𝗶𝗺𝗲:\n${moment.tz("Asia/Manila").format("DD/MM/YYYY, h:mm:ss A")}, event.threadID, messageID);
} catch (error) {
console.error("Error in handleCommand:", error.message);
message.reply("An error occurred while processing your request.");
}
};

const onStart = async ({ api, event, args, usersData }) => {
const name = await usersData.getName(event.senderID);
try {
const input = args.join(' ').trim();
const { response, messageID } = await getAIResponse(input, event.messageID);
api.sendMessage(𝗩𝗜𝗡𝗖𝗘𝗡𝗧 𝗕𝗢𝗧\n━━━━━━━━━━━━━━━━\n${response}\n━━━━━━━━━━━━━━━━\n🗣 Asked by: ${name}\n📆|⏰𝗥𝗲𝘀𝗽𝗼𝗻𝗱 𝗗𝗮𝘁𝗲&𝗧𝗶𝗺𝗲:\n${moment.tz("Asia/Manila").format("DD/MM/YYYY, h:mm:ss A")}, event.threadID, messageID);
} catch (error) {
console.error("Error in onStart:", error.message);
api.sendMessage("An error occurred while processing your request.", event.threadID);
}
};

const onChat = async ({ event, api, usersData }) => {
const name = await usersData.getName(event.senderID);
const messageContent = event.body.trim().toLowerCase();
const isReplyToBot = event.messageReply && event.messageReply.senderID === api.getCurrentUserID();
const isDirectMessage = messageContent.startsWith("ai") && event.senderID !== api.getCurrentUserID();

if (isReplyToBot) {
    const repliedMessage = event.messageReply.body || "";
    if (!repliedMessage.startsWith(designatedHeader)) {
        return;
    }
}

if (isReplyToBot || isDirectMessage) {
    const userMessage = isDirectMessage ? messageContent.replace(/^ai\s*/, "").trim() : messageContent;
    const botReplyMessage = isReplyToBot ? event.messageReply.body : "";
    const input = `${botReplyMessage}\n${userMessage}`.trim();

    try {
        const { response, messageID } = await getAIResponse(input, event.messageID);
        api.sendMessage(`𝗩𝗜𝗡𝗖𝗘𝗡𝗧 𝗕𝗢𝗧\n━━━━━━━━━━━━━━━━\n${response}\n━━━━━━━━━━━━━━━━\n🗣 Asked by: ${name}\n📆|⏰𝗥𝗲𝘀𝗽𝗼𝗻𝗱 𝗗𝗮𝘁𝗲&𝗧𝗶𝗺𝗲:\n${moment.tz("Asia/Manila").format("DD/MM/YYYY, h:mm:ss A")}`, event.threadID, messageID);
    } catch (error) {
        console.error("Error in onChat:", error.message);
        api.sendMessage("An error occurred while processing your request.", event.threadID);
    }
}

};

module.exports = {
config: {
name: 'ai2',
author: 'Vin-cent',
role: 0,
category: 'ai',
shortDescription: 'AI to answer any question',
},
onStart,
onChat,
handleCommand
};

@Vincentpai-developer

Copy link
Copy Markdown
Author

const axios = require('axios');
const fs = require('fs');
const path = require('path');

module.exports = {
config: {
name: "owner",
aurthor:"Vincent",// Convert By Goatbot Armenion
role: 0,
shortDescription: " ",
longDescription: "",
category: "admin",
guide: "{pn}"
},

onStart: async function ({ api, event }) {
try {
const ownerInfo = {
name: '𝗩𝗜𝗡𝗖𝗘𝗡𝗧 𝗔𝗥𝗠𝗘𝗡𝗜𝗢𝗡',
gender: '𝗠𝗔𝗟𝗘',
age: '𝟭𝟳',
country: '𝗣𝗛𝗜𝗟𝗜𝗣𝗣𝗜𝗡𝗘𝗦 🇵🇭',
relationship: '𝗦𝗜𝗡𝗚𝗟𝗘',
school: '𝗟𝗜𝗖𝗘𝗢 𝗗𝗘 𝗦𝗧𝗢 𝗧𝗢𝗠𝗔𝗦 𝗗𝗘 𝗔𝗤𝗨𝗜𝗡𝗔𝗦 🏫',
work: '𝗙𝗨𝗖𝗞𝗜𝗡𝗚 𝗬𝗢𝗨𝗥 𝗦𝗪𝗔𝗚',
penis: '𝟰𝟬 𝗜𝗡𝗖𝗛𝗘𝗦 🥵',
sports: '𝗕𝗔𝗦𝗞𝗘𝗧𝗕𝗔𝗟𝗟 𝗣𝗟𝗔𝗬𝗘𝗥 🏀',
height: '𝗦𝗘𝗖𝗥𝗘𝗧',
facebookLink: 'https://www.facebook.com/100090775159086',
nickname: '𝗛𝗔𝗡𝗗𝗦𝗢𝗠𝗘',
};

const bold = 'https://i.imgur.com/DDO686J.mp4'; // Replace with your Google Drive videoid link https://drive.google.com/uc?export=download&id=here put your video id

const tmpFolderPath = path.join(__dirname, 'tmp');

if (!fs.existsSync(tmpFolderPath)) {
  fs.mkdirSync(tmpFolderPath);
}

const videoResponse = await axios.get(bold, { responseType: 'arraybuffer' });
const videoPath = path.join(tmpFolderPath, 'owner_video.mp4');

fs.writeFileSync(videoPath, Buffer.from(videoResponse.data, 'binary'));

const response = `

╔════━━✦✾✦━━════╗
𝑴𝒀 𝑯𝑨𝑵𝑺𝑶𝑴𝑬 𝑶𝑾𝑵𝑬𝑹
╚════━━✦✾✦━━════╝

  Name: ${ownerInfo.name}
  Gender: ${ownerInfo.gender}
  Age: ${ownerInfo.age}
  Country: ${ownerInfo.country}
  Relationship: ${ownerInfo.relationship}
  School: ${ownerInfo.school}
  Work: ${ownerInfo.work}
  Penis: ${ownerInfo.penis}
  Sports: ${ownerInfo.sports}
  Height: ${ownerInfo.height}
  Facebook: ${ownerInfo.facebookLink}
  Nickname: ${ownerInfo.nickname}
            ┈╭━━━━━━━━━━━╮┈

┈┃╭━━━╮┊╭━━━╮┃┈
╭┫┃▇┈┃┊┃┈▇ ┃┣╮
┃┃╰━━━╯┊╰━━━╯┃┃
╰┫╭━╮╰━━━╯╭━╮┣╯
┈┃┃┣┳┳┳┳┳┳┳┫┃┃┈
┈┃┃╰┻┻┻┻┻┻┻╯┃┃┈
┈╰━━━━━━━━━━━╯┈
`;
await api.sendMessage({
body: response,
attachment: fs.createReadStream(videoPath)
}, event.threadID, event.messageID);

if (event.body.toLowerCase().includes('ownerinfo')) {
  api.setMessageReaction('😎', event.messageID, (err) => {}, true);
}

} catch (error) {
console.error('Error in ownerinfo command:', error);
return api.sendMessage('An error occurred while processing the command.', event.threadID);
}
},
};

@Vincentpai-developer

Copy link
Copy Markdown
Author

const fs = require("fs-extra");
const axios = require("axios");
const path = require("path");
const { getPrefix } = global.utils;
const { commands, aliases } = global.GoatBot;
const doNotDelete = "[ 😎 | VINCENT AI ]";

module.exports = {
config: {
name: "help",
version: "1.17",
author: "Vincent", // orginal author Vincent
countDown: 0,
role: 0,
shortDescription: {
en: "View command usage",
},
longDescription: {
en: "View command usage and list all commands directly",
},
category: "info",
guide: {
en: "{pn} / help cmdName ",
},
priority: 1,
},

onStart: async function ({ message, args, event, threadsData, role }) {
const { threadID } = event;
const threadData = await threadsData.get(threadID);
const prefix = getPrefix(threadID);

if (args.length === 0) {
const categories = {};
let msg = "";

  msg += `╔══════✦✾✦══════╗\n     ☪︎ 𝗩𝗜𝗡𝗖𝗘𝗡𝗧  𝗖𝗠𝗗𝗦 ☪︎\n╚══════✦✾✦══════╝`;

  for (const [name, value] of commands) {
      if (value.config.role > 1 && role < value.config.role) continue;

      const category = value.config.category || "Uncategorized";
      categories[category] = categories[category] || { commands: [] };
      categories[category].commands.push(name);
  }

8
Object.keys(categories).forEach(category => {
if (category !== "info") {
msg += \n╭────────────𒁍\n│『 ${category.toUpperCase()} 』;

          const names = categories[category].commands.sort();
          for (let i = 0; i < names.length; i += 1) {
              const cmds = names.slice(i, i + 1).map(item => `│➥${item}`);
              msg += `\n${cmds.join(" ".repeat(Math.max(0, 5 - cmds.join("").length)))}`;
          }

          msg += `\n╰────────𒁍`;
      }
  });

  const totalCommands = commands.size;
  msg += `\n𝘾𝙪𝙧𝙧𝙚𝙣𝙩𝙡𝙮, 𝙄 𝙝𝙖𝙫𝙚  ${totalCommands} 𝙘𝙤𝙢𝙢𝙖𝙣𝙙𝙨 𝙩𝙝𝙖𝙩 𝙘𝙖𝙣 𝙗𝙚 𝙪𝙨𝙚𝙙. 𝙎𝙤𝙤𝙣 𝙢𝙤𝙧𝙚 𝙘𝙤𝙢𝙢𝙖𝙣𝙙𝙨 𝙬𝙞𝙡𝙡 𝙗𝙚 𝙖𝙙𝙙𝙚𝙙\n`;
  msg += `𝙏𝙮𝙥𝙚 ${prefix} 𝙝𝙚𝙡𝙥 𝗰𝙤𝙢𝙢𝙖𝙣𝙙 𝗡𝗮𝗺𝗲 𝘁𝗼 𝘃𝗶𝗲𝘄 𝘁𝗵𝗲 𝗱𝗲𝘁𝗮𝗶𝗹𝘀 𝗼𝗳 𝘁𝗵𝗮𝘁 𝗰𝗼𝗺𝗺𝗮𝗻𝗱\n`;
  msg += `🕊️『 𝗩𝗜𝗡𝗖𝗘𝗡𝗧 𝗔𝗥𝗠𝗘𝗡𝗜𝗢𝗡 』🕊️`;


  const helpListImages = [

"https://i.imgur.com/WHRGiPz.gif",
"https://i.imgur.com/zM4Hvmn.gif ",
"https://i.imgur.com/8d6WbRJ.gif",
"https://i.imgur.com/aYS6HRa.mp4",
"https://i.imgur.com/dOAZf6R.jpeg",
"https://i.imgur.com/AIz8ASV.jpeg",
"https://i.imgur.com/6vAPXOY.gif"
];

  const helpListImage = helpListImages[Math.floor(Math.random() * helpListImages.length)];


  await message.reply({
      body: msg,
      attachment: await global.utils.getStreamFromURL(helpListImage)
  });

} else {
const commandName = args[0].toLowerCase();
const command = commands.get(commandName) || commands.get(aliases.get(commandName));

  if (!command) {
    await message.reply(`Command "${commandName}" not found.`);
  } else {
    const configCommand = command.config;
    const roleText = roleTextToString(configCommand.role);
    const author = configCommand.author || "Unknown";

    const longDescription = configCommand.longDescription ? configCommand.longDescription.en || "No description" : "No description";

    const guideBody = configCommand.guide?.en || "No guide available.";
    const usage = guideBody.replace(/{p}/g, prefix).replace(/{n}/g, configCommand.name);

    const response = `╭── NAME ────❏❖❏

│ ${configCommand.name}
├── INFO
│ Description: ${longDescription}
│ Other names: ${configCommand.aliases ? configCommand.aliases.join(", ") : "Do not have"}
│ Other names in your group: Do not have
│ Version: ${configCommand.version || "1.0"}
│ Role: ${roleText}
│ Time per command: ${configCommand.countDown || 1}s
│ Author: ${author}
├── Usage
│ ${usage}
├── Notes
│ The content inside can be changed
│ The content inside [a|b|c] is a or b or c
╰━━━━━━━❖`;

    await message.reply(response);
  }
}

},
};

function roleTextToString(roleText) {
switch (roleText) {
case 0:
return "0 (All users)";
case 1:
return "1 (Group administrators)";
case 2:
return "2 (Admin bot)";
default:
return "Unknown role";
}
}

@Vincentpai-developer

Copy link
Copy Markdown
Author

const moment = require("moment-timezone");
const manilaTime = moment.tz('Asia/Manila');
const formattedDateTime = manilaTime.format('MMMM D, YYYY h:mm A');
const axios = require('axios');
const { GoatWrapper } = require('fca-liane-utils');

let fontEnabled = true;

function formatFont(text) {
const fontMapping = {
'a': '𝘢', 'b': '𝘣', 'c': '𝘤', 'd': '𝘥', 'e': '𝘦', 'f': '𝘧', 'g': '𝘨', 'h': '𝘩',
'i': '𝘪', 'j': '𝘫', 'k': '𝘬', 'l': '𝘭', 'm': '𝘮', 'n': '𝘯', 'o': '𝘰', 'p': '𝘱', 'q': '𝘲',
'r': '𝘳', 's': '𝘴', 't': '𝘵', 'u': '𝘶', 'v': '𝘷', 'w': '𝘸', 'x': '𝘹', 'y': '𝘺', 'z': '𝘻',
'A': '𝘈', 'B': '𝘉', 'C': '𝘊', 'D': '𝘋', 'E': '𝘌', 'F': '𝘍', 'G': '𝘎', 'H': '𝘏',
'I': '𝘐', 'J': '𝘑', 'K': '𝘒', 'L': '𝘓', 'M': '𝘔', 'N': '𝘕', 'O': '𝘖', 'P': '𝘗', 'Q': '𝘘',
'R': '𝘙', 'S': '𝘚', 'T': '𝘛', 'U': '𝘜', 'V': '𝘝', 'W': '𝘞', 'X': '𝘟', 'Y': '𝘠', 'Z': '𝘡',
};

let formattedText = "";
for (const char of text) {
if (fontEnabled && char in fontMapping) {
formattedText += fontMapping[char];
} else {
formattedText += char;
}
}

return formattedText;
}

module.exports = {
config: {
name: "Yanzen",
version: "4.7",
hasPermission: 0,
role: 0,
aliases: ["Yanzen","ai"],
credits: "hashier",
shortDescription: "(𝚈𝚊𝚗𝚣𝚎𝚗 𝚋𝚘𝚝)",
description: "(𝚈𝚊𝚗𝚣𝚎𝚗 𝚋𝚘𝚝)",
commandCategory: "𝚗𝚘 𝚙𝚛𝚎𝚏𝚒𝚡",
hasPrefix: false,
usePrefix: false,
usages: "(𝙼𝚘𝚍𝚎𝚕 - 𝚈𝚊𝚗𝚣𝚎𝚗/𝚋𝚘𝚝 70𝚋 𝙸𝚗𝚜𝚝𝚛𝚞𝚌𝚝)",
usage: "(𝙼𝚘𝚍𝚎𝚕 - 𝚈𝚊𝚗𝚣𝚎𝚗/ 𝚋𝚘𝚝 70𝚋 𝙸𝚗𝚜𝚝𝚛𝚞𝚌𝚝)",
cooldowns: 3,
cooldown: 3,
category: "Noprefix",
countDown: 5,
},

onStart: async function ({ api, event, args }) {
if (args.length === 0) {
api.sendMessage({ body:"📌 𝗛𝗲𝗹𝗹𝗼, 𝗜 𝗮𝗺 𝗬𝗮𝗻𝘇𝗲𝗻 𝗯𝗼𝘁 𝗜 𝘄𝗮𝘀 𝗰𝗿𝗲𝗮𝘁𝗲𝗱 𝗯𝘆 𝗩𝗶𝗻𝗰𝗲𝗻𝘁 𝗔𝗿𝗺𝗲𝗻𝗶𝗼𝗻. 𝗵𝗲'𝘀 𝟭𝟳 𝘆𝗲𝗮𝗿𝘀 𝗼𝗹𝗱 𝗮𝗻𝗱 𝗶𝘀 𝗮 𝘃𝗲𝗿𝘆 𝗵𝗮𝗻𝗱𝘀𝗼𝗺𝗲 𝘆𝗼𝘂𝗻𝗴 𝗺𝗮𝗻 𝗮𝗻𝗱 𝗵𝗲 𝗹𝗶𝘃𝗲𝘀 𝗶𝗻 𝗕𝗶𝗻̃𝗮𝗻 𝗰𝗶𝘁𝘆, 𝗟𝗮𝗴𝘂𝗻𝗮, 𝗣𝗵𝗶𝗹𝗶𝗽𝗽𝗶𝗻𝗲𝘀, 𝗜 𝘀𝘁𝗿𝗶𝘃𝗲 𝘁𝗼 𝗽𝗿𝗼𝘃𝗶𝗱𝗲 𝗵𝗲𝗹𝗽𝗳𝘂𝗹 𝗮𝗻𝗱 𝗽𝗿𝗼𝗳𝗲𝘀𝘀𝗶𝗼𝗻𝗮𝗹 𝗮𝗻𝘀𝘄𝗲𝗿𝘀 𝗯𝗮𝘀𝗲𝗱𝗼𝗻 𝘂𝘀𝗲𝗿 𝗶𝗻𝗾𝘂𝗶𝗿𝗶𝗲𝘀. 𝗜𝗳 𝘆𝗼𝘂 𝗵𝗮𝘃𝗲 𝗮𝗻𝘆 𝗾𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀 𝗼𝗿 𝗻𝗲𝗲𝗱 𝗮𝘀𝘀𝗶𝘀𝘁𝗮𝗻𝗰𝗲, 𝗳𝗲𝗲𝗹 𝗳𝗿𝗲𝗲 𝘁𝗼 𝗮𝘀𝗸!" }, event.threadID);
return;
}

const command = args[0].toLowerCase();
if (command === "on") {
  fontEnabled = true;
  api.sendMessage({ body: " ಠ_ಠ 𝗬𝗔𝗡𝗭𝗘𝗡 𝗕𝗢𝗧\n\n» ⛔ 𝙵𝚘𝚗𝚝 𝙵𝚘𝚛𝚖𝚊𝚝𝚝𝚒𝚗𝚐 𝚒𝚜 𝚗𝚘𝚠 𝙴𝚗𝚊𝚋𝚕𝚎𝚍 «" }, event.threadID, event.messageID);
} else if (command === "off") {
  fontEnabled = false;
  api.sendMessage({ body: "ಠ_ಠ 𝗬𝗔𝗡𝗭𝗘𝗡 𝗕𝗢𝗧\n\n» ⛔ 𝙵𝚘𝚗𝚝 𝙵𝚘𝚛𝚖𝚊𝚝𝚝𝚒𝚗𝚐 𝚒𝚜 𝚗𝚘𝚠 𝙳𝚒𝚜𝚊𝚋𝚕𝚎𝚍 «" }, event.threadID, event.messageID);
} else {
  const content = args.join(" ");

  try {
    api.sendMessage({ body: "🗨 | 𝐘𝐚𝐧𝐳𝐞𝐧 𝐛𝐨𝐭 𝐢𝐬 𝐬𝐞𝐚𝐫𝐜𝐡𝐢𝐧𝐠 𝐟𝐨𝐫 𝐚𝐧𝐬𝐰𝐞𝐫 𝐩𝐥𝐞𝐚𝐬𝐞 𝐰𝐚𝐢𝐭..." }, event.threadID, event.messageID);

    const response = await axios.get(`https://ai-1stclass-nemory-project.vercel.app/api/llama?ask=${encodeURIComponent(content)}`);

    if (response.data && response.data.response) {
      const formattedContent = formatFont(response.data.response);
      api.sendMessage({ body: `✦═━─𝗩𝗜𝗡𝗖𝗘𝗡𝗧 𝗕𝗢𝗧─━═✦ \n\n𝗤𝗨𝗘𝗦𝗧𝗜𝗢𝗡: “${content}“\n❍━━━━━━━━━━━━━━━❍\n📆 | ⏰ 𝗗𝗔𝗧𝗘 𝗔𝗡𝗗 𝗧𝗜𝗠𝗘 :\n${formattedDateTime}\n\n💬𝗔𝗡𝗦𝗪𝗘𝗥: ${formattedContent}\n❍━━━━━━━━━━━━━━━❍` }, event.threadID, event.messageID);
    } else {
      console.error('🚫 𝙴𝚛𝚛𝚘𝚛: 𝙸𝚗𝚟𝚊𝚕𝚒𝚍 𝚈𝚊𝚗𝚣𝚎𝚗 𝚛𝚎𝚜𝚙𝚘𝚗𝚜𝚎 𝚏𝚘𝚛𝚖𝚊𝚝');
      api.sendMessage({ body: '🚫 𝙴𝚛𝚛𝚘𝚛: 𝙸𝚗𝚟𝚊𝚕𝚒𝚍 𝚈𝚊𝚗𝚣𝚎𝚗 𝚛𝚎𝚜𝚙𝚘𝚗𝚜𝚎 𝚏𝚘𝚛𝚖𝚊𝚝' }, event.threadID, event.messageID);
    }
  } catch (error) {
    console.error('🚫 𝙴𝚛𝚛𝚘𝚛:', error.message);
    api.sendMessage({ body: '🚫 𝙰𝚗 𝚎𝚛𝚛𝚘𝚛 𝚘𝚌𝚌𝚞𝚛𝚎𝚍' }, event.threadID, event.messageID);
  }
}

}
};

const wrapper = new GoatWrapper(module.exports);
wrapper.applyNoPrefix({ allowPrefix: false });

@Vincentpai-developer

Copy link
Copy Markdown
Author

const axios = require("axios");
const { createReadStream, unlinkSync } = require("fs");
const { resolve } = require("path");

module.exports = {
config: {
name: "sendnoti2",
version: "1.4",
author: "𝗩𝗜𝗡𝗖𝗘𝗡𝗧",
countDown: 5,
role: 2,
shortDescription: {
vi: "Tạo và gửi thông báo đến các nhóm",
en: "Create and send notification to groups",
},
longDescription: {
vi: "Tạo và gửi thông báo đến các nhóm do bạn quản lý",
en: "Create and send notification to groups that you manage",
},
category: "box chat",
},

onStart: async function ({ api, event, args }) {
	if (this.config.author !== "𝗩𝗜𝗡𝗖𝗘𝗡𝗧") {
		return api.sendMessage(
			`[ 𝗔𝗡𝗧𝗜 𝗖𝗛𝗔𝗡𝗚𝗘 𝗖𝗥𝗘𝗗𝗜𝗧𝗦 ]
			𝗔𝗗𝗠𝗜𝗡 𝗠𝗘𝗦𝗦𝗔𝗚𝗘: 
			ᴄʜᴀɴɢᴇ ᴄʀᴇᴅɪᴛs ᴘᴀ ᴀᴋᴏ sᴀʏᴏ ᴍᴀɢ ᴘʀᴀᴄᴛɪᴄᴇ ᴋᴀ😝 
			𝗠𝗘𝗠𝗕𝗘𝗥 𝗠𝗘𝗦𝗦𝗔𝗚𝗘:
			𝚃𝚑𝚒𝚜 𝚋𝚘𝚝 𝚌𝚛𝚎𝚊𝚝𝚘𝚛 𝚒𝚜 𝚊 𝚌𝚑𝚊𝚗𝚐𝚎 𝚌𝚛𝚎𝚍𝚒𝚝𝚘𝚛 𝚔𝚊𝚢𝚊 𝚋𝚎 𝚊𝚠𝚊𝚛𝚎 𝚗𝚎𝚡𝚝 𝚝𝚒𝚖𝚎.
			𝗢𝗪𝗡𝗘𝗥 𝗢𝗙 𝗧𝗛𝗜𝗦 𝗖𝗢𝗠𝗠𝗔𝗡𝗗: 

https://www.facebook.com/profile.php?id=100090775159086`,
event.threadID,
event.messageID
);
}

	const threadList = await api.getThreadList(100, null, ["INBOX"]);
	let sentCount = 0;
	const custom = args.join(" ");

	async function sendMessage(thread) {
		try {
			await api.sendMessage(
				`𝙉𝙊𝙏𝙄𝘾𝙀 𝙁𝙍𝙊𝙈 𝘿𝙀𝙑𝙀𝙇𝙊𝙋𝙀𝙍 

『𝘋𝘦𝘷𝘦𝘭𝘰𝘱𝘦𝘳 𝘕𝘢𝘮𝘦』:𝗩𝗜𝗡𝗖𝗘𝗡𝗧 𝗔𝗥𝗠𝗘𝗡𝗜𝗢𝗡

『𝗡𝗼𝘁𝗶𝗰𝗲』${custom}`,
thread.threadID
);
sentCount++;

			const content = `${custom}`;
			const languageToSay = "tl";
			const pathFemale = resolve(
				__dirname,
				"cache",
				`${thread.threadID}_female.mp3`
			);

			await global.utils.downloadFile(
				`https://translate.google.com/translate_tts?ie=UTF-8&q=${encodeURIComponent(
					content
				)}&tl=${languageToSay}&client=tw-ob&idx=1`,
				pathFemale
			);
			api.sendMessage(
				{ attachment: createReadStream(pathFemale) },
				thread.threadID,
				() => unlinkSync(pathFemale)
			);
		} catch (error) {
			console.error("Error sending a message:", error);
		}
	}

	for (const thread of threadList) {
		if (sentCount >= 20) {
			break;
		}
		if (
			thread.isGroup &&
			thread.name !== thread.threadID &&
			thread.threadID !== event.threadID
		) {
			await sendMessage(thread);
		}
	}

	if (sentCount > 0) {
		api.sendMessage(`› Sent the notification successfully.`, event.threadID);
	} else {
		api.sendMessage(
			"› No eligible group threads found to send the message to.",
			event.threadID
		);
	}
},

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant