Omegle JavaScript bot that send three messages - javascript

I am trying to adjust the Omegle bot code in JavaScript that I have seen on the internet.
I want to use this bot to give the children on Omegle more knowledge about what other things they can do in their life instead of wasting their time on chats like that.
the issue is that the message I want to print is very long, such that Omegle will not send it (it looks like it was sent but when I tried with a friend, he didn't see anything. only when I divided the long message into small three messages.
I need to send three messages (one after another) instead of one.
the following code is what I have found, it is very simple - I just copy and paste it into the browser console and it works. - but it worked for only one message and then skip to the next person.
here is the original code:
function executeOmegle()
{
let btn = document.querySelector('.disconnectbtn')
let messageBox = document.querySelector('.chatmsg')
let sendBtn = document.querySelector('.sendbtn')
btn.click()
messageBox.innerHTML=" Hello, i am a bot"
sendBtn.click()
}
setInterval(executeOmegle,4000)
I need to send three messages, so I have modified the code like this:
but this will not work - it sends only the first message and skips to the next person.
function executeOmegle()
{
let btn = document.querySelector('.disconnectbtn')
let messageBox = document.querySelector('.chatmsg')
let sendBtn = document.querySelector('.sendbtn')
btn.click()
messageBox.innerHTML=" first message "
sendBtn.click()
messageBox.innerHTML=" Second message "
sendBtn.click()
messageBox.innerHTML=" Third message "
sendBtn.click()
}
setInterval(executeOmegle,4000)
can someone please help me to understand what I am doing wrong?
I don't have any experience in JavaScript or another platform.
I wish the code can be fixed so I will be able to use it "easily" in my browser.
thank you for your help,
Dan
PS
This is my first time on stack overflow.
I don't have any experience with JavaScript.
before I posted this question for six hours I tried to fix the code and did my research with no success.
so why do people here give bad feedback to my question as someone that didn't do his research?
or that the subject is not useful?

Related

discord.js V12 - Console commands, and variable output showing as Undefined

So, I am new to JavaScript. I am making a Discord bot because it's the only thing I would really use JavaScript for at the moment and I want to learn something. Whenever I try to show something like an id it says undefined.
client.on("channelCreate", function(channel){
console.log(channel.type+` channel, `+channel.name+`, was created by `+`${channel.owner_id}`+` in the category `+channel.parent_id);
});
I want to make a basic log section for my bot, and I am just starting. I want it to be like
00:00:00 CREATE > [Text / Voice] Channel was created by [Creator] under category [category]!
I know the exact format isn't implemented into the code, I test a lot of the function before I make it pretty lol. But it comes out like this (using the code I have now)
text channel, s, was created by undefined in the category undefined
I'm so confused because I like detail so I want to have who created it, when, and also the category! So how would I do that?
Also, would there be a way to send messages and stuff from the console?
Like if I typed this in the console
[channel or user] > [the message]
#testchannel > Announcing new video or something idk
and have it send to the channel? any help is appreciated!
edit: I forgot to mention that I have the owner_id part in ${var} format because I was testing to see if that would make it work, but I never switched it back lol
Changing the channel.parent.name would work but there isn't any way to know who created the channel , here's the code -
client.on("channelCreate", function(channel){
console.log(channel.type+` channel, `+channel.name+`,`+` in the category `+channel.parent.name);
});

Adding a role to a user when they click a reaction on a message

I am setting up a new entry system for my Discord server with my bot, but I am having a hang up on getting some code to function.
My basic goal, is to have a post sitting in the welcome channel with rules and info, and the user has to click a reaction on the post, then the bot gives them a specific role and removes the 'Newbie' role. I have no had any issues doing this as long as the user is the one calling the message, but my issue comes in when trying to pull the guildMember object in, so I can roles.add them, it just doesn't seem to work? I've tried several different methods and have came up short every time. :C
message_id is being identified and ran properly, I am console logging and caching it outside of this block, seems fine. It's just this part that I cannot get to work. The bot doesn't error, or reply to the event.
Using node.js 12 (dino is my Client, btw)
dino.on("messageReactionAdd", (reaction, user) => {
if (reaction.emoji.id == '☑️' && reaction.message.id === message_id) {
let ourUser = reaction.message.guild.member(user)
ourUser.roles.add(`add ID would go here`)
ourUser.roles.remove(`Remove ID would go here`)
}
});
I found the issue, I was calling emoji.id instead of emoji.name lol. I'm an idiot. Works fine now, soon as I post it, I figure it out.. ofc.

Discord.JS How to get emotes from an old message

I want to collect the number of emotes or reacts from a message sent 1 hour ago, how should I do that?
I want to make a command like $reacts and the callback should be the count of each reacts from that message. Thanks!
const msg = client.channels.cache.get('TheMessageID');
return message.channel.send(`This message has ${msg.reactions.cache.size} reactions.`);
Hope that was what you were looking for

Elegant way of harnessing facebook ads data without api

I was helping one of my relatives with a Facebook campaign for their store.The campaign was a success as we gathered about more than 1000 new likes and a lot of queries.They were happy but I really wanted to do some more with that data like tag those people who liked if their setting allowed or send a message on messenger for arrival of new items.In short keep a track of the all that was happening.The idea is to harness the data so that maximum can be achieved next time on similar campaigns.
I wanted a something simple so that the guys at the store can do it themselves without any fiddling with api.After some trial and error i came up with this js code which can be pasted into console after opening the window which appears when you click link just on the side of like button.
/*a script to get all the people who liked the page
after a facebook campaign. A successful capmpaign will get 1000's of
likes so it will be impossible to load all the names in one go.Also the
list loads progressively with each scroll. So
the code introduces a last element in the json which you have to put in
place of "i" in the given code when you press see more button in
subsequent runs.On my fairly powerful laptop and decent internet I was
not able to get more than 350 persons without a good lag.
The value of i is calculated by trial and error as the data attributes `
before that holds something else(not required) and not the names.I hope
it will be more or less similar in all of them.
This code is to be pasted in the console once the window with all the
likes is opened.*/
var arrayName = document.querySelectorAll('[data-gt]');
var PersonObject={};
try {
for(var i = 55;i<=arrayName.length;i++ ){
var element=arrayName[i];
console.log(element);
var name=element.innerHTML;
// console.log(i)
PersonObject[("name"+i)]=name;
// console.log(PersonObject)
}
}
catch(error){
console.log("error occured at"+i)
}
finally{
PersonObject["lastElement"]=i;
var NamesJson = JSON.stringify(PersonObject)
console.log(NamesJson)
}
I tried to write the gist of code in comments.
Now my real question,this all seems so hacky and patched stuff but not elegant. Isn't there a way for business owners to actually harness this data in more systematic way without the need for any api's or any programming knowledge?

JSJaC + Openfire: no connection with some users

ok, I'm finally at my wits' end. I have a have an XMPP server (Openfire) running, and trying to connect via JavaScript using JSJaC. The strange thing is that I can establish a connection for some users, but not for all. I can reproduce the following behavior: create two accounts (username/password), namely r/pwd and rr/pwd with the result:
r/pwd works
rr/pwd doesn't work.
So far, each account with a user name consisting of only one character works. This is strange enough. On the other side, old accounts, e.g., alice/a work. The whole connection problem is quite new, and I cannot trace it to any changes I've made.
And to make my confusion complete with any instant messenger supporting XMPP, all accounts work, incl., e.g., rr/pwd. So assume, the error must be somewhere in my JavaScript code. Here's he relevant snippet:
...
oArgs = new Object();
oArgs.domain = this.server;
oArgs.resource = this.resource;
oArgs.username = "r";
oArgs.pass = "pwd";
this.connection.connect(oArgs);
The code above works, but setting oArgs.username = "rr", and it fails.
I would be grateful for any hints. I'm quite sure that it must be something really stupid I miss here.
Christian
Adding oArgs.authtype = 'nonsasl' to the argument list when creating the xmpp connection using JSJaC solved my problem. I haven't tried Joe's command to alter the SASL settings in Openfire; I'm scared to ruing my running system :).

Categories