Slack-Bot is a communication tool used by developers and companies to share information and communicate. It has grown very popular in recent years.
In this Golang project , we’re building a slack bot that calculates age. To calculate a person’s age in years we just have to take the difference between the current year and their birth years.
1.Clone the repository: git clone : https://github.com/Poonam-13/Slack-Bot-Age-Calculator.git
2.Connecting to Slack from Golang:
mkdir slack-bot
cd slack-bot
go mod init
- Install the required dependencies:
go get github.com/slack-go/slack
go get -u github.com/poonam-13
-
Set up a new Slack app and obtain a bot token. You can create a new Slack app at api.slack.com/apps.
-
Update the
config.yaml
file with your bot token. -
Build and run the application:
go run main.go
- Invite the bot to your Slack workspace and channel.
-
In your Slack workspace, invite the bot to a channel by mentioning the bot using the designated bot username.
-
In the channel, you can use the following command to calculate the age of a person:
/agecalc [date of birth]
/agecalc 1990-01-01
The bot will respond with the calculated age.
Contributions are welcome! If you'd like to contribute to the project.
This project utilizes the Slack API and the slack-go
library. See the Slack API documentation and slack-go repository for more information.
If you have any questions, feedback, or suggestions, please feel free to reach out: