| name | astral-bot |
| description | Use when creating, editing, debugging, or explaining Astral KakaoTalk bots. Covers bot API, script syntax, flow compilation, REST API usage, and plugin development. Use ONLY for Astral bot framework questions, not for general programming help. |
Astral Bot โ ๋ด ๋ง๋ค๊ธฐ ๋์ฐ๋ฏธ
Astral์ ์นด์นด์คํก ๋ด์ ๋ง๋๋ ์๋๋ก์ด๋ ํ๋ ์์ํฌ์
๋๋ค.
๋ด API ์์ฝ
bot.reply('๋ฉ์์ง')
bot.toast('ํ
์คํธ')
bot.vibrate(200)
bot.log('๋ก๊ทธ')
bot.getName()
bot.onMessage(fn)
bot.onCommand('name',fn)
bot.setPrefix(['!','/'])
bot.reply('๋ฉ์์ง')
bot.toast('ํ
์คํธ')
bot.log('๋ก๊ทธ')
bot.get_name()
bot.on_message(fn)
bot.on_command('name', fn)
bot.set_prefix(['!', '/'])
์์ฃผ ํ๋ ์ค์
bot.onMessage๋ฅผ ํจ์ ํธ์ถํ์ง ๋ง๊ณ ์ ๋ฌ๋ง: bot.onMessage(fn) (O), bot.onMessage(fn()) (X)
- Python์
bot.on_message (snake_case) ์ฌ์ฉ
bot.reply๋ฅผ ํธ์ถํ๊ธฐ ์ ์ ๋ฉ์์ง๊ฐ ์์ผ ํจ (onMessage ์ฝ๋ฐฑ ์์์ ํธ์ถ)
REST API (์ธ๋ถ ์ ์ด)
| ๋ฉ์๋ | ์๋ํฌ์ธํธ | ์ค๋ช
|
|---|
| GET | /api/v1/bots | ๋ด ๋ชฉ๋ก |
| POST | /api/v1/bots | ๋ด ์์ฑ {name, language} |
| POST | /api/v1/message | ๋ฉ์์ง ์ ์ก {room, message} |
| POST | /api/v1/flows/compile | ํ๋ก์ฐ โ ์ฝ๋ ๋ณํ |
๊ธฐ๋ณธ ํ
ํ๋ฆฟ
์ ๋ด์ ๋ง๋ค๋ฉด ์๋ ์ฝ๋๊ฐ ์๋์ผ๋ก ๋ค์ด๊ฐ๋๋ค. onMessage๋ก ์์ํ๊ณ onCommand๋ก ๋ช
๋ น์ด๋ฅผ ์ถ๊ฐํ๋ ํจํด์ ์ถ์ฒํฉ๋๋ค.
ํ๋ฌ๊ทธ์ธ (.atlp)
ZIP ๊ตฌ์กฐ: plugin.json + main.js. manifest์ hooks ํ๋๋ก ์ด๋ฒคํธ ๊ตฌ๋
.
ํ๋ก์ฐ โ ์ฝ๋
๋น์ฃผ์ผ ํ๋ก์ฐ๋ FlowCompiler๋ฅผ ํตํด JavaScript๋ก ๋ณํ๋ฉ๋๋ค. ๊ฐ ๋
ธ๋๋ ์์ฐจ์ ์ผ๋ก ์คํ๋๋ฉฐ, ์กฐ๊ฑด ๋ถ๊ธฐ๋ if๋ฌธ์ผ๋ก ๋ณํ๋ฉ๋๋ค.