« first day (5 days earlier)      last day (347 days later) » 

12:00 PM
I installed it
@tech?
 
@ppw ohk, then let's move on to the code ;)
 
@tech Okay ;)
What's first?
Import something?
 
@ppw Yes, import, wait a sec ;)
 
;)
 
@ppw So, first, you need from chatexchange.client import Client.
 
12:02 PM
Done
Do I need a . In the last?
 
@ppw Next, add the following chunk of code ;)
email = 'email@email.com'
password = '**************'
se_chat = Client('meta.stackexchange.com')
se_chat.login(email, password)
@ppw No, no, that was a period outside of the code ;) That was for the sentence ;)
 
Oh ;)
@tech Done!
 
@ppw Wait a sec, use my edited version, otherwise you'll get a problem ;) I'll describe it later ;)
 
@tech I use github for login. Is it okay to enter gh email and pw?
@tech Done with the edited version
 
@ppw You can use any email you want ;)
 
12:05 PM
@tech Ah ;)
 
Now, next, for the important part. Your bot has to join the room in order to talk ;)
 
What's next?
Oh ;)
 
room = se_chat.get_room('1543')
room.join()
'1543' is the ID of this chatroom ;)
 
done!
 
@ppw Why did you leave the room?
 
12:07 PM
Accident ;)
@tech what's next?
 
@ppw ohk ;)
 
What's next?
I'm inpatient ;)
 
Now, we're gonna send a message: room.send_message('hi guys!') ;)
@ppw P.S. Sorry, I was a bit busy at the moment, now I'm not busy ;)
 
@tech no problem ;) Okay. I'll do that
 
@ppw Finally, to leave the room, use room.leave() ;)
from chatexchange.client import Client
email = 'email@email.com'
password = '**************'
se_chat = Client('meta.stackexchange.com')
se_chat.login(email, password)
room = se_chat.get_room('1543')
room.join()
room.send_message('hi guys!')
room.leave()
 
12:10 PM
@tech? chatexchange.browser.LoginError: failed to get acct cookie from Stack Exchange OpenID, check credentials provided for accuracy
What's that?
 
@ppw This means that they've got a captcha for ya ;) You need to relogin to your account ;)
 
@tech Logout & login?
 
@ppw Yep ;)
@ppw So, now, we've got the following code:
1 min ago, by Tech Expert Wizard
from chatexchange.client import Client
email = 'email@email.com'
password = '**************'
se_chat = Client('meta.stackexchange.com')
se_chat.login(email, password)
room = se_chat.get_room('1543')
room.join()
room.send_message('hi guys!')
room.leave()
@ppw So although right now this chatbot doesn't do anything, I mean, it can't respond to commands and other things like that, it can send messages now ;)
 
BOT: hi guys!
 
@ppw That's great!
 
12:13 PM
Yay!
 
@ppw Now, we get to the fun part ;)
 
@tech What? ;)
BOT: test
Nice
@tech?
 
@ppw Next, we have to add an infinite loop that doesn't do anything at the end of the script, 'cause otherwise the chatbot won't stay in here. I mean, well, you can't see this kinda thing 'cause your bot account is your main account, but lemme tell ya what I mean. Later on, when we get to the part where you learn how to process commands, you'll see that if you don't add the infinite loop, the bot (if you had a separate account) would seem like it's still in there.
 
@tech Okay
BOT: infinite loop
BOT: infinite loop
BOT: infinite loop
BOT: infinite loop
BOT: infinite loop
 
@ppw No, no, not like that, like this:
 
12:15 PM
BOT: infinite loop
 
while True:
    pass
 
How Can I stop it?
BOT: infinite loop
BOT: infinite loop
BOT: infinite loop
 
@ppw By stopping the Python script, or by me kicking you out of the room ;)
 
BOT: infinite loop
BOT: infinite loop
BOT: infinite loop
 
@ppw PLEASE STOP THE PYTHON SCRIPT!!!
 
12:16 PM
BOT: infinite loop
Whew, stopped
@tech kick me out!
 
@ppw I'm not gonna kick you out 'cause you stopped the Python script now ;)
 
Don't kick me out ;)
 
@ppw I might if you don't know how to stop a Python script, but of course you know how to do that, so I don't need to ;)
 
Of course ;)
ugh, Captcha
 
@ppw 'Cause you know, if you kick a bot out, after the kick period, it won't do anything again or respond to commands or whatever ;)
 
12:18 PM
@tech Oh ;)
 
@ppw Now, so remember, the infinite loop isn't like the infinite loop that I put on about 30 minutes ago, remember the gender loop, not like that, like the following:
 
wait a sec I'll go re-login
 
while True:
    pass
@ppw ohk, sure ;)
@ppw Now, add the following code:
def on_event(event, _):
    msg = event.message.content_source
    print(msg)
@ppw This code should go before the infinite loop ;)
 
Done!
 
@ppw Now, add the following line of code below the function definition but above the infinite loop, 'cause you can't put anything below the infinite loop, otherwise it'll never happen: room.watch_socket(on_event)
 
12:21 PM
@tech Before the while True?
 
@ppw Yep ;)
 
Okay Done!
 
What's the whole code?
 
1 message moved from Trash Bin
@ppw So now, you should have the following code:
1 message moved to Trash Bin
 
12:23 PM
@tech What?
Um, @tech?
 
from chatexchange.client import Client
email = 'email@email.com'
password = '**************'
se_chat = Client('meta.stackexchange.com')
se_chat.login(email,password)
def on_event(event, _):
    msg = event.message.content_source
    print(msg)
room = se_chat.get_room('1543')
room.join()
room.send_message('hi guys!')
room.leave()
 
Huh? That's not it
Oh, now that's right
 
@ppw Sorry, wait a sec, I haven't finished editing it, don't put this into the script, not finished ;)
@ppw NOT FINISHED YET, WAIT A SEC
 
Oh, yeah, it's not it
 
@ppw Yeah, the watch_socket stuff, remember?
 
12:24 PM
Yep
 
from chatexchange.client import Client
email = 'email@email.com'
password = '**************'
se_chat = Client('meta.stackexchange.com')
se_chat.login(email,password)
def on_event(event, _):
    msg = event.message.content_source
    if msg == '@ppw say hi':
        room.send_message('Hi!')
room = se_chat.get_room('1543')
room.join()
room.send_message('hi guys!')
room.watch_socket(on_event)
while True:
    pass
 
Um ctrl k please
 
@ppw Sorry, I accidentally pressed enter before I finished ;)
 
@tech Oh ;)
Done!
Should I execute?
 
@ppw Wait a sec, don't execute ;)
 
12:27 PM
Okay ;)
 
@ppw There, finished, now copy this new code ;)
 
Done! @tech
 
@ppw Now, you can execute the code ;)
 
hi guys!
 
@ppw say hi
 
12:29 PM
Hi!
Yay!
Hi!
@ppw say hi
Hi!
 
@ppw Oops, forgot to add the BOT: thing ;)
 
Ah ;)
hi guys!
 
from chatexchange.client import Client
email = 'email@email.com'
password = '**************'
se_chat = Client('meta.stackexchange.com')
se_chat.login(email,password)
def on_event(event, _):
    msg = event.message.content_source
    if msg == 'pb hi':
        room.send_message('BOT: Hi!')
room = se_chat.get_room('1543')
room.join()
room.send_message('hi guys!')
room.watch_socket(on_event)
while True:
    pass
 
Restarted it
 
@ppw Use the code above ;)
 
12:30 PM
@ppw say hi
 
@ppw Please use my latest code ;)
 
@tech Ah
hi guys!
You forgot hi guys BOT!
pb hi
BOT: Hi!
 
Nice!
BOT: Hi!
 
@ppw Now, please stop your bot ;)
 
12:32 PM
Stopped
So many users coming into the room
 
@ppw Yeah, don't know what this 1-rep user is doin' in here ;) Well, they can't tell us, 'cause they've only got 1 rep so they can't talk here ;)
 
Yep ;)
 
@ppw Now, let's look at how to reply to messages ;)
 
Okay ;)
 
@ppw So, to reply to messages, use event.message.reply('blah blah blah.') ;)
@ppw So now let's change our bot again:
from chatexchange.client import Client
email = 'email@email.com'
password = '**************'
se_chat = Client('meta.stackexchange.com')
se_chat.login(email,password)
def on_event(event, _):
    msg = event.message.content_source
    if msg == 'pb hi':
        event.message.reply('BOT: Hi!')
room = se_chat.get_room('1543')
room.join()
room.send_message('BOT: Initial message: hi guys!')
room.watch_socket(on_event)
while True:
    pass
 
12:36 PM
Done!
Should I execute?
 
@ppw Yep ;)
 
I changed it to pb say hi
BOT: restarting.. Hello everyone!
 
pb say hi
 
@TechExpertWizard BOT: Hi!
It works!
 
12:37 PM
pb say hi
@ppwater BOT: Hi!
Yay!
It's a little strange talking to myself ;)
 
@ppw Yeah ;)
pb say hi
 
@TechExpertWizard BOT: Hi!
Okay I'll stop it now
Done
 
@ppw Yeah, stop the bot now ;)
 
Okay What's next?
@tech ;)
Okay So done!
 
3 messages moved to Trash Bin
@ppw Now, you can work on your chatbot while you have time ;) And as long as you share your code, you can make yours better than mine ;)
 
12:45 PM
@tech Okay ;) I'll go work on it
 
@ppw Well, I'm also workin' on mine, 'cause I've got some problems with the access restriction control system, I can't demote people from admin to normal user ;)
1 message moved to Trash Bin
 
@tech Ah ;)
 
@ppw It's 7:51 AM where I live. What time is it where you live?
@ppw ohk ;)
 
;)
Turning on my bot
 
@ppw What can your bot do now?
 
12:56 PM
Some things
BOT: starting.. Hello everyone!
 
@ppw Tell me 'bout what it can do ;)
 
The bot will tell you
BOT: starting.. Hello everyone!
pb commands
@ppwater Sorry, I don't know what did you say..
 
Oh wait a sec
Error
@TechExpertWizard Sorry, I don't know what did you say..
 
12:57 PM
@TechExpertWizard Sorry, I don't know what did you say..
 
BOT: starting.. Hello everyone!
pb commands
 
pb listcommands
 
Currently, there is these commands:
pb alive : Sends a alive message
pb coffee : brews a cup of coffee
pb commands : sends this message
@TechExpertWizard Sorry, I don't know that command yet..
pb alive
@ppwater Yep, don't worry
 
pb commands
 
12:58 PM
pb alive
Currently, there is these commands:
pb alive : Sends a alive message
pb coffee : brews a cup of coffee
pb commands : sends this message
@ppwater Maybe Or maybe not ;)
 
@ppw You need to thank me for giving you that verrrry complete list of types of coffee, otherwise you'd need to find that yourself ;)
 
@AnnZen I implemented my bot!
@tech Thanks!
AttributeError: 'UserEntered' object has no attribute 'message'?
pb alive
 
pb coffee
 
Hello! I'm Tech BOT, and my owner is Tech Expert Wizard.
 
Hi, @Ann!
tb greet Ann
 
1:00 PM
hi
 
@TechExpertWizard Hi, @Ann!
 
I stopped my bot
 
@ppw Could you please gimme your code, so that I can help you fix the problem ;)
 
Oh, fixed it
BOT: starting.. Hello everyone!
 
@ppw Then run your bot again!
pb coffee
 
1:01 PM
@TechExpertWizard Bot: brews a cup of nitro for @TechExpertWizard
pb alive
@ppwater Bot: I'm alive right now!
 
tb coffee
 
@TechExpertWizard brews a cup of flat white for @TechExpertWizard
 
pb alive
 
pb coffee
 
@ppwater Bot: Yep, don't worry
@TechExpertWizard Bot: brews a cup of flat white for @TechExpertWizard
 
1:02 PM
tb coffee ppw
 
@TechExpertWizard brews a cup of latte for @ppw
 
pb alive
@ppwater Bot: I'm alive right now!
 
pb coffee ppw
 
pb alive
@TechExpertWizard Sorry, I don't know that command yet..
pb alive
@ppwater Bot: Yep, don't worry
pb alive
@ppwater Bot: Yep, don't worry
 
@ppw Right now your chatbot can only brew coffee for whomever asked for coffee, but my chatbot can brew coffee for anyone ;)
 
1:03 PM
@ppwater Bot: ¯_(ツ)_/¯
 
@ppw Wha? How did your bot do that?
tb coffee Ann
 
@TechExpertWizard brews a cup of macchiato for @Ann
 
@tech Random random
 
@ppw I mean, what does ¯_(ツ)_/¯ mean? I know it's random, of course, but what does it mean?
tb coffee sha
 
@TechExpertWizard brews a cup of mocha for @sha
 
1:05 PM
BOT: starting.. Hello everyone!
@Tech That means I don't know
 
@ppw Could you please show me your code? Thanks!
tb coffee The
 
@TechExpertWizard brews a cup of affogato for @The
 
 alivecommands = ['Of course I am alive', 'Hmm, good question', '¯\\_(ツ)_/¯', 'Maybe Or maybe not ;)', "Yep, don't worry", "I'm alive right now!"]
    coffee = ['black', 'latte', 'cappucino', 'americano', 'espresso', 'doppio', 'cortado', 'red eye', 'galão', 'lungo', 'macchiato', 'mocha', 'ristretto', 'flat white', 'affogato', 'café au lait', 'iced coffee', 'iced espresso', 'cold brew', 'frappuccino', 'nitro', 'mazagran']
    def on_event(event, _):
        msg = event.message.content_source
        if msg.startswith('pb '):
 
@ppw CTRL+K?
@ppw I'd suggest the following:
 
@tech What?
 
1:07 PM
@ppw Oh well, it looks like there's nothing that I can really suggest ;) Your chatbot's pretty good ;)
 
Thanks ;)
 
@ppw Oh wait, I forgot, yes, I've got a minor thing to suggest to you:
 alivecommands = ['Of course I am alive', 'Hmm, good question', '¯\\_(ツ)_/¯', 'Maybe Or maybe not ;)', "Yep, don't worry", "I'm alive right now!"]
    coffee = ['black', 'latte', 'cappucino', 'americano', 'espresso', 'doppio', 'cortado', 'red eye', 'galão', 'lungo', 'macchiato', 'mocha', 'ristretto', 'flat white', 'affogato', 'café au lait', 'iced coffee', 'iced espresso', 'cold brew', 'frappuccino', 'nitro', 'mazagran']
    def on_event(event, _):
        msg = event.message.content_source
        if msg.startswith('pb '):
 
BOT: starting.. Hello everyone!
@tech Yep, was doing that
pb coffee tech
@ppwater brews a cup of black for @tech
Yes!
BOT: starting.. Hello everyone!
pb commands!
Bot: Currently, there is these commands:
pb alive : Sends a alive message
pb coffee : brews a cup of coffee
pb commands : sends this message
pb commands please
Bot: Currently, there is these commands:
pb alive : Sends a alive message
pb coffee : brews a cup of coffee
pb commands : sends this message
pb help me
@ppwater I am ppwaterBot. I am made by ppwater. run pb commands to see all the commands
Okay now I have to use dict.
tb alive
tb alive
@tech Are you here?
Oh, you are gone
BOT: starting.. Hello everyone!
pb blame
@ppwater Bot: It's @ppwater's fault
pb blame
@ppwater Bot: It's my fault
pb blame
@ppwater Bot: It's @ppwater's fault
pb blame
@ppwater Bot: It's @ppwater's fault
Hey!
pb blame
@ppwater Bot: It's @tech's fault
Okay everyone bye!
Oh, Or not
BOT: starting.. Hello everyone!
pb stop
BOT: starting.. Hello everyone!
pb stop
BOT: starting.. Hello everyone!
pb stop
BOT: starting.. Hello everyone!
pb alive
@ppwater Bot: Of course I am alive
pb stop
pb siawjofe
pb help
pb alive
BOT: starting.. Hello everyone!
pb stop
pb alive
pb?
BOT: starting.. Hello everyone!
pb alive
@ppwater Bot: Yep, don't worry
pb blame
@ppwater Bot: It's the program's fault
Seriously?
pb help
@ppwater Bot: I am ppwaterBot. I am made by ppwater. run pb commands to see all the commands.
pb commands
Bot: Currently, there is these commands:
pb alive : Sends a alive message
pb coffee : brews a cup of coffee
pb commands : sends this message
BOT: starting.. Hello everyone!
pb help
@ppwater Bot: I am ppwaterBot. I am made by ppwater. run pb commands to see all the commands.
Link works!
BOT: starting.. Hello everyone!
pb commands
Bot: Currently, there is these commands:
pb alive : Sends a alive message
pb coffee [someone]: brews a cup of coffee (for someone)
pb help: help message
pb blame: blames something

pb commands : sends this message
Does anyone know how to know the user id of the message poster? (AND the user name)
2
 
1:48 PM
Yep.
 
@ann how?
 
event.user.id
 
BOT: starting.. Hello everyone!
pb stop
 
and event.user.name
 
Oh, it's not a function
BOT: starting.. Hello everyone!
pb stop
@ppwater Bye!
Yay!
Only bad thing is it's making me leave
BOT: starting.. Hello everyone!
pb commands
Bot: Currently, there is these commands:
pb alive : Sends a alive message
pb coffee [someone]: brews a cup of coffee (for someone)
pb help: help message
pb blame: blames something
**admin only** pb stop: kick the bot out
pb commands : sends this message
@AnnZen Thanks!
BOT: starting.. Hello everyone!
pb commands
Bot: Currently, there is these commands:
pb alive : Sends a alive message
pb coffee [someone]: brews a cup of coffee (for someone)
pb help: help message
pb blame: blames something
**admin only** pb stop: kick the bot out (
pb commands : sends this message
BOT: starting.. Hello everyone!
pb commands
Bot: Currently, there is these commands:
pb alive : Sends a alive message
pb coffee [someone]: brews a cup of coffee (for someone)
pb help: help message
pb blame: blames something
**admin only** pb stop: kick the bot out of the room (**Do not use this often**)
pb commands : sends this message
pb stop
@ppwater Bye!
Okay
Bye everyone!
BOT: starting.. Hello everyone!
 

« first day (5 days earlier)      last day (347 days later) »