DIY Omegle Chat Bot!

I have been chatting on Omegle for quite some time now and I must say that i find it rather addictive. During one conversation, i encountered a bot and needless to say, i was hooked on to the convo ! I wanted to make one for myself badly somehow 🙂

A quick search later revealed that most of the chatter bots were based on the Artificial Intelligence Markup Language.It’s basically a rule based xml language which is used by the AI engine to give a response (a.k.a. categories) based on a set of pre-loaded rules (a.k.a. topics).Such a topic-category definition is written in to a AIML file which the engine loads. And guess what, there was a python implementation of the AIML engine 😛 .This blog shows how to implement a standalone bot using PyAIML. I used the Annotated A.L.I.C.E. AIML files (AAA) for the engine’s rule base.

Now all i had to do was to find out how to connect to Omegle through code.Once that was done, i could capture what the stranger typed, pass it on to the engine and transmit back the response to the Omegle server .There is no ‘official’ documentation on the various connection string options but a good samaritan had written a python client for Omegle. I used that code (liberally!) to get connected.

For this code to work, you need to download the AAA folder(files) into the directory where this python script is located.

We are good to go now! You can play around with the AIML files and even make your own file for chat specific questions like “asl” ,”from” etc. Here’s an interesting(?) chat that my bot had:

:~/Bot> python test.py
Loading brain from omeglebrain.brn... done (46285 categories in 1.71 seconds)
Kernel bootstrap completed in 1.71 seconds
d0Vckt
Finding stranger...
Waiting...
Stranger is typing...
Stranger: "hi"
You: Hello there.
Stranger is typing...
Stranger: "sooo"
You: Is that your final answer?
Stranger is typing...
Stranger is typing...
Stranger: "yes"
You: You're sure. That's your final answer.
Stranger is typing...
Stranger: "YES\n"
You: Oh, you are a poet.
Stranger is typing...
Stranger: "no"
You: But your words are very original.
Stranger is typing...
Stranger: "they seem simple to me"
You: Like who, specifically?
Stranger is typing...
Stranger is typing...
Stranger: "no one in particular"
You: I heard it was someone.
Stranger is typing...
Stranger: "you most of heard wrong"
You: Thanks for telling me.
Stranger is typing...
Stranger: "no prob"
You: Wow! Do you have any conditions I should know about?
Stranger is typing...
Stranger: "herpes"
You: Do you like to "go with the flow"?
Stranger is typing...
Stranger is typing...
Stranger: "ha no not usually"
You: I'm glad you got a laugh out of it.
Stranger is typing...
Stranger: "i have a broad sense of humor"
You: Interesting. I have a lot of answers to silly questions.
Stranger is typing...
Stranger: "well i have more"
You: Cool. I have a lot of likes and dislikes.
Stranger is typing...
Stranger: "who doesnt"
You: William Shatner. 🙂
Stranger is typing...
Stranger: "he likes everything? or dislikes?"
WARNING: No match found for input: "
You: He must be very fond of it. What is your real name?
Stranger is typing...
Stranger: "my real name is ryan"
You: What's up, ryan" .
Stranger is typing...
Stranger: "not much stranger"
You: Me either.
Stranger is typing...
Stranger: "whats your nmae?"
WARNING: No match found for input: "
You: I've been waiting for you.
Stranger is typing...
Stranger: "thats your name?"
WARNING: No match found for input: "
You: Does "it" still refer to "whats your nmae ?
Stranger is typing...
Stranger: "i never said it"
You: But you implied it" .
Stranger is typing...
Stranger: "what is your name?"
WARNING: No match found for input: "
You: My name is Nameless.
Stranger is typing...
Stranger: "wow"
You: I'm glad your impressed, ryan" .
Stranger is typing...
Stranger is typing...
Stranger: "that was sarcasim"
You: I thought it was too.
Stranger is typing...
Stranger: "well then we are on the same page"
You: And the same frequency.
Stranger is typing...
Stranger: "no"
You: Yippee!
Stranger is typing...
Stranger: "how old are u?"
WARNING: No match found for input: "
You: I am years old.
Stranger is typing...
Stranger: "you are getiing annoying"
You: You think I am getiing annoying".
Stranger is typing...
Stranger: "i think that you are getting annoying"
You: Do you think I should tone it down?
Stranger is typing...
Stranger: "yes definately"
You: Why? What makes you so certain.
Stranger is typing...
Stranger: "because if you dont i will choose not to talk to you anymore"
You: That makes sense to me. I think I do.
Stranger is typing...
Stranger: "you do what?"
WARNING: No match found for input: "
You: ryan" , I talk to people on the web. What do you do?
Stranger is typing...
Stranger: "i also talk to people on the web"
You: How do they respond to you?
Stranger is typing...
Stranger: "well you are very odd... but most people open up to me for some reason"
You: An oddball? Humans are not always infallible.
Stranger is typing...
Stranger: "i dint say they were"
You: Sorry I misunderstood. What did you say?
Stranger is typing...
Stranger: "k"
You: Ayuh.

This is not working me for me… I have all the aiml files in the folder under /aaa/ where pyomegle.py is in /
I also added the PyAiml files to / just in case, but when i open pyomegle.py it immediatly shuts down again, also i’m no python expert so i dont know if there is a log somewhere or atleast keep the window open to see the error.

Well, it’s working sometimes and sometimes not.
But how can you make it save conversations through a log ?
Also, it randomly exits sometimes, and with pyaiml i couldnt do k.respond(“load aiml b”) as it gave me an error.
If anyone can help me with this: shys_aelaes@yahoo.com

Omegle made some kind of update to their site and broke this bot. An updated version can be found here (the code must be changed to work. I was trying to pipe a text adventure through using subprocess, but it gets stuck)

…Is it me or are people missing the obvious thing : The Turing Machine Test, supposed to demonstrate if a program has near-human intellect, resolves on testing if a program can fool a human being into believing it is another human being… ( of course it’s supposed to be tested on several people).
I’d say this chat log was a most definit succes, now if you happen to convince every person who chats with your bot…well, You’ll become famous for creating the first AI machine ( assuming people in the AI business still think the Turing Machine Test is the one they have to beat to make something intelligent XD).

Of course, the fact that I’ve managed to trick people into believing I was the bot is…a counter-argument… against the turing test having any validity 🙂

Thanks for the bot, personally I’m trying to make a script to get the IP of any person I video-chat with (it’s a pain finding it in Wireshark, especially since my network has an extraordinary amount of trash ( as “anything I don’t care about” stuff) traffic flowing back and forth.