From 2598aa854ad6dd4b8b77d565bb9dc97f2ad019c3 Mon Sep 17 00:00:00 2001 From: Joren Date: Sat, 6 Jul 2024 17:52:22 +0200 Subject: [PATCH] Hm --- main.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/main.go b/main.go index 99b01c3..f32c8aa 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,7 @@ type Config struct { } type Discord struct { - Token string `toml:"client"` + Token string `toml:"token"` AppID string `toml:"appid"` GuildID string `toml:"guildid"` } @@ -128,9 +128,9 @@ var ( Type: discordgo.MessageApplicationCommand, }, } - commandsHandlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){ - "rickroll-em": func(s *discordgo.Session, i *discordgo.InteractionCreate) { - err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ + commandsHandlers = map[string]func(client *discordgo.Session, i *discordgo.InteractionCreate){ + "rickroll-em": func(client *discordgo.Session, i *discordgo.InteractionCreate) { + err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ Content: "Operation rickroll has begun", @@ -141,11 +141,11 @@ var ( panic(err) } - ch, err := s.UserChannelCreate( + ch, err := client.UserChannelCreate( i.ApplicationCommandData().TargetID, ) if err != nil { - _, err = s.FollowupMessageCreate(i.Interaction, true, &discordgo.WebhookParams{ + _, err = client.FollowupMessageCreate(i.Interaction, true, &discordgo.WebhookParams{ Content: fmt.Sprintf("Mission failed. Cannot send a message to this user: %q", err.Error()), Flags: discordgo.MessageFlagsEphemeral, }) @@ -153,7 +153,7 @@ var ( panic(err) } } - _, err = s.ChannelMessageSend( + _, err = client.ChannelMessageSend( ch.ID, fmt.Sprintf("%s sent you this: https://youtu.be/dQw4w9WgXcQ", i.Member.Mention()), ) @@ -162,7 +162,7 @@ var ( } }, "google-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) { - err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ + err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ Content: searchLink( @@ -176,7 +176,7 @@ var ( } }, "stackoverflow-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) { - err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ + err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ Content: searchLink( @@ -190,7 +190,7 @@ var ( } }, "godoc-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) { - err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ + err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ Content: searchLink( @@ -204,7 +204,7 @@ var ( } }, "discordjs-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) { - err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ + err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ Content: searchLink( @@ -218,7 +218,7 @@ var ( } }, "discordpy-it": func(s *discordgo.Session, i *discordgo.InteractionCreate) { - err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ + err := client.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ Content: searchLink(