AAAND its back
This commit is contained in:
49
main.go
49
main.go
@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"himbot/lib"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
@ -29,7 +30,7 @@ var commands = []api.CreateCommandData{
|
||||
},
|
||||
{
|
||||
Name: "ask",
|
||||
Description: "Ask Himbot!",
|
||||
Description: "Ask Himbot! Cooldown: 1 Minute.",
|
||||
Options: []discord.CommandOption{
|
||||
&discord.StringOption{
|
||||
OptionName: "prompt",
|
||||
@ -40,7 +41,7 @@ var commands = []api.CreateCommandData{
|
||||
},
|
||||
{
|
||||
Name: "pic",
|
||||
Description: "Generate an image using Stable Diffusion!",
|
||||
Description: "Generate an image using Stable Diffusion! Cooldown: 1 Minute.",
|
||||
Options: []discord.CommandOption{
|
||||
&discord.StringOption{
|
||||
OptionName: "prompt",
|
||||
@ -51,7 +52,7 @@ var commands = []api.CreateCommandData{
|
||||
},
|
||||
{
|
||||
Name: "hdpic",
|
||||
Description: "Generate an image using DALL·E 3!",
|
||||
Description: "Generate an image using DALL·E 3! Cooldown: 10 Minutes.",
|
||||
Options: []discord.CommandOption{
|
||||
&discord.StringOption{
|
||||
OptionName: "prompt",
|
||||
@ -130,13 +131,13 @@ func (h *handler) cmdPing(ctx context.Context, data cmdroute.CommandData) *api.I
|
||||
|
||||
func (h *handler) cmdAsk(ctx context.Context, data cmdroute.CommandData) *api.InteractionResponseData {
|
||||
// Cooldown Logic
|
||||
// cachedVal := lib.GetCache(data.Event.User.ID.String() + ":" + "ask")
|
||||
// if cachedVal != "nil" {
|
||||
// return &api.InteractionResponseData{
|
||||
// Content: option.NewNullableString("Please wait for the cooldown!"),
|
||||
// }
|
||||
// }
|
||||
// lib.SetCache(data.Event.User.ID.String()+":"+"ask", data.Event.User.ID.String()+":"+"ask", 1)
|
||||
cachedVal := lib.GetCache(data.Event.User.ID.String() + ":" + "ask")
|
||||
if cachedVal != "nil" {
|
||||
return &api.InteractionResponseData{
|
||||
Content: option.NewNullableString("Please wait for the cooldown!"),
|
||||
}
|
||||
}
|
||||
lib.SetCache(data.Event.User.ID.String()+":"+"ask", data.Event.User.ID.String()+":"+"ask", 1)
|
||||
|
||||
// Command Logic
|
||||
var options struct {
|
||||
@ -178,13 +179,13 @@ func (h *handler) cmdAsk(ctx context.Context, data cmdroute.CommandData) *api.In
|
||||
|
||||
func (h *handler) cmdPic(ctx context.Context, data cmdroute.CommandData) *api.InteractionResponseData {
|
||||
// Cooldown Logic
|
||||
// cachedVal := lib.GetCache(data.Event.User.ID.String() + ":" + "pic")
|
||||
// if cachedVal != "nil" {
|
||||
// return &api.InteractionResponseData{
|
||||
// Content: option.NewNullableString("Please wait for the cooldown!"),
|
||||
// }
|
||||
// }
|
||||
// lib.SetCache(data.Event.User.ID.String()+":"+"pic", data.Event.User.ID.String()+":"+"pic", 1)
|
||||
cachedVal := lib.GetCache(data.Event.User.ID.String() + ":" + "pic")
|
||||
if cachedVal != "nil" {
|
||||
return &api.InteractionResponseData{
|
||||
Content: option.NewNullableString("Please wait for the cooldown!"),
|
||||
}
|
||||
}
|
||||
lib.SetCache(data.Event.User.ID.String()+":"+"pic", data.Event.User.ID.String()+":"+"pic", 1)
|
||||
|
||||
// Command Logic
|
||||
var options struct {
|
||||
@ -256,13 +257,13 @@ func (h *handler) cmdPic(ctx context.Context, data cmdroute.CommandData) *api.In
|
||||
|
||||
func (h *handler) cmdHDPic(ctx context.Context, data cmdroute.CommandData) *api.InteractionResponseData {
|
||||
// Cooldown Logic
|
||||
// cachedVal := lib.GetCache(data.Event.User.ID.String() + ":" + "hdpic")
|
||||
// if cachedVal != "nil" {
|
||||
// return &api.InteractionResponseData{
|
||||
// Content: option.NewNullableString("Please wait for the cooldown!"),
|
||||
// }
|
||||
// }
|
||||
// lib.SetCache(data.Event.User.ID.String()+":"+"hdpic", data.Event.User.ID.String()+":"+"hdpic", 10)
|
||||
cachedVal := lib.GetCache(data.Event.User.ID.String() + ":" + "hdpic")
|
||||
if cachedVal != "nil" {
|
||||
return &api.InteractionResponseData{
|
||||
Content: option.NewNullableString("Please wait for the cooldown!"),
|
||||
}
|
||||
}
|
||||
lib.SetCache(data.Event.User.ID.String()+":"+"hdpic", data.Event.User.ID.String()+":"+"hdpic", 10)
|
||||
|
||||
// Command Logic
|
||||
var options struct {
|
||||
|
Reference in New Issue
Block a user