bwmarrin / discordgo

(Golang) Go bindings for Discord
BSD 3-Clause "New" or "Revised" License
5.12k stars 817 forks source link

Manual State Management fix #636

Open doubletoker opened 5 years ago

doubletoker commented 5 years ago

I would like to change the line 664 in state.go from

if len(c.Messages) > s.MaxMessageCount {

to the following

if s.MaxMessageCount != 0 && len(c.Messages) > s.MaxMessageCount {

I was trying to add messages manually and it kept erasing them, and I didn't want to set the max above 0 because then it tracks the messages as they come in, this is a fix for manual state management

pixelrazor commented 5 years ago

If you want to suggest changes, please fork the repo, make the changes yourself, then create a pull request

doubletoker commented 5 years ago

I asked Skippy in the discord chat, it's one line of code... I don't see forking over one line, and he said just to create an issue and I don't need to see my name on the contributor list over one line of code. I was just trying to add messages to the state but it kept deleting them right away which makes no sense cause 0 is off aka do not track, and if it's off I should be able to use it still, it's like saying don't track I'll do it myself. I really do think this is an issue at least of mine, maybe not others, but it just helps me keep track of history without having to do it all myself, which I could but state is already there why not use it. Also, on a second note, if this is because I pointed to code, and suggested a fix, since I changed it in my local gopath and it worked, then next time, I could just complain only.

CarsonHoffman commented 4 years ago

I'm not sure this is a feasible change; if we support manual state management in this fashion, I would think it would be just as valid to support changing the state's message count at runtime, and this change would prevent the state from getting cleared if one were to change the count to 0.