Introduce global bot name placeholder #979
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Changes proposed in this pull request:
{{BotName}}
(api.MessageBotNamePlaceholder
) placeholder in your messages, and it will be properly handled by a given communication platform. It works not only for commands, but also for all other message properties.Reason
Each bot (Slack, Discord, etc.) exposed the
BotName()
method and we were passing this across all our source-code. It was only to allow us to construct a proper interactive message. Such approach doesn't scale well. Paweł already introduced the concept of universal bot name placeholder, which is great. However, it was used only in notifier provider. In this PR, I use the universal bot placeholder across all our code base. Now it's up to the bot implementation to render the message with a proper bot name. Such decoupling is needed for extractingkubectl
as plugin as we can useapi.MessageBotNamePlaceholder
instead of passing and using a real bot name in each plugin.Testing
It's tested e2e, but if you want you can just install Botkube and play with interactive help, and kubectl builder.
Related issue(s)