mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
[+] Join groups by invite code
This commit is contained in:
@@ -64,6 +64,15 @@ client.on('message', async msg => {
|
||||
} else {
|
||||
msg.reply('This command can only be used in a group!');
|
||||
}
|
||||
} else if(msg.body.startsWith('!join ')) {
|
||||
const inviteCode = msg.body.split(' ')[1];
|
||||
|
||||
try {
|
||||
const chat = await client.acceptInvite(inviteCode);
|
||||
msg.reply(`Joined *${chat.name}*!`);
|
||||
} catch(e) {
|
||||
msg.reply('That invite code seems to be invalid.');
|
||||
}
|
||||
} else if(msg.body == '!groupinfo') {
|
||||
let chat = await msg.getChat();
|
||||
if(chat.isGroup) {
|
||||
|
||||
Reference in New Issue
Block a user