Improve the wording in the placeholder embed and optimize the timer
All checks were successful
Build and push container image / build (push) Successful in 39s
All checks were successful
Build and push container image / build (push) Successful in 39s
This commit is contained in:
parent
c5d38e7e32
commit
e41be91a4c
@ -5,6 +5,7 @@ import (
|
||||
"corn-util/bot/toolbox"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
@ -20,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
mainEmbedColor = 0xff69b4 //0xf9c62c - main embed color for the bot (saffron / yellow)
|
||||
mainEmbedColor = 0xf9c62c // main embed color for the bot (saffron / yellow)
|
||||
noPermText = "You need to have a role with `Manage Server` permission to use this command."
|
||||
attemptFailText = "There was an attempt..."
|
||||
noConfigValText = "Unconfigured"
|
||||
@ -110,6 +111,13 @@ func ListenForCommand(e *events.ApplicationCommandInteractionCreate) {
|
||||
jsonDataBytes, _ := json.Marshal(readData)
|
||||
json.Unmarshal(jsonDataBytes, &jsonData)
|
||||
|
||||
type googleServiceAccStruct struct {
|
||||
ClientEmail string `json:"client_email"`
|
||||
}
|
||||
readGCPJSON, _ := os.ReadFile("GCP_SERVICE.json")
|
||||
googleServiceAcc := googleServiceAccStruct{}
|
||||
json.Unmarshal(readGCPJSON, &googleServiceAcc)
|
||||
|
||||
banRecordsCh, _ := e.SlashCommandInteractionData().OptChannel("ban-records")
|
||||
googleSpreadsheet_Id, _ := e.SlashCommandInteractionData().OptString("google-spreadsheet-id")
|
||||
|
||||
@ -159,8 +167,9 @@ func ListenForCommand(e *events.ApplicationCommandInteractionCreate) {
|
||||
if _, err := e.Client().Rest().CreateMessage(banRecordsCh.ID, discord.MessageCreate{
|
||||
Embeds: []discord.Embed{
|
||||
{
|
||||
Description: "Ban records on Google Sheets will now be sent in this channel.",
|
||||
Color: mainEmbedColor,
|
||||
Description: "Ban records on Google Sheets will now be sent in this channel.\n" +
|
||||
fmt.Sprintf("*Add the bot's service account to the spreadsheet for this to work:*\n`%v`", googleServiceAcc.ClientEmail),
|
||||
Color: mainEmbedColor,
|
||||
},
|
||||
},
|
||||
}); err != nil {
|
||||
|
8
main.go
8
main.go
@ -47,13 +47,11 @@ func main() {
|
||||
|
||||
log.Infof("Client ready!")
|
||||
log.Infof("Running Disgo %v & Go %v", disgo.Version, strings.TrimPrefix(runtime.Version(), "go"))
|
||||
client.Rest().CreateWebhookMessage(snowflake.MustParse(loaders.TokenLoader("hookId")), loaders.TokenLoader("hookToken"), discord.WebhookMessageCreate{
|
||||
Content: "Container has been reloaded.",
|
||||
}, true, 0)
|
||||
client.Rest().CreateWebhookMessage(snowflake.MustParse(loaders.TokenLoader("hookId")), loaders.TokenLoader("hookToken"), discord.WebhookMessageCreate{Content: "Container has been reloaded."}, true, 0)
|
||||
|
||||
ticker := time.NewTicker(30 * time.Second)
|
||||
defer ticker.Stop()
|
||||
go func() {
|
||||
ticker := time.NewTicker(30 * time.Second)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
|
Reference in New Issue
Block a user