MCPcopy Create free account
hub / github.com/Treeki/BirdBridge / userToAccount

Function userToAccount

conversion.ts:119–158  ·  view source on GitHub ↗
(user: Record<string, any>)

Source from the content-addressed store, hash-verified

117}
118
119export function userToAccount(user: Record<string, any>): Record<string, any> {
120 const account: Record<string, any> = {};
121
122 account.id = user.id_str;
123 account.username = user.screen_name;
124 account.acct = user.screen_name;
125 account.url = 'https://twitter.com/' + user.screen_name;
126 account.display_name = user.name;
127 account.note = user.description;
128 account.avatar = user.profile_image_url_https.replace('_normal', '');
129 account.avatar_static = account.avatar;
130 // TODO make this point to something useful
131 // Pinafore just expects to see missing.png
132 account.header = user.profile_banner_url || 'missing.png';
133 account.header_static = user.profile_banner_url || 'missing.png';
134 account.locked = user.protected;
135 // fields, bot?
136 account.created_at = convertTimestamp(user.created_at);
137 if (user.status !== undefined)
138 account.last_status_at = convertTimestamp(user.status.created_at);
139 account.statuses_count = user.statuses_count;
140 account.followers_count = user.followers_count;
141 account.following_count = user.friends_count;
142 account.emojis = [];
143
144 if (user.ext_is_blue_verified) {
145 account.emojis.push(BLUE_VERIFIED_EMOJI);
146 account.display_name += ` :${BLUE_VERIFIED_EMOJI.shortcode}:`;
147 } else if (user.verified) {
148 if (user.ext_verified_type === 'Business') {
149 account.emojis.push(PISS_VERIFIED_EMOJI);
150 account.display_name += ` :${PISS_VERIFIED_EMOJI.shortcode}:`;
151 } else {
152 account.emojis.push(VERIFIED_EMOJI);
153 account.display_name += ` :${VERIFIED_EMOJI.shortcode}:`;
154 }
155 }
156
157 return account;
158}
159
160const MEDIA_TYPES: Record<string, string> = {
161 'photo': 'image',

Callers 3

main.tsFile · 0.90
tweetToTootFunction · 0.85
activityToNotificationFunction · 0.85

Calls 1

convertTimestampFunction · 0.85

Tested by

no test coverage detected