Skip to content
← Back to Community
Chat bot in Ruby 2.5.0
Profile icon
Bloxy_Cola

A chat bot I made in Ruby 2.5.0

Voters
Profile icon
Sulok
Profile icon
DollarSign
Profile icon
ash15khng
Profile icon
amasad
Profile icon
Bloxy_Cola
Comments
hotnewtop
Profile icon
k4t3xpl0si0n

Might I suggest adding spaces between the ends and beginning of the user's input perhaps? It kinda squishes it all together.

Profile icon
Bloxy_Cola

@k4t3xpl0si0n I dont understand...

Profile icon
k4t3xpl0si0n

@Bloxy_Cola Whenever a user types something in, the bot replies with (for example: ) "wow,pizzalooks like fun!"

Profile icon
Bloxy_Cola

@k4t3xpl0si0n 0h, thanks!

Profile icon
amasad

Nice! Maybe have it loop so it doesn't exit? Ask a simple question like "what's on your mind?" to keep the user entertained 😂

Profile icon
Bloxy_Cola
Profile icon
Bloxy_Cola

@amasad added!

Profile icon
dotcomboom

@Bloxy_Cola
You can put it in a loop like this:

loop do puts 'Bot: Whats on your mind?' puts 'Bot: wow,' + gets.strip + 'looks like fun!' end
Profile icon
Bloxy_Cola

@dotcomboom Ok! Thats good! Thanks!
PS: how do you do that code text thing?

Profile icon
dotcomboom

@Bloxy_Cola ah, you surround it with three backticks (`)

Profile icon
Bloxy_Cola

@dotcomboom so like this <p>Hi</p