Skip to content

Commit

Permalink
fix: ensure that we attached our Guild ID to the service configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvrs committed Nov 26, 2024
1 parent c0861f4 commit 3bc64e4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions examples/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,19 @@ type PingServiceConfiguration struct {

func (s *PingService) Create(mng *fuse.GuildManager) (fuse.Service, error) {
var config PingServiceConfiguration

number := rand.Intn(128)
logger.Info("Generated number", "number", number)
// fetch the service config from the database and assign a random number to it
if err := mng.FetchServiceConfig(&config, PingServiceConfiguration{RandomNumber: rand.Int()}); err != nil {
if err := mng.FetchServiceConfig(&config, PingServiceConfiguration{RandomNumber: number}); err != nil {
return nil, err
}

logger.Info("Fetched number", "number", config.RandomNumber)
return &PingService{config: config}, nil
}

func (s *PingService) Start(mng *fuse.GuildManager) error {

// ...
return nil
}
Expand Down

0 comments on commit 3bc64e4

Please sign in to comment.