Skip to content

en quickstart

Katinor edited this page Sep 5, 2018 · 1 revision

Installation

To install the library, you can just run the following command:

pip install kakaobot.py

You can use import kakaobot after you install

Example code

https://github.com/Katinor/kakao_bot.py.prac

Basic structure

import kakaobot
app = kakaobot.Client(port = 7900)

###########################
# Just add what you want! #
###########################

app.run()

Very simple! Declare kakaobot.Client, Register Commands you want, and call kakaobot.Client.run() method.

Foe example, You can make chatbot to say "Hello" when "Hi" has been heard.

import kakaobot

app = kakaobot.Client(port = 7900)

@app.add_command()
def Hi():
	return kakaobot.Message(text = "Hello")

app.run()

You can force user to answer using button only. check below.

import kakaobot

init_kb = kakaobot.Kboard(button = ["Hi"])
app = kakaobot.Client(port = 7900, kboard = init_kb)

@app.add_command()
def Hi():
	return kakaobot.Message(text = "Hello")

app.run()

Sidebar

  • en : English
  • ko : 한국어
Clone this wiki locally