-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
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; |