Skip to content

Instantly share code, notes, and snippets.

@jacobmischka
Created July 30, 2017 04:00
Show Gist options
  • Save jacobmischka/b8aca5c4bf9fe042d41026b60c949fe6 to your computer and use it in GitHub Desktop.
Save jacobmischka/b8aca5c4bf9fe042d41026b60c949fe6 to your computer and use it in GitHub Desktop.
addDm
func (tdm *Tdm) addDm(dm anaconda.DirectMessage) error {
chat, ok := tdm.chats[dm.SenderId]
if !ok {
chat.username = dm.SenderScreenName
chat.userID = dm.SenderId
}
if dm.SenderId == tdm.user.Id {
chat.sentDms = append(chat.sentDms, dm)
} else {
chat.receivedDms = append(chat.receivedDms, dm)
}
tdm.chats[dm.SenderId] = chat
return nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment