MCPcopy Index your code
hub / github.com/Preloading/TwitterAPIBridge / BskyMsgToTwitterID

Function BskyMsgToTwitterID

bridge/bridge.go:583–603  ·  view source on GitHub ↗
(uri string, creationTime *time.Time, retweetUserId *string)

Source from the content-addressed store, hash-verified

581}
582
583func 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.
606func TwitterMsgIdToBluesky(id *int64) (*string, *time.Time, *string, error) {

Callers 2

TranslatePostToTweetFunction · 0.92
retweetFunction · 0.92

Calls 2

StoreTwitterIdInDatabaseFunction · 0.92
encodeToUint63Function · 0.85

Tested by

no test coverage detected