Spaces:
Paused
Paused
πππππππ πππππππ β‘
commited on
Update buttons.js
Browse files- plugins/buttons.js +51 -38
plugins/buttons.js
CHANGED
|
@@ -1,41 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
category: 'test',
|
| 10 |
filename: __filename
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const config = require('../config');
|
| 2 |
+
const { cmd, commands } = require('../command');
|
| 3 |
+
const { fetchJson } = require('../lib/functions');
|
| 4 |
|
| 5 |
|
| 6 |
+
cmd({
|
| 7 |
+
pattern: "testbutton",
|
| 8 |
+
alias: [],
|
| 9 |
+
react: "π",
|
| 10 |
+
desc: "Test buttons",
|
| 11 |
+
category: "test",
|
|
|
|
| 12 |
filename: __filename
|
| 13 |
+
}, async (conn, mek, m, {
|
| 14 |
+
from,
|
| 15 |
+
quoted,
|
| 16 |
+
body,
|
| 17 |
+
isCmd,
|
| 18 |
+
command,
|
| 19 |
+
args,
|
| 20 |
+
q,
|
| 21 |
+
isGroup,
|
| 22 |
+
sender,
|
| 23 |
+
senderNumber,
|
| 24 |
+
botNumber2,
|
| 25 |
+
botNumber,
|
| 26 |
+
pushname,
|
| 27 |
+
isMe,
|
| 28 |
+
isOwner,
|
| 29 |
+
groupName,
|
| 30 |
+
participants,
|
| 31 |
+
groupAdmins,
|
| 32 |
+
isBotAdmins,
|
| 33 |
+
isAdmins,
|
| 34 |
+
reply
|
| 35 |
+
}) => {
|
| 36 |
+
try {
|
| 37 |
+
const buttons = [
|
| 38 |
+
{ buttonId: 'id1', buttonText: { displayText: 'Button 1' }, type: 1 },
|
| 39 |
+
{ buttonId: 'id2', buttonText: { displayText: 'Button 2' }, type: 1 }
|
| 40 |
+
];
|
| 41 |
+
|
| 42 |
+
const buttonMessage = {
|
| 43 |
+
text: "Test buttons",
|
| 44 |
+
footer: "Button footer",
|
| 45 |
+
buttons: buttons,
|
| 46 |
+
headerType: 1
|
| 47 |
+
};
|
| 48 |
+
|
| 49 |
+
await reply(buttonMessage);
|
| 50 |
+
} catch (error) {
|
| 51 |
+
console.error(error);
|
| 52 |
+
reply(`An error occurred: ${error.message}`);
|
| 53 |
+
}
|
| 54 |
+
});
|