Created
June 3, 2025 11:47
-
-
Save dipto-008/5f93dbdc40770d7eb7e7394cd8050b97 to your computer and use it in GitHub Desktop.
Hey noob ππ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios"); | |
const fs = require("fs"); | |
module.exports = { | |
config: { | |
name: "pending", | |
aliases: ['pend'], | |
version: "1.0", | |
author: "", | |
countDown: 5, | |
role: 2, | |
shortDescription: "accept pending message", | |
longDescription: "accept pending message", | |
category: "TOOLS", | |
}, | |
onReply: async function ({ message, api, event, usersData, Reply }) { | |
const { author, pending } = Reply; | |
if (String(event.senderID) !== String(author)) return; | |
const { body, threadID, messageID } = event; | |
let count = 0; | |
if (isNaN(body) && (body.startsWith("c") || body.startsWith("cancel"))) { | |
} else { | |
const indexes = body.split(/\s+/); | |
for (const singleIndex of indexes) { | |
if (isNaN(singleIndex) || singleIndex <= 0 || singleIndex > pending.length) { | |
return api.sendMessage(`β― ${singleIndex} Not a valid number`, threadID, messageID); | |
} | |
try { | |
api.unsendMessage(messageID); | |
/*const filePath = ".cache/pen.mp3"; | |
const path = require("path"); | |
const filePath = path.join(__dirname, "cache", "pen.mp3") || */ | |
const filePath = "http://remakeai-production.up.railway.app/Remake_Ai/Nyx_Remake_1745936834993.mp3"; | |
await api.changeNickname( | |
`NΓ½x RΓͺvΓͺnant`, | |
pending[singleIndex - 1].threadID, | |
api.getCurrentUserID() | |
); | |
await api.sendMessage({ | |
body: `Hey wassup I'm Nyx Bot Connected ${global.GoatBot.config.prefix}help for cmd`, | |
attachment: await global.utils.getStreamFromURL(filePath), | |
}, pending[singleIndex - 1].threadID); | |
count++; | |
} catch (error) { | |
console.error("[ ERR ]", error); | |
return api.sendMessage(` Failed to approve request: ${error.message}`, threadID, messageID); | |
} | |
} | |
setTimeout(() => { | |
const replyData = global.GoatBot.onReply.get(messageID); | |
if (replyData) { | |
global.GoatBot.onReply.delete(messageID); | |
api.unsendMessage(messageID); | |
} | |
}, 5000); | |
return api.sendMessage(`[ OK ] Successfully approved ${count} thread(s)!`, threadID, messageID); | |
} | |
}, | |
onStart: async function ({ message, api, event, args, usersData }) { | |
if (args.join() === "") { | |
return api.sendMessage("β― You can use pending:\nβ― Pending user: User queue\nβ― Pending thread: Group queue\nβ― Pending all: All boxes are waiting for approval", event.threadID, event.messageID); | |
} | |
const content = args.slice(1, args.length); | |
switch (args[0]) { | |
case "user": | |
case "u": | |
case "-u": | |
case "User": { | |
const permission = global.GoatBot.config.adminBot; | |
if (!permission.includes(event.senderID)) return api.sendMessage("[ OPPS ] You don't have permission to use this command!!", event.threadID, event.messageID); | |
const { threadID, messageID } = event; | |
const commandName = this.config.name; | |
var msg = "", index = 1; | |
try { | |
var spam = await api.getThreadList(100, null, ["OTHER"]) || []; | |
var pending = await api.getThreadList(100, null, ["PENDING"]) || []; | |
} catch (e) { | |
return api.sendMessage("[ ERR ] Can't get the current list", threadID, messageID); | |
} | |
const list = [...spam, ...pending].filter(group => group.isGroup === false); | |
for (const single of list) { | |
const userName = await usersData.getName(single.threadID); | |
msg += `${index++}/ ${userName}(${single.threadID})\n`; | |
} | |
if (list.length !== 0) { | |
return api.sendMessage(`β― Total number of users to browse: ${list.length} user \nβ― Reply number below to browse\n\n${msg}`, threadID, (error, info) => { | |
global.GoatBot.onReply.set(info.messageID, { | |
commandName, | |
messageID: info.messageID, | |
author: event.senderID, | |
pending: list | |
}); | |
}, messageID); | |
} else { | |
return api.sendMessage("[ - ] There are currently no users in the queue", threadID, messageID); | |
} | |
} | |
case "thread": | |
case "-t": | |
case "t": | |
case "Thread": { | |
const permission = global.GoatBot.config.adminBot; | |
if (!permission.includes(event.senderID)) return api.sendMessage("[ OPPS ] You don't have Permission to use this command!", event.threadID, event.messageID); | |
const { threadID, messageID } = event; | |
const commandName = this.config.name; | |
var msg = "", index = 1; | |
try { | |
var spam = await api.getThreadList(100, null, ["OTHER"]) || []; | |
var pending = await api.getThreadList(100, null, ["PENDING"]) || []; | |
} catch (e) { | |
return api.sendMessage("[ ERR ] can't get the current list", threadID, messageID); | |
} | |
const list = [...spam, ...pending].filter(group => group.isSubscribed && group.isGroup); | |
for (const single of list) { | |
const threadName = single.name || "Unknown"; | |
msg += `${index++}/ ${threadName}(${single.threadID})\n`; | |
} | |
if (list.length !== 0) { | |
return api.sendMessage(`β― Total number of groups to be approved: ${list.length} the group \nβ― Reply to the order number below to browse !!!\n${msg}`, threadID, (error, info) => { | |
global.GoatBot.onReply.set(info.messageID, { | |
commandName, | |
messageID: info.messageID, | |
author: event.senderID, | |
pending: list | |
}); | |
}, messageID); | |
} else { | |
return api.sendMessage("[ - ] There are currently no groups in the queue", threadID, messageID); | |
} | |
} | |
case "all": | |
case "a": | |
case "-a": | |
case "al": { | |
const permission = global.GoatBot.config.adminBot; | |
if (!permission.includes(event.senderID)) return api.sendMessage("[ OPPS ] You don't have Permission to use this command!!", event.threadID, event.messageID); | |
const { threadID, messageID } = event; | |
const commandName = this.config.name; | |
var msg = "", index = 1; | |
try { | |
var spam = await api.getThreadList(100, null, ["OTHER"]) || []; | |
var pending = await api.getThreadList(100, null, ["PENDING"]) || []; | |
} catch (e) { | |
return api.sendMessage("[ ERR ] Can't get the waiting list", threadID, messageID); | |
} | |
const listThread = [...spam, ...pending].filter(group => group.isSubscribed && group.isGroup); | |
const listUser = [...spam, ...pending].filter(group => group.isGroup === false); | |
const list = [...spam, ...pending].filter(group => group.isSubscribed); | |
for (const single of list) { | |
let displayName; | |
if (single.isGroup) { | |
displayName = single.name || "Unknown"; | |
} else { | |
if (single.threadID >= 1000) { | |
const userName = await usersData.getName(single.threadID); | |
displayName = userName || "Unknown"; | |
} else { | |
displayName = "Unknown"; | |
} | |
} | |
msg += `${index++}/ ${displayName}(${single.threadID})\n`; | |
} | |
if (list.length !== 0) { | |
return api.sendMessage(`β― Total number of Users & Threads to be approved: ${list.length} User & Thread \nβ― Reply to the order number below to browse !!!\n${msg}`, threadID, (error, info) => { | |
global.GoatBot.onReply.set(info.messageID, { | |
commandName, | |
messageID: info.messageID, | |
author: event.senderID, | |
pending: list | |
}); | |
}, messageID); | |
} else { | |
return api.sendMessage("[ - ] There are currently no User & Thread in the queue", threadID, messageID); | |
} | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment