Replies: 2 comments 2 replies
-
Local image path doesn't work in any situation, you may have to upload the file on the internet and set the URL accessible publicly. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Found a solution by changing the function as follows: "send_image": func(s *discordgo.Session, i *discordgo.InteractionCreate) { // <--- Stop using Single Letter Variable Names >:(
fmt.Println("send_image.go: send_image() called")
fileName := "PATHTOFILE"
f, err := os.Open(fileName)
defer f.Close()
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "Here's the local B-field of my room:",
Files: []*discordgo.File{
&discordgo.File{
Name: fileName,
Reader: f,
},
},
},
})
}, |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My goal is to generate a plot from data and send the final image in the channel where the slash command was executed. So far everything works, except I'm unable to send the image.
I first registered the slash command, this works flawlessly but then when I want to execute it, it times out every time. Unfortunately, I couldn't find any similar example.
I'm not sure if embeds are the right approach here, but I couldn't find a better one. Btw, when entering a URL to an existing image uploaded on the internet, it works without complaining. I would tremendously appreciate some help.
Beta Was this translation helpful? Give feedback.
All reactions