-
-
Save canuxBro/7952cf0f0c8008effcffee49a2ab874e to your computer and use it in GitHub Desktop.
Group subject & desc chanager
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
const Shadow = require("../Utilis/events"); | |
const {MessageType, GroupSettingChange} = require('@adiwajshing/baileys') | |
const got = require("got") | |
const axios = require('axios') | |
async function checkImAdmin(message, user = message.client.user.jid) { | |
var grup = await message.client.groupMetadata(message.jid); | |
var spark = grup['participants'].map((member) => { | |
if (member.jid.split("@")[0] == user.split("@")[0] && member.isAdmin) return true; else; return false; | |
}); | |
return spark.includes(true); | |
} | |
Shadow.addCommand({ pattern: 'rename ?(.*)', onlyGroup: true, fromMe: true, desc: "🔛සමූහයේ නම වෙනස් කිරීම", }, async (message, match) => { | |
//group subject changer by shadow | |
var shadow = await checkImAdmin(message) | |
if (!shadow) return await message.client.sendMessage(message.jid,'*⚠මම ඇඩ්මින් වරයෙකු නොවේ*',MessageType.text) | |
if (match === '') return await message.client.sendMessage(message.jid,'*විධානයට පසු නම ලබා දෙන්න/n▫ex:-rename* ```family buisnesss```',MessageType.text) | |
await message.client.groupUpdateSubject(message.jid, match); | |
await message.client.sendMessage(message.jid,'```🔰සමූහයේ අලුත් නම``` *' + match + '*' ,MessageType.text) | |
}); | |
Shadow.addCommand({ pattern: 'setdesc ?(.*)', onlyGroup: true, fromMe: true, desc: "group description changer", }, async (message, match) => { | |
//group description changer by shadow | |
var shadow = await checkImAdmin(message) | |
if (!shadow) return await message.client.sendMessage(message.jid,'```i am not admin```',MessageType.text) | |
if (match === '') return await message.client.sendMessage(message.jid,'```Type something after command```',MessageType.text) | |
await message.client.groupUpdateDescription(message.jid, match); | |
await message.client.sendMessage(message.jid,'```Group description Changed To``` *' + match + '*' ,MessageType.text) | |
}); | |
module.exports = { | |
checkImAdmin: checkImAdmin | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment