From 11fed97117f53b4c947113fcfd7a0a6419da553b Mon Sep 17 00:00:00 2001 From: codexkunal Date: Sun, 5 Jan 2025 18:34:37 +0530 Subject: [PATCH] Added the Newbie Advice Button Signed-off-by: codexkunal --- .env.example | 3 --- app.js | 6 ++++++ components/actions/actionResponses.js | 9 +++++++++ components/joinTeam.js | 16 ++++++++++++++++ components/newbie.js | 16 ++++++++++++++++ 5 files changed, 47 insertions(+), 3 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index 235cd9e..0000000 --- a/.env.example +++ /dev/null @@ -1,3 +0,0 @@ -SLACK_SIGNING_SECRET="" -SLACK_BOT_TOKEN="" -SLACK_APP_TOKEN="" \ No newline at end of file diff --git a/app.js b/app.js index d627038..d6df2ca 100644 --- a/app.js +++ b/app.js @@ -103,6 +103,12 @@ app.action("faqs", async ({ ack, say }) => { await ack(); theActions.faqs(say); }); + + +app.action("newbie_advice", async({ack, say}) => { + await ack(); + theActions.newbie_advice(say); + }) //****************************************** */ // When a user joins the team, the bot sends a DM to the newcommer asking them how they would like to contribute diff --git a/components/actions/actionResponses.js b/components/actions/actionResponses.js index 7ce39b9..8a60fba 100644 --- a/components/actions/actionResponses.js +++ b/components/actions/actionResponses.js @@ -88,6 +88,14 @@ async function faqs(say) { ); } +async function newbie_advice(say) { + return await say( + `You clicked *New to Open Source ? Get Advice* \n + Welcome to the CHAOSS Community! Starting your journey in open source can be exciting and rewarding. To help you get started, we have a detailed guide just for newcomers. You can find it here:\n . \n + This guide provides tips, best practices, and encouragement to help you make meaningful contributions. Remember, every contribution, big or small, matters. We're here to support you every step of the way! 🎉` + ); +} + module.exports = { develop, joinMeet, @@ -98,4 +106,5 @@ module.exports = { regional_chapters, learn_something_else, faqs, + newbie_advice }; diff --git a/components/joinTeam.js b/components/joinTeam.js index 1f421ac..add5af1 100644 --- a/components/joinTeam.js +++ b/components/joinTeam.js @@ -11,6 +11,22 @@ async function joinTeamSlack(event, client, logger) { text: `Welcome to *CHAOSS Community* <@${event.user.id}>! 🎉How would you like to get started? \n\nI want to..`, }, }, + { + type: 'actions', + elements: [ + { + type: 'button', + text: { + type: 'plain_text', + text: 'New to Open Source? Get Advice', + emoji: true, + }, + style: 'primary', + value: 'newbie_advice', + action_id: 'newbie_advice' + }, + ], + }, { type: 'actions', elements: [ diff --git a/components/newbie.js b/components/newbie.js index c692650..5f99cd2 100644 --- a/components/newbie.js +++ b/components/newbie.js @@ -10,6 +10,22 @@ async function newHere(message, client, logger) { text: `Welcome to *CHAOSS Community* <@${message.user}>! 🎉How would you like to get started? \n\nI want to..`, }, }, + { + type: 'actions', + elements: [ + { + type: 'button', + text: { + type: 'plain_text', + text: 'New to Open Source? Get Advice', + emoji: true, + }, + style: 'primary', + value: 'newbie_advice', + action_id: 'newbie_advice' + }, + ], + }, { type: 'actions', elements: [