Closed trajan0x closed 1 week ago
To add an option to disable link unfurls in the slacker library, follow these steps:
config.go
:// Add a new field to the Config struct
UnfurlLinks bool `yaml:"unfurl_links"`
commands.go
:// After unmarshalling the config file, add a check for the new field
if cfg.UnfurlLinks {
// Pass the unfurl links option to the bot
botServer := botmd.NewBot(metrics.Get(), cfg, slacker.WithUnfurlLinks(cfg.UnfurlLinks))
} else {
botServer := botmd.NewBot(metrics.Get(), cfg)
}
botmd.go
:// Modify the NewBot function to accept the new option
func NewBot(handler metrics.Handler, cfg config.Config, options ...slacker.Option) Bot {
server := slacker.NewClient(cfg.SlackBotToken, cfg.SlackAppToken, options...)
bot := Bot{
handler: handler,
cfg: cfg,
server: server,
}
bot.signozClient = signoz.NewClientFromUser(handler, cfg.SignozBaseURL, cfg.SignozEmail, cfg.SignozPassword)
bot.addCommands(bot.traceCommand(), bot.rfqLookupCommand())
return bot
}
These changes will allow the bot to disable link unfurls based on the configuration.
/contrib/opbot/cmd/commands.go /contrib/opbot/config/config.go /contrib/opbot/botmd/botmd.go /contrib/opbot
See slack-io/slacker#11
Add an option to the slacker lib to allow link unfurls to be disabled.
Something like this: https://app.greptile.com/share/9488bed2-1f06-4447-9587-cdf4021a05b4