Replies: 1 comment 1 reply
-
I think this should be work, but you can't see like you press the button. Check sendInteraction: (guildId, channelOrThreadId, messageId, customId, message = undefined) => apiCall('/interactions', {
type: 3,
nonce: Math.floor(Math.random() * 1000000000000000000) + '',
guild_id: guildId,
channel_id: channelOrThreadId,
message_flags: 0,
message_id: messageId,
application_id: message.author.id, // We need to fetch message author to get application_id
session_id: 'requiredButUnchecked',
data: {
component_type: 2,
custom_id: customId
}
}, 'POST'), This is the code; ( You need to look which channel you want before sent this code. ) {
id()
let guildId = gid
let channelId = cid
const seenMessages = new Set()
var loop = true
while (loop) {
const lastMessages = await api.getMessages(channelId, 100);
const found = lastMessages.filter(message => !_.isEmpty(message.components) && !seenMessages.has(message.id) );
if ( found.length > 0 ) {
for ( message of found ) {
console.log(`I found a message, ID=${message.id} Content="${message.content}" by ${message.author.username}#${message.author.discriminator} ID=${message.author.id}`);
seenMessages.add(message.id);
let interaction = await api.sendInteraction(guildId, channelId, message.id, "click_one", message); // click_one must be your custom id. You can find custom code like this; open devtools > network tab and click component. Then look for "interactions" named item click it, click Payload tab and look; data > custom_id. You can see there is a name.
await delay(2*1000) // Creating interaction every 2 seconds after previous interaction, if there is message with components.
}
}
await delay(5*1000) // Checking channel messages every 5 second you can lower max 1100 ms if you make lower than, you may get banned for unusual activity.
if (loop === false) break
}
} @rigwild Can you try my code? I think its must be work but we can't see that. And if this is work, can you add this to API? UwU |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I would like to make a loop that checks if a button is posted and clicks on it as quickly as possible in a channel.
Beta Was this translation helpful? Give feedback.
All reactions