refactor: change all Robot to Bot (#1767)

* Change all `Robot` to `Bot`

* Change all `r` of `Bot` to `b`

* Change `Robot` to `bot` in comments

* Fix typo

---------

Co-authored-by: Athurg Feng <athurg@gooth.org>
This commit is contained in:
Athurg Gooth
2023-05-29 19:49:05 +08:00
committed by GitHub
parent ddf4cae537
commit 845297ec03
16 changed files with 80 additions and 80 deletions

View File

@ -35,8 +35,8 @@ const (
SystemSettingLocalStoragePathName SystemSettingName = "local-storage-path"
// SystemSettingOpenAIConfigName is the name of OpenAI config.
SystemSettingOpenAIConfigName SystemSettingName = "openai-config"
// SystemSettingTelegramRobotToken is the name of Telegram Robot Token.
SystemSettingTelegramRobotTokenName SystemSettingName = "telegram-robot-token"
// SystemSettingTelegramBotToken is the name of Telegram Bot Token.
SystemSettingTelegramBotTokenName SystemSettingName = "telegram-bot-token"
SystemSettingMemoDisplayWithUpdatedTsName SystemSettingName = "memo-display-with-updated-ts"
)
@ -87,8 +87,8 @@ func (key SystemSettingName) String() string {
return "local-storage-path"
case SystemSettingOpenAIConfigName:
return "openai-config"
case SystemSettingTelegramRobotTokenName:
return "telegram-robot-token"
case SystemSettingTelegramBotTokenName:
return "telegram-bot-token"
case SystemSettingMemoDisplayWithUpdatedTsName:
return "memo-display-with-updated-ts"
}
@ -178,11 +178,11 @@ func (upsert SystemSettingUpsert) Validate() error {
if err := json.Unmarshal([]byte(upsert.Value), &value); err != nil {
return fmt.Errorf(systemSettingUnmarshalError, settingName)
}
case SystemSettingTelegramRobotTokenName:
case SystemSettingTelegramBotTokenName:
if upsert.Value == "" {
return nil
}
// Robot Token with Reverse Proxy shoule like `http.../bot<token>`
// Bot Token with Reverse Proxy shoule like `http.../bot<token>`
if strings.HasPrefix(upsert.Value, "http") {
slashIndex := strings.LastIndexAny(upsert.Value, "/")
if strings.HasPrefix(upsert.Value[slashIndex:], "/bot") {