Skip to content

Commit

Permalink
refactor(main): fix prefix and spe
Browse files Browse the repository at this point in the history
Signed-off-by: cuisongliu <cuisongliu@qq.com>
  • Loading branch information
cuisongliu committed Apr 19, 2023
1 parent 507d504 commit 5c7f649
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message:
- `debug` - 是否开启调试模式,设置为 true 时开启。
- `bot` \- 机器人配置。
- `copilot4prs` - 是否为 PR 启用 copilot 功能。
- `prefix` - 机器人命令前缀,用于识别命令。默认值 `/github`
- `prefix` - 机器人命令前缀,用于识别命令。默认值 `/`,如果设置为`/` 则 `spe` 失效。命令为`/release`
- `spe` - 机器人命令分隔符,用于识别命令。默认值 `_`
- `allowOps` - 允许操作的用户名列表。
- `email` - 机器人邮箱。
Expand Down
6 changes: 6 additions & 0 deletions pkg/bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ import (
)

func GetReleaseComment() string {
if types.GlobalsBotConfig.GetPrefix() == "/" {
return "/release"
}
return strings.Join([]string{types.GlobalsBotConfig.GetPrefix(), "release"}, types.GlobalsBotConfig.GetSpe())
}

func GetChangelogComment() string {
if types.GlobalsBotConfig.GetPrefix() == "/" {
return "/changelog"
}
return strings.Join([]string{types.GlobalsBotConfig.GetPrefix(), "changelog"}, types.GlobalsBotConfig.GetSpe())
}
2 changes: 1 addition & 1 deletion pkg/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Config struct {
// GetPrefix returns the prefix for the bot
func (r *Config) GetPrefix() string {
if r.Bot.Prefix == "" {
return "/github"
return "/"
}
return r.Bot.Prefix
}
Expand Down

0 comments on commit 5c7f649

Please sign in to comment.