goat
command
botnick
No description
0
views
0
likes
0
installs
Aliases: bn, setbotnick, botname
raw source
module.exports = {
config: {
name: "botnick",
aliases: ["bn", "setbotnick", "botname"],
version: "1.1",
author: "Grok",
countDown: 8,
role: 2, // Only Bot Admin
description: {
en: "Change bot nickname in all groups at once"
},
category: "admin",
guide: {
en: "{pn} <new nickname>\nExample: {pn} ❤️ GoatBot"
}
},
onStart: async function ({ api, event, args, message, threadsData }) {
const newNick = args.join(" ").trim();
if (!newNick) {
return message.reply("⚠️ Nickname den!\nExample: botnick ❤️ GoatBot");
}
// Sob group ber kora
const allThreads = await threadsData.getAll();
const groupThreads = allThreads.filter(t =>
t.isGroup &&
t.members?.some(m => m.userID == api.getCurrentUserID() && m.inGroup)
);
if (groupThreads.length === 0) {
return message.reply("❌ Kon o group pawa jayni.");
}
await message.reply(`⏳ Nickname "${newNick}" set hocche ${groupThreads.length} ta group e...\nPlease wait...`);
let success = 0;
let failed = 0;
for (const thread of groupThreads) {
try {
await api.changeNickname(newNick, thread.threadID, api.getCurrentUserID());
success++;
// Rate limit er jonno delay
await new Promise(resolve => setTimeout(resolve, 400));
} catch (err) {
failed++;
console.log(`Failed → ${thread.threadID}: ${err.message}`);
}
}
return message.reply(
`✅ Nickname change complete!\n` +
`📌 New Name: ${newNick}\n` +
`✅ Success: ${success} groups\n` +
`❌ Failed: ${failed} groups`
);
}
};