From 4c72c83dcdaaa992d601b212f30b69ce148a3605 Mon Sep 17 00:00:00 2001 From: purpshell Date: Tue, 23 Aug 2022 20:43:36 +0300 Subject: [PATCH] example update --- example.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/example.js b/example.js index eb89222..e84234b 100644 --- a/example.js +++ b/example.js @@ -32,6 +32,12 @@ client.on('ready', () => { client.on('message', async msg => { console.log('MESSAGE RECEIVED', msg); + if (msg.selectedButtonId == 'test') { + return msg.reply('You clicked the button!'); + } else if (msg.selectedRowId == 'test') { + return msg.reply('You clicked that section'); + } + if (msg.body === '!ping reply') { // Send a new message as a reply to the current one msg.reply('pong'); @@ -200,11 +206,19 @@ client.on('message', async msg => { ); client.sendMessage(msg.from, button); } else if (msg.body === '!list') { - let sections = [{title:'sectionTitle',rows:[{title:'ListItem1', description: 'desc'},{title: 'Try clicking me (id: test)', }]}]; - let list = new List('List body','btnText',sections,'Title','footer'); - client.sendMessage(msg.from, list); + let sections = [ + { + title: 'Secton title', + rows: [ + {title:'ListItem1', description: 'desc'}, + {title: 'Try clicking me (id: test)', id: 'test'} + ] + } + ]; + let list = new List('List body', 'btnText', sections, 'Custom title', 'custom footer, google.com'); + await client.sendMessage(msg.from, list); } else if (msg.body === '!reaction') { - msg.react('👍'); + await msg.react('👍'); } });