(uri string, creationTime *time.Time, retweetUserId *string)
| 581 | } |
| 582 | |
| 583 | func BskyMsgToTwitterID(uri string, creationTime *time.Time, retweetUserId *string) *int64 { |
| 584 | if uri == "" { |
| 585 | return nil |
| 586 | } |
| 587 | |
| 588 | var encodedId *int64 |
| 589 | if retweetUserId != nil { |
| 590 | encodedId = encodeToUint63(uri + *retweetUserId + creationTime.Format("20060102150405")) // We add the date to avoid having the same ID for reposts |
| 591 | if err := db_controller.StoreTwitterIdInDatabase(encodedId, uri, creationTime, retweetUserId); err != nil { |
| 592 | fmt.Println("Error storing Twitter ID in database:", err) |
| 593 | panic(err) // TODO: handle this gracefully? |
| 594 | } |
| 595 | } else { |
| 596 | encodedId = encodeToUint63(uri) |
| 597 | if err := db_controller.StoreTwitterIdInDatabase(encodedId, uri, creationTime, nil); err != nil { |
| 598 | fmt.Println("Error storing Twitter ID in database:", err) |
| 599 | panic(err) |
| 600 | } |
| 601 | } |
| 602 | return encodedId |
| 603 | } |
| 604 | |
| 605 | // This is here soley because we have to use psudo ids for retweets. |
| 606 | func TwitterMsgIdToBluesky(id *int64) (*string, *time.Time, *string, error) { |
no test coverage detected