refactor(store): remove system bot user fallback

This commit is contained in:
memoclaw 2026-03-24 22:13:38 +08:00
parent 4f6730a12e
commit 74dc4fee79
2 changed files with 0 additions and 25 deletions

View File

@ -91,14 +91,6 @@ func TestUserGetByID(t *testing.T) {
require.NoError(t, err)
require.Nil(t, notFound)
// Get system bot
systemBotID := store.SystemBotID
systemBot, err := ts.GetUser(ctx, &store.FindUser{ID: &systemBotID})
require.NoError(t, err)
require.NotNil(t, systemBot)
require.Equal(t, store.SystemBotID, systemBot.ID)
require.Equal(t, "system_bot", systemBot.Username)
ts.Close()
}

View File

@ -23,20 +23,6 @@ func (e Role) String() string {
}
}
const (
SystemBotID int32 = 0
)
var (
SystemBot = &User{
ID: SystemBotID,
Username: "system_bot",
Role: RoleAdmin,
Email: "",
Nickname: "Bot",
}
)
type User struct {
ID int32
@ -125,9 +111,6 @@ func (s *Store) ListUsers(ctx context.Context, find *FindUser) ([]*User, error)
func (s *Store) GetUser(ctx context.Context, find *FindUser) (*User, error) {
if find.ID != nil {
if *find.ID == SystemBotID {
return SystemBot, nil
}
if cache, ok := s.userCache.Get(ctx, string(*find.ID)); ok {
user, ok := cache.(*User)
if ok {