MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / reactStory

Function reactStory

scripts/fb_moreReactionStory.js:152–199  ·  view source on GitHub ↗
(user_id, fb_dtsg, story_id, message)

Source from the content-addressed store, hash-verified

150 }, 2e3);
151 }
152 function reactStory(user_id, fb_dtsg, story_id, message) {
153 return new Promise(async (resolve, reject) => {
154 const variables = {
155 input: {
156 lightweight_reaction_actions: {
157 offsets: [0],
158 reaction: message,
159 },
160 story_id,
161 story_reply_type: "LIGHT_WEIGHT",
162 actor_id: user_id,
163 client_mutation_id: 7,
164 },
165 };
166
167 const body = new URLSearchParams();
168 body.append("av", user_id);
169 body.append("__user", user_id);
170 body.append("__a", 1);
171 body.append("fb_dtsg", fb_dtsg);
172 body.append("fb_api_caller_class", "RelayModern");
173 body.append(
174 "fb_api_req_friendly_name",
175 "useStoriesSendReplyMutation"
176 );
177 body.append("variables", JSON.stringify(variables));
178 body.append("server_timestamps", true);
179 body.append("doc_id", "3769885849805751");
180
181 try {
182 const response = await fetch(
183 "https://www.facebook.com/api/graphql/",
184 {
185 method: "POST",
186 headers: {
187 "Content-Type": "application/x-www-form-urlencoded",
188 },
189 body,
190 }
191 );
192 const res = await response.json();
193 if (res.errors) return reject(res);
194 resolve(res);
195 } catch (error) {
196 reject(error);
197 }
198 });
199 }
200 // https://stackoverflow.com/a/67705964/23648002
201 function isEmoji(text) {
202 return text?.match(

Callers 1

loadModalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected