mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
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:
@@ -26,7 +26,7 @@ type Server struct {
|
||||
Profile *profile.Profile
|
||||
Store *store.Store
|
||||
|
||||
telegramRobot *telegram.Robot
|
||||
telegramBot *telegram.Bot
|
||||
}
|
||||
|
||||
func NewServer(ctx context.Context, profile *profile.Profile) (*Server, error) {
|
||||
@@ -48,8 +48,8 @@ func NewServer(ctx context.Context, profile *profile.Profile) (*Server, error) {
|
||||
storeInstance := store.New(db.DBInstance, profile)
|
||||
s.Store = storeInstance
|
||||
|
||||
telegramRobotHandler := newTelegramHandler(storeInstance)
|
||||
s.telegramRobot = telegram.NewRobotWithHandler(telegramRobotHandler)
|
||||
telegramBotHandler := newTelegramHandler(storeInstance)
|
||||
s.telegramBot = telegram.NewBotWithHandler(telegramBotHandler)
|
||||
|
||||
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
|
||||
Format: `{"time":"${time_rfc3339}",` +
|
||||
@@ -125,7 +125,7 @@ func (s *Server) Start(ctx context.Context) error {
|
||||
return errors.Wrap(err, "failed to create activity")
|
||||
}
|
||||
|
||||
go s.telegramRobot.Start(ctx)
|
||||
go s.telegramBot.Start(ctx)
|
||||
|
||||
return s.e.Start(fmt.Sprintf(":%d", s.Profile.Port))
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find system setting list").SetInternal(err)
|
||||
}
|
||||
for _, systemSetting := range systemSettingList {
|
||||
if systemSetting.Name == api.SystemSettingServerIDName || systemSetting.Name == api.SystemSettingSecretSessionName || systemSetting.Name == api.SystemSettingOpenAIConfigName || systemSetting.Name == api.SystemSettingTelegramRobotTokenName {
|
||||
if systemSetting.Name == api.SystemSettingServerIDName || systemSetting.Name == api.SystemSettingSecretSessionName || systemSetting.Name == api.SystemSettingOpenAIConfigName || systemSetting.Name == api.SystemSettingTelegramBotTokenName {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@@ -21,8 +21,8 @@ func newTelegramHandler(store *store.Store) *telegramHandler {
|
||||
return &telegramHandler{store: store}
|
||||
}
|
||||
|
||||
func (t *telegramHandler) RobotToken(ctx context.Context) string {
|
||||
return t.store.GetSystemSettingValueOrDefault(&ctx, api.SystemSettingTelegramRobotTokenName, "")
|
||||
func (t *telegramHandler) BotToken(ctx context.Context) string {
|
||||
return t.store.GetSystemSettingValueOrDefault(&ctx, api.SystemSettingTelegramBotTokenName, "")
|
||||
}
|
||||
|
||||
func (t *telegramHandler) MessageHandle(ctx context.Context, message telegram.Message, blobs map[string][]byte) error {
|
||||
|
Reference in New Issue
Block a user