Skip to content

Commit

Permalink
NICKSERV identify if NICKSERV_PASSWORD env exists
Browse files Browse the repository at this point in the history
  • Loading branch information
cfindlayisme committed Jan 3, 2024
1 parent 15ab9c4 commit 98c110f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ See `docker-compose.yml` for an example of how to launch the bot. Just have to c
- IRC_CHANNEL
- IRC_NICK
- PASSWORD (Not IRC password, but password for the webhook. Sort of like an API key you define)
- NICKSERV_PASSWORD (Optional)

## JSON format
POST to /message with the following JSON format:
Expand Down
4 changes: 4 additions & 0 deletions env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ func GetNick() string {
func GetWebhookPassword() string {
return os.Getenv("PASSWORD")
}

func GetNickservPassword() string {
return os.Getenv("NICKSERV_PASSWORD")
}
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ func main() {

ircclient.SetNick(env.GetNick())
ircclient.SetUser()
if env.GetNickservPassword() != "" {
ircclient.SendMessage("NickServ", "IDENTIFY "+env.GetNickservPassword())
}
ircclient.JoinChannel(env.GetChannel())

router := gin.Default()
Expand Down

0 comments on commit 98c110f

Please sign in to comment.