Skip to content

Commit

Permalink
temporary fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Guru322 committed Oct 6, 2024
1 parent f2a64c1 commit 343015f
Showing 1 changed file with 41 additions and 29 deletions.
70 changes: 41 additions & 29 deletions plugins/gp-promote.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
let handler = async (m, { conn, usedPrefix, command, text }) => {
if (isNaN(text) && !text.match(/@/g)) {
} else if (isNaN(text)) {
var number = text.split`@`[1]
} else if (!isNaN(text)) {
var number = text
if (m.fromMe) {
return true
}
if (!text && !m.quoted)

let number;

if (text) {
if (isNaN(text)) {
if (text.includes('@')) {
number = text.split`@`[1];
} else {
return conn.reply(m.chat, `✳️ Invalid number format`, m);
}
} else {
number = text;
}
} else if (m.quoted) {
number = m.quoted.sender.split`@`[0];
}

if (!number)
return conn.reply(
m.chat,
`✳️ Using the command \n *${usedPrefix + command}* @tag (or reply to a message)`,
`✳️ Use the command \n *${usedPrefix + command}* @tag (or reply to a message)`,
m
)
if (number.length > 13 || (number.length < 11 && number.length > 0))
return conn.reply(m.chat, `✳️ Number incorrect`, m)
);

if (number.length > 13 || number.length < 11)
return conn.reply(m.chat, `✳️ Number incorrect`, m);

try {
if (text) {
var user = number + '@s.whatsapp.net'
} else if (m.quoted.sender) {
var user = m.quoted.sender
} else if (m.mentionedJid) {
var user = number + '@s.whatsapp.net'
}
let user = `${number}@s.whatsapp.net`;
await conn.groupParticipantsUpdate(m.chat, [user], 'promote');
m.reply(`✅ User promoted`);
} catch (e) {
} finally {
conn.groupParticipantsUpdate(m.chat, [user], 'promote')
m.reply(`✅ User promoted`)
console.error(e);
m.reply(`❌ Failed to promote user`);
}
}
handler.help = ['promote']
handler.tags = ['group']
handler.command = ['promote', 'promover']
handler.group = true
handler.admin = true
handler.botAdmin = true
handler.fail = null
};

handler.help = ['promote'];
handler.tags = ['group'];
handler.command = ['promote', 'promover'];
handler.group = true;
handler.admin = true;
handler.botAdmin = true;
handler.fail = null;

export default handler
export default handler;

0 comments on commit 343015f

Please sign in to comment.