Deps + Made "cooldown" lib more generic as a timer lib
This commit is contained in:
@ -28,7 +28,7 @@ func Ask(ctx context.Context, data cmdroute.CommandData) *api.InteractionRespons
|
||||
}
|
||||
|
||||
if err := data.Options.Unmarshal(&options); err != nil {
|
||||
lib.CancelCooldown(data.Event.Member.User.ID.String(), "ask")
|
||||
lib.CancelTimer(data.Event.Member.User.ID.String(), "ask")
|
||||
return lib.ErrorResponse(err)
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ func Ask(ctx context.Context, data cmdroute.CommandData) *api.InteractionRespons
|
||||
|
||||
if err != nil {
|
||||
fmt.Printf("ChatCompletion error: %v\n", err)
|
||||
lib.CancelCooldown(data.Event.Member.User.ID.String(), "ask")
|
||||
lib.CancelTimer(data.Event.Member.User.ID.String(), "ask")
|
||||
return &api.InteractionResponseData{
|
||||
Content: option.NewNullableString("ChatCompletion Error!"),
|
||||
AllowedMentions: &api.AllowedMentions{},
|
||||
|
@ -27,7 +27,7 @@ func Pic(ctx context.Context, data cmdroute.CommandData) *api.InteractionRespons
|
||||
}
|
||||
|
||||
if err := data.Options.Unmarshal(&options); err != nil {
|
||||
lib.CancelCooldown(data.Event.Member.User.ID.String(), "pic")
|
||||
lib.CancelTimer(data.Event.Member.User.ID.String(), "pic")
|
||||
return lib.ErrorResponse(err)
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ func Pic(ctx context.Context, data cmdroute.CommandData) *api.InteractionRespons
|
||||
imageFile, err := lib.ReplicateImageGeneration(options.Prompt, filename)
|
||||
|
||||
if err != nil {
|
||||
lib.CancelCooldown(data.Event.Member.User.ID.String(), "pic")
|
||||
lib.CancelTimer(data.Event.Member.User.ID.String(), "pic")
|
||||
return lib.ErrorResponse(err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user