Skip to content

Instantly share code, notes, and snippets.

@spark-shadow
Last active January 28, 2022 21:19
Show Gist options
  • Save spark-shadow/8f4ddb82c438f30aacbc8c3bcf6e5a48 to your computer and use it in GitHub Desktop.
Save spark-shadow/8f4ddb82c438f30aacbc8c3bcf6e5a48 to your computer and use it in GitHub Desktop.
Group subject & desc chanager
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