Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

channel.SendMsg doesn't send the Components #506

Open
henriqueleite42 opened this issue Sep 10, 2022 · 0 comments
Open

channel.SendMsg doesn't send the Components #506

henriqueleite42 opened this issue Sep 10, 2022 · 0 comments
Assignees
Labels

Comments

@henriqueleite42
Copy link

This works:

s.Channel(channel.ID).WithContext(context.Background()).CreateMessage(&disgord.CreateMessage{
	Content: "Foo",
	Components: []*disgord.MessageComponent{
		{
			Type: 1,
			Components: []*disgord.MessageComponent{
				{
					Type: 2,
					CustomID: "FOO",
					Label: "Foo Bar",
					Style: 4,
				},
			},
		},
	},
})

And this doesn't work:

channel.SendMsg(context.Background(), s, &disgord.Message{
	Content: "Foo",
	Components: []*disgord.MessageComponent{
		{
			Type: 1,
			Components: []*disgord.MessageComponent{
				{
					Type: 2,
					CustomID: "FOO",
					Label: "Foo Bar",
					Style: 4,
				},
			},
		},
	},
})

My guess is that you need to add Components here, below the line 237:
image

In an if like this one:

if len(message.Components) > 0 {
  params.Components = message.Components
}

Another thing, this shouldn't get all the embeds instead of just the first one?

if len(message.Embeds) > 0 {
  params.Embed = message.Embeds[0]
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants