Bot Code (python)
Python code isn't exactly the hardest thing to understand, but this is for the die heart fans of chatango. First off, the language DOES NOT work like html, or CSS. But more similar to Javascript. The language is a functionary language in scripting form. If all that went right past your head, don't fret. I'm here to help you under. Firstly, python is heavily dependent on dependencies. (Libs (libraries))
Python is one of the simplest functionary languages to this day. But first before we can stir up the most epic bot chatango has ever seen, we need python IF you're using Windows, or Mac. (Linux excluded as it's a native language)
We can download python 2.x.x or python 3.x.x from https://www.python.org/
Secondly we need the chatango Library, "ch.py" file. We can get this from a few git repositories.
https://github.com/ericraio/ch.py
https://github.com/Nullspeaker/ch.py
Now we need something to actually example our code to us. Ch.py is undocumented (No cheat sheets)
https://github.com/ericraio/ch.py/blob/master/example.py
So this is an example of some Bot code. In my honest opinion, this is the worse code I've seen EVER. But we're going to live through it.
So there's 3 essential parts to make our bot work. Lib, Class, and start. (We got the lib!)
In the example, they name their Class "TestBot"
Class TestBot(ch.RoomManager):
# Now there's a few things to make the magic happen
def onMessage(self, room, user, message)
# Make sure to indent.
# Everything inside the ( ) is everything we're going to need.
# message = User's message (string)
# user = < "name" > object | user.name (string)
# room = < "name" > object | room.name (string)
So, in onMessage, we put our reaction code, (!whois lyend) - This is probably the hardest bit code, especially if you don't know python (This is super cool to learn with though)
Lastly, we need to have our bot actually start and login
So at the end of our code (in this case since we named class "TestBot")
TestBot.easy_start(name='username', password='password', rooms=['room1', 'room2'], pm=False)
and congrats, now all you need to do is learn python more to understand more stuff about the bot.
Python is one of the simplest functionary languages to this day. But first before we can stir up the most epic bot chatango has ever seen, we need python IF you're using Windows, or Mac. (Linux excluded as it's a native language)
We can download python 2.x.x or python 3.x.x from https://www.python.org/
Secondly we need the chatango Library, "ch.py" file. We can get this from a few git repositories.
https://github.com/ericraio/ch.py
https://github.com/Nullspeaker/ch.py
Now we need something to actually example our code to us. Ch.py is undocumented (No cheat sheets)
https://github.com/ericraio/ch.py/blob/master/example.py
So this is an example of some Bot code. In my honest opinion, this is the worse code I've seen EVER. But we're going to live through it.
So there's 3 essential parts to make our bot work. Lib, Class, and start. (We got the lib!)
In the example, they name their Class "TestBot"
Class TestBot(ch.RoomManager):
# Now there's a few things to make the magic happen
def onMessage(self, room, user, message)
# Make sure to indent.
# Everything inside the ( ) is everything we're going to need.
# message = User's message (string)
# user = < "name" > object | user.name (string)
# room = < "name" > object | room.name (string)
So, in onMessage, we put our reaction code, (!whois lyend) - This is probably the hardest bit code, especially if you don't know python (This is super cool to learn with though)
Lastly, we need to have our bot actually start and login
So at the end of our code (in this case since we named class "TestBot")
TestBot.easy_start(name='username', password='password', rooms=['room1', 'room2'], pm=False)
and congrats, now all you need to do is learn python more to understand more stuff about the bot.