(sock, message, args, context)
| 7 | groupOnly: true, |
| 8 | adminOnly: true, |
| 9 | async handler(sock, message, args, context) { |
| 10 | const chatId = context.chatId || message.key.remoteJid; |
| 11 | const name = args.join(' ').trim(); |
| 12 | if (!name) { |
| 13 | await sock.sendMessage(chatId, { |
| 14 | text: '❌ *Please provide a group name*\n\nUsage: `.setgname <new name>`' |
| 15 | }, { quoted: message }); |
| 16 | return; |
| 17 | } |
| 18 | try { |
| 19 | await sock.groupUpdateSubject(chatId, name); |
| 20 | await sock.sendMessage(chatId, { |
| 21 | text: `✅ *Group name updated to:*\n${name}` |
| 22 | }, { quoted: message }); |
| 23 | } |
| 24 | catch (error) { |
| 25 | console.error('Error updating group name:', error); |
| 26 | await sock.sendMessage(chatId, { |
| 27 | text: '❌ *Failed to update group name*\n\nMake sure the bot is an admin.' |
| 28 | }, { quoted: message }); |
| 29 | } |
| 30 | } |
| 31 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected