Last active
January 28, 2022 21:19
-
-
Save spark-shadow/8f4ddb82c438f30aacbc8c3bcf6e5a48 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: "group subject changer", }, async (message, match) => { | |
//group subject 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.groupUpdateSubject(message.jid, match); | |
await message.client.sendMessage(message.jid,'```Group Name Changed To``` *' + 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