-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add option to disable URL unfurling in Slacker
Add a feature to allow users to choose not to unfurl a URL or link when using Slacker. This is useful for cases where unfurling is not desired or necessary. Additionally, a test case for this feature has been added to main.go. Closes #11 unfurling option not working properly fix: typo for greptile feat: slacker now handles unfurling option + main.go for testing purpose fix: main.go now uses a youtube URL
- Loading branch information
1 parent
1f4269a
commit 04d4e71
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// main.go | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"log" | ||
"os" | ||
|
||
"github.com/slack-io/slacker" | ||
) | ||
|
||
// Defining commands using slacker | ||
|
||
func main() { | ||
bot := slacker.NewClient(os.Getenv("SLACK_BOT_TOKEN"), os.Getenv("SLACK_APP_TOKEN")) | ||
|
||
bot.AddCommand(&slacker.CommandDefinition{ | ||
Command: "without", | ||
Handler: func(ctx *slacker.CommandContext) { | ||
ctx.Response().Reply("https://www.youtube.com/watch?v=dQw4w9WgXcQ", slacker.WithUnfurlLinks(false)) | ||
}, | ||
}) | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
err := bot.Listen(ctx) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters