Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetContent #352

Merged
merged 8 commits into from
Apr 10, 2017
Merged

SetContent #352

merged 8 commits into from
Apr 10, 2017

Conversation

jD91mZM2
Copy link
Contributor

@jD91mZM2 jD91mZM2 commented Apr 9, 2017

See #351

@jD91mZM2
Copy link
Contributor Author

jD91mZM2 commented Apr 9, 2017

One problem I see is that you need to set MessageEdit: &MessageEdit{} to be able to use SetContent.

Should I make a getter method? Should I remove the pointer, so it defaults to an empty struct?

jD91mZM2 referenced this pull request in discordconsole-team/DiscordConsole Apr 10, 2017
A friend of mine got weird behaviours, such as negative numbers. Now I'm gonna gather everything I can to put an end to this problem once and for all
@jD91mZM2
Copy link
Contributor Author

jD91mZM2 commented Apr 10, 2017

Since I accidently changed my local develop branch, I used this pull early for one project.

Here is how it would look in code:
image

message.go Outdated
Nonce string `json:"nonce"`
MessageEdit
Tts bool `json:"tts"`
Embed *MessageEmbed `json:"embed"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embed is defined on MessageEdit, you shouldn't need this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oo right! Missed that! 1 second!

message.go Outdated
Nonce string `json:"nonce"`
MessageEdit
Tts bool `json:"tts"`
Embed *MessageEmbed `json:"embed"`
}

// MessageEdit stores all parameters you can send with ChannelMessageSendComplex.
type MessageEdit struct {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better name here? Do we need the MessageEdit? What if we just document that Tts doesn't work when editing? In that way we could just have 'MessageParameters' as the only struct that both ComplexSend and ComplexEdit take.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, OK!

@iopred
Copy link
Collaborator

iopred commented Apr 10, 2017

Lint comment errors breaking the build, but this looks good.

@jD91mZM2
Copy link
Contributor Author

Already on it ;)

message.go Outdated
// MessageParams is used in MessageSend and MessageEdit to share common parameters.
type MessageParams struct {
Content *string `json:"content,omitempty"`
Embed *MessageEmbed `json:"embed"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SORRY! Last thing! This should be omitempty also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right! No problem!

@iopred
Copy link
Collaborator

iopred commented Apr 10, 2017

Thanks so much dude! 💯 💯 🥇

@iopred iopred merged commit 851e8d3 into bwmarrin:develop Apr 10, 2017
@jD91mZM2 jD91mZM2 changed the title SendContent SetContent Apr 17, 2017
@bwmarrin bwmarrin added this to the v0.16.0 milestone Apr 18, 2017
ErikMcClure pushed a commit to ErikMcClure/discordgo that referenced this pull request Aug 4, 2020
* SendContent

* Fixed error...?

* Commented

* Yep let's do that

* Oops

* Oki

* Whatever you say, Travis... :<

* Omit them empty structs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants