Skip to content

Commit aeeaff8

Browse files
feat: Sync with AutoMod
1 parent bb36c0a commit aeeaff8

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

CREDITS.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ This project was made possible by the following contributors:
55
- [techwithanirudh](https://replit.com/@techwithanirudh)
66
- [python660](https://replit.com/@python660)
77
- [Firepup650](https://replit.com/@Firepup650)
8-
- [9pfs](https://replit.com/@9pfs)
9-
8+
109
We would also like to thank the following open source projects:
1110

1211
- [Discourse](https://github.com/discourse/discourse)

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Contributions are welcome! Please submit a pull request with your changes.
2525
- techwithanirudh
2626
- python660
2727
- Firepup650
28-
- 9pfs
2928

3029
## License
3130

utils/messageHandler.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,25 @@ async function getChatChannel(username) {
229229
}
230230
}
231231

232-
export { getHeaders, postMessage, postMessageWithRetries, editMessage, getMessages, includesPrefix, isUserStaff, getUserInfo, getChatChannel };
232+
async function reactToMessage(msg, reaction, CHANNEL_NAME, CHANNEL_ID) {
233+
const url = `${BASE_URL}/chat/${CHANNEL_ID}/react/${msg.id || msg.message_id}`;
234+
235+
const body = `react_action=add&emoji=${encodeURIComponent(reaction)}`;
236+
const headers = {
237+
...getHeaders('PUT', CHANNEL_NAME, CHANNEL_ID),
238+
};
239+
240+
try {
241+
const response = await fetch(url, {
242+
method: 'PUT',
243+
headers,
244+
body,
245+
});
246+
247+
return await response.json();
248+
} catch (error) {
249+
console.error('Error posting message:', error);
250+
}
251+
}
252+
253+
export { getHeaders, postMessage, postMessageWithRetries, editMessage, getMessages, includesPrefix, isUserStaff, getUserInfo, getChatChannel, reactToMessage };

0 commit comments

Comments
 (0)