Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var channelId = '920994048523788319';
- // берём из любого запроса
- var authorization = 'NDY1MTk1MTc5Mjk3NjAzNTg0.YZzAEw.O1Hr7eACh2wO3b43tZJ4sYESc3c';
- // @NOTE: запрашиваем сообщения треда
- var messages = await fetch(`https://discord.com/api/v9/channels/${channelId}/messages?limit=100`, {
- headers: {
- authorization,
- },
- }).then(r => r.json());
- // '👀'
- var reactions = ['✅', '❎']
- async function addReactions(messages, reactions) {
- for (var message of messages) {
- for (var reaction of reactions) {
- await fetch(`https://discord.com/api/v9/channels/${channelId}/messages/${message.id}/reactions/${encodeURIComponent(`${reaction}/@me`)}`, {
- headers: {
- authorization,
- },
- method: 'PUT',
- }).then(r => r.text())
- await new Promise(resolve => setTimeout(resolve, 300))
- }
- }
- }
- async function removeReactions(messages, reactions) {
- for (var message of messages) {
- for (var reaction of reactions) {
- await fetch(`https://discord.com/api/v9/channels/${channelId}/messages/${message.id}/reactions/${encodeURIComponent(`${reaction}/@me`)}`, {
- headers: {
- authorization,
- },
- method: 'DELETE',
- }).then(r => r.text())
- await new Promise(resolve => setTimeout(resolve, 300))
- }
- }
- }
- // @NOTE: добавить выбранные реакции ко всем сообщениям
- await addReactions(messages, reactions);
- // @NOTE: удалить выбранные реакции для всех сообщений
- await removeReactions(messages, reactions);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement