### Example Request for /config/dbrate Source: https://kbotdocs.dev/reference/iris/Endpoint/config/dbrate A cURL command example to update the database polling rate to 300 milliseconds. ```shell curl -d '{"rate": 300}' \ -H "Content-Type: application/json" \ -X POST http://[YOUR_DEVICE_IP]:[bot_http_port]/config/dbrate ``` -------------------------------- ### cURL Example for /config/endpoint Source: https://kbotdocs.dev/reference/iris/Endpoint/config/endpoint An example of how to update the web server endpoint using a cURL command. ```shell curl -d '{"endpoint": "http://192.168.1.100:5000/new_messages"}' \ -H "Content-Type: application/json" \ -X POST http://[YOUR_DEVICE_IP]:[bot_http_port]/config/endpoint ``` -------------------------------- ### run() Source: https://kbotdocs.dev/reference/irispy-client/iris.bot/Class/Bot Starts the KakaoTalk bot and connects to the Iris server. This is a blocking method. ```APIDOC ## run() ### Description Starts the KakaoTalk bot and connects to the Iris server. This is a blocking method. ### Returns None ``` -------------------------------- ### Start Iris Source: https://kbotdocs.dev/learn/iris/installation/on-ubuntu Starts Iris. When run successfully, the dashboard is accessible at port 3000 on the /dashboard endpoint. ```shell ./iris_control start ``` -------------------------------- ### PyKV.get() syntax Source: https://kbotdocs.dev/reference/irispy-client/iris.util.pykv/Class/PyKV/get The basic syntax for calling the get method on a PyKV instance. ```python pyKV.get(key) ``` -------------------------------- ### Run the bot instance Source: https://kbotdocs.dev/reference/irispy-client/iris.bot/Class/Bot/run Starts the KakaoTalk bot and establishes a connection to the Iris server. This is a blocking method. ```python bot.run() ``` -------------------------------- ### get(key: String) Source: https://kbotdocs.dev/reference/starlight/Object/Env Returns the value corresponding to a specific key from the environment file. ```APIDOC ## get(key: String) ### Description Returns the value corresponding to a specific key. ### Method Static method ### Parameters - **key** (String) - Required - The key to look up. ### Returns - **String** - The value associated with the key. ``` -------------------------------- ### Start and end anchors: ^ and $ Source: https://kbotdocs.dev/learn/js/intermediate/1-regular-expression The caret ^ anchors the match to the start of the string; the dollar sign $ anchors to the end. The examples show matching 'i' at the start of 'identity' and 'r' at the end of 'doctor'. ```regex /^i/ ``` ```regex /r$/ ``` -------------------------------- ### function onStart(activity) Source: https://kbotdocs.dev/reference/legacy/EventListener/onStart `onStart`는 스크립트 액티비티의 `onStart`가 호출되면 동작하는 이벤트 리스너입니다. 이 함수는 `activity` 매개변수를 통해 현재 액티비티를 전달받습니다. ```APIDOC ## function onStart(activity) ### Description `onStart`는 스크립트 액티비티의 `onStart`가 호출되면 동작하는 이벤트 리스너입니다. ### Syntax ```javascript function onStart(activity) { } ``` ### Parameters - **activity** (android.app.Activity) - 해당 이벤트가 발생했을 때의 액티비티입니다. ### Compatibility | 메신저봇R | 채팅 자동응답 봇 | StarLight | |---|---|---| | 0.1.2a 완전 지원 | 1.0 완전 지원 | 미지원 | ``` -------------------------------- ### activityStart 이벤트 리스너 등록 Source: https://kbotdocs.dev/reference/api2/Event/activityStart activityStart 이벤트에 대한 리스너를 등록하는 방법을 보여줍니다. Bot.addListener()를 사용하며, 이벤트 이름으로 'activityStart' 또는 Event.Activity.START를 사용할 수 있습니다. ```APIDOC ## activityStart 이벤트 ### Description `activityStart` 이벤트는 스크립트 액티비티의 `onStart`가 호출되면 발생하는 이벤트입니다. ### Method 이벤트 리스너 등록 (Bot.addListener) ### Endpoint N/A (이벤트 기반 API) ### Parameters #### Callback Parameters - **activity** (android.app.Activity) - Required - 해당 이벤트가 발생했을 때의 액티비티입니다. ### Request Example ```javascript bot.addListener("activityStart", (activity) => {}); // 또는 bot.addListener(Event.Activity.START, (activity) => {}); ``` ### Response #### Success Response 이벤트 리스너가 등록되면, 이벤트 발생 시 콜백이 호출됩니다. ### Compatibility | 메신저봇R | 채팅 자동응답 봇 | StarLight | |---|---|---| | 0.3.5a 완전 지원 | 4.0 완전 지원 | 미지원 | `activity` 매개변수: | 메신저봇R | 채팅 자동응답 봇 | StarLight | |---|---|---| | 0.3.5a 완전 지원 | 4.0 완전 지원 | 미지원 | ``` -------------------------------- ### Word boundary: \b Source: https://kbotdocs.dev/learn/js/intermediate/1-regular-expression \b matches a word boundary. The examples show matching 'd' at the start of 'developer', 'er' at the end of 'developer', and no match for 'vel' or 'z' because they are not at word boundaries. ```regex /\bd/ ``` ```regex /er\b/ ``` ```regex /vel\b/ ``` ```regex /z\b/ ``` -------------------------------- ### activityStart 이벤트 리스너 등록 Source: https://kbotdocs.dev/reference/api2/Event/activityStart Bot.addListener를 사용하여 activityStart 이벤트에 대한 리스너를 추가하는 방법입니다. 이벤트 이름으로 문자열 'activityStart' 또는 Event.Activity.START 상수를 사용할 수 있습니다. ```javascript bot.addListener("activityStart", (activity) => {}); // 또는 bot.addListener(Event.Activity.START, (activity) => {}); ``` -------------------------------- ### Character class patterns: [1234], [a-z], [^a-z] Source: https://kbotdocs.dev/learn/js/intermediate/1-regular-expression Character class patterns for matching specific characters, ranges, hyphens, and negated sets. The examples show how to match digits, lowercase letters, literal hyphens (when placed at the start or end), and characters not in a set. ```regex /[1234]/ ``` ```regex /[a-z]/ ``` ```regex /[-1234]/ ``` ```regex /[1234-]/ ``` ```regex /[^a-z]/ ``` -------------------------------- ### cURL Request Example Source: https://kbotdocs.dev/reference/iris/Endpoint/decrypt An example of how to invoke the /decrypt endpoint using cURL. ```shell curl -d '{"enc": 0, "b64_ciphertext": "[ENCRYPTED_MESSAGE_BASE64]", "user_id": 1234567890}' \ -H "Content-Type: application/json" \ -X POST http://[YOUR_DEVICE_IP]:[bot_http_port]/decrypt ``` -------------------------------- ### onStartCompile 이벤트 리스너 구문 (JavaScript) Source: https://kbotdocs.dev/reference/legacy/EventListener/onStartCompile 컴파일 시작 전에 호출되는 이벤트 리스너의 기본 구조입니다. 함수 본문에 컴파일 전에 실행할 코드를 작성합니다. ```JavaScript function onStartCompile() { } ``` -------------------------------- ### Event.Activity.START 구문 Source: https://kbotdocs.dev/reference/api2/Object/Event/Activity.START API2의 `activityStart` 이벤트를 참조하는 JavaScript 코드입니다. 이벤트 상수값은 `"activityStart"`입니다. ```JavaScript Event.Activity.START; ``` -------------------------------- ### startCompile 이벤트 리스너 등록 (JavaScript) Source: https://kbotdocs.dev/reference/api2/Event/startCompile 컴파일 요청 감지 시 컴파일 시작 전에 발생하는 startCompile 이벤트에 리스너를 추가합니다. Event.START_COMPILE 상수를 사용해 동일한 이벤트를 등록할 수 있습니다. ```javascript bot.addListener("startCompile", () => {}); // 또는 bot.addListener(Event.START_COMPILE, () => {}); ``` -------------------------------- ### onStartCompile 이벤트 리스너 등록 예시 Source: https://kbotdocs.dev/learn/js/migration-to-api2/1-event-listener 레거시 onStartCompile 함수를 API2에서 등록하는 4가지 방법을 보여줍니다. Event.START_COMPILE 상수 또는 문자열 "startCompile"을 사용할 수 있습니다. ```JavaScript // 기존 레거시 API 코드에 존재한 onStartCompile 이벤트 리스너 function onStartCompile() { // ... } // API2에서의 정상적인 동작을 위해 이벤트 리스너를 등록합니다. // 아래 4가지 코드 중 하나를 선택하여 사용합니다. bot.addListener(Event.START_COMPILE, onStartCompile); bot.addListener("startCompile", onStartCompile); bot.on(Event.START_COMPILE, onStartCompile); bot.on("startCompile", onStartCompile); ``` -------------------------------- ### Install redroid via iris_control Source: https://kbotdocs.dev/learn/iris/installation/on-ubuntu Installs docker and redroid on Ubuntu. When run successfully, redroid runs in a docker container. ```shell ./iris_control install_redroid ``` -------------------------------- ### GlobalLog.i() Source: https://kbotdocs.dev/reference/api2/Object/GlobalLog/i 정보 로그를 작성합니다. showToast 값이 true일 경우 로그를 토스트 메시지로 출력합니다. GlobalLog.info()와 동일한 동작을 합니다. ```APIDOC ## GlobalLog.i() ### Description 정보 로그를 작성합니다. `showToast`의 값이 `true`일 경우 작성된 로그를 토스트 메시지로 출력합니다. 해당 메소드의 동작은 `GlobalLog.info()`와 같습니다. ### Method `GlobalLog.i()` ### Syntax ```javascript GlobalLog.i(data); GlobalLog.i(data, showToast); ``` ### Parameters - `data` (String) - Required - 작성할 정보 로그의 내용 - `showToast` (Boolean) - Optional - 작성된 로그를 토스트 메시지로 출력할 것인지의 여부. 기본값: `false` ### Compatibility | 메신저봇R | 채팅 자동응답 봇 | StarLight | |---|---|---| | 0.3.5a 완전 지원 | 4.0 완전 지원 | 미지원 | ``` -------------------------------- ### Install KakaoTalk APKs on redroid Source: https://kbotdocs.dev/learn/iris/installation/on-ubuntu Installs the extracted APK files from the KakaoTalk package onto redroid. The first command is for Windows PowerShell, the second for macOS/Linux. Replace placeholders with the server IP and the path to the extracted folder. A 'Success' message indicates a successful installation. ```shell ./adb -s [Ubuntu_서버의_IP] install-multiple (Get-Item [압축_해제한_폴더의_경로]/*.apk) ``` ```shell ./adb -s [Ubuntu_서버의_IP] install-multiple /[압축_해제한_폴더의_경로]/*.apk ``` -------------------------------- ### onStart 이벤트 리스너 기본 구문 Source: https://kbotdocs.dev/reference/legacy/EventListener/onStart onStart 이벤트 리스너의 기본 구조입니다. 스크립트 액티비티의 onStart가 호출될 때 실행되며, activity 인자로 android.app.Activity 객체를 받습니다. ```JavaScript function onStart(activity) { } ``` -------------------------------- ### while loop example with initialization and increment Source: https://kbotdocs.dev/learn/js/basic/10-loops Example of a while loop that requires separate initialization and increment expressions. It replies with the loop index three times. ```JavaScript let i = 0; // 초기화식 while (i < 3) { msg.reply(`loop: ${i}`); i++; // 증감식 } ``` -------------------------------- ### prepare Source: https://kbotdocs.dev/reference/legacy/Object/Api Prepares the bot for operation. Fully supported on all listed platforms. ```APIDOC ## prepare ### Description Prepares the bot for operation. Fully supported on all listed platforms. ### Compatibility - MessengerBotR 0.1.2a: Full support - Chat Auto Reply Bot 1.0: Full support - StarLight 0.1.0a: Full support ``` -------------------------------- ### GET /dashboard Source: https://kbotdocs.dev/reference/iris/Endpoint/dashboard GET /dashboard 엔드포인트는 Iris의 구성을 위한 웹 UI를 제공합니다. 웹 브라우저를 통해 접속할 수 있습니다. ```APIDOC ## GET /dashboard ### Description Iris의 구성을 위한 웹 UI를 제공하는 엔드포인트입니다. 웹 브라우저를 통해 접속할 수 있습니다. ### Method GET ### Endpoint /dashboard ### Request Example ``` curl http://[YOUR_DEVICE_IP]:[bot_http_port]/dashboard ``` ### Response #### Success Response (200) - **body** (HTML) - Iris의 구성을 위한 웹 UI (HTML)입니다. ``` -------------------------------- ### Event.START_COMPILE Source: https://kbotdocs.dev/reference/api2/Object/Event/START_COMPILE API2의 `startCompile` 이벤트 상수입니다. 이벤트가 발생했을 때 사용할 수 있는 상수로, 값은 문자열 `"startCompile"`입니다. ```APIDOC ## Event.START_COMPILE ### Description API2의 `startCompile` 이벤트입니다. ### Syntax ```javascript Event.START_COMPILE; ``` ### Constant Value `String` - `"startCompile"` ### Compatibility | MessengerBot R | Chat Auto Reply Bot | StarLight | |---|---|---| | 0.3.5a (완전 지원) | 4.0 (완전 지원) | No (미지원) | ``` -------------------------------- ### do...while loop example with initialization and increment Source: https://kbotdocs.dev/learn/js/basic/10-loops Example of a do...while loop that requires separate initialization and increment expressions. It replies with the loop index three times. ```JavaScript let i = 0; // 초기화식 do { msg.reply(`loop: ${i}`); i++; // 증감식 } while (i < 3); ``` -------------------------------- ### curl example for /config/botport Source: https://kbotdocs.dev/reference/iris/Endpoint/config/botport Example curl command to update the bot HTTP server port. Replace [YOUR_DEVICE_IP] and [bot_http_port] with your device IP and current bot HTTP port. The port change is applied after an Iris restart. ```shell curl -d '{"port": 3001}' \ -H "Content-Type: application/json" \ -X POST http://[YOUR_DEVICE_IP]:[bot_http_port]/config/botport ``` -------------------------------- ### GET /aot Source: https://kbotdocs.dev/reference/iris Returns AOT-related tokens. ```APIDOC ## GET /aot ### Description Returns AOT-related tokens. ### Method GET ### Endpoint /aot ``` -------------------------------- ### setDataBase(fileName: String, data: String): String Source: https://kbotdocs.dev/reference/legacy/Object/DataBase 문자열을 fileName 이름의 파일에 덮어씁니다. 파일이 존재하지 않을 경우 fileName 이름의 파일을 생성합니다. 덮어쓰거나 생성한 파일의 최종 내용을 반환합니다. ```APIDOC ## setDataBase(fileName: String, data: String): String ### Description 문자열을 fileName 이름의 파일에 덮어씁니다. 파일이 존재하지 않을 경우 fileName 이름의 파일을 생성합니다. 덮어쓰거나 생성한 파일의 최종 내용을 반환합니다. ### Method setDataBase ### Parameters - **fileName** (String) - Required - 파일 이름 - **data** (String) - Required - 덮어쓸 내용 ### Returns - **String** - 파일의 최종 내용 ``` -------------------------------- ### console.time() Source: https://kbotdocs.dev/reference/api2/Object/console/time Starts a timer with a specified label. This is an experimental feature. ```APIDOC ## console.time() ### Description Starts a timer with a specified label. This is an experimental feature. ### Method console.time() ### Syntax ``` console.time(); console.time(label); ``` ### Parameters - `label` (String) - Optional - The label for the timer to start. Defaults to `"default"`. ### Compatibility | Platform | Support | | --- | --- | | 메신저봇R | 0.7.40-alpha.03 (완전 지원) | | 채팅 자동응답 봇 | No (미지원) | | StarLight | No (미지원) | Note: In version 0.7.39a, the default value of `label` is `undefined` (issue #24). ``` -------------------------------- ### new_member 이벤트 핸들러 등록 (Python) Source: https://kbotdocs.dev/reference/irispy-client/Event/new_member new_member 이벤트가 발생했을 때 호출될 핸들러를 등록하는 예제입니다. on_event() 데코레이터에 이벤트 이름을 지정하고, 핸들러 함수는 ChatContext 객체를 인자로 받습니다. ```python from iris import ChatContext @bot.on_event("new_member") def on_new_member(chat: ChatContext): ... ``` -------------------------------- ### BotManager.prepareAll() Source: https://kbotdocs.dev/reference/api2/Object/BotManager/prepareAll Executes prepare() for all Bot objects. Returns the number of Bots that were attempted to compile, regardless of compilation success. If throwOnError is true, throws an error on compilation failure. ```APIDOC ## BotManager.prepareAll() ### Description Executes prepare() for all Bot objects. Returns the number of Bots that were attempted to compile, regardless of compilation success. If throwOnError is true, throws an error on compilation failure. ### Method Static Method ### Syntax ``` BotManager.prepareAll(); BotManager.prepareAll(throwOnError); ``` ### Parameters - **throwOnError** (Boolean) - Optional - Whether to throw an error on compilation failure. Default: `false`. ### Return Value - **Number** - The number of Bot objects that were attempted to compile. ### Compatibility | MessengerBot R | Chat Auto Reply Bot | StarLight | |---|---|---| | 0.3.5a (Full support) | No (Not supported) | No (Not supported) | ``` -------------------------------- ### Message.room Source: https://kbotdocs.dev/reference/starlight/Argument/Message/room Gets the ChatRoom object for the room where the message was sent. ```APIDOC ## Message.room ### Description Gets the `ChatRoom` object for the room where the message was sent. ### Syntax ```javascript msg.room; ``` ### Value - **Type**: `ChatRoom` - The `ChatRoom` object for the room where the message was sent. ``` -------------------------------- ### Security.eccKey Source: https://kbotdocs.dev/reference/api2/Object/Security Gets the ECC key. Supported only in MessengerBotR 0.7.40-alpha.02. ```APIDOC ## Security.eccKey ### Description Gets the ECC key. ### Method `Security.eccKey` ### Parameters No parameters documented. ### Return Value ECC key. ### Compatibility - MessengerBotR: 0.7.40-alpha.02 (Full support) - Chat Auto Reply Bot: Not supported - StarLight: Not supported ``` -------------------------------- ### BotManager.prepare() syntax Source: https://kbotdocs.dev/reference/api2/Object/BotManager/prepare Two overloads: prepare(botName) and prepare(botName, throwOnError). If the bot has never been compiled, it compiles it. Returns 0 on failure, 1 on success, or 2 if already compiled. ```javascript BotManager.prepare(botName); BotManager.prepare(botName, throwOnError); ``` -------------------------------- ### String 객체의 includes 메소드 사용 Source: https://kbotdocs.dev/learn/js/basic/12-basic-object String 객체의 includes 메소드를 사용하여 특정 문자열 포함 여부를 확인합니다. "Hello, World!".includes("World")는 true를 반환합니다. ```JavaScript "Hello, World!".includes("World"); // true ``` -------------------------------- ### Security.desKey Source: https://kbotdocs.dev/reference/api2/Object/Security Gets the DES key. Supported only in MessengerBotR 0.3.5a. ```APIDOC ## Security.desKey ### Description Gets the DES key. ### Method `Security.desKey` ### Parameters No parameters documented. ### Return Value DES key. ### Compatibility - MessengerBotR: 0.3.5a (Full support) - Chat Auto Reply Bot: Not supported - StarLight: Not supported ``` -------------------------------- ### on Source: https://kbotdocs.dev/reference/legacy/Object/Api Enables the bot. Fully supported on all listed platforms. ```APIDOC ## on ### Description Enables the bot. Fully supported on all listed platforms. ### Compatibility - MessengerBotR 0.1.2a: Full support - Chat Auto Reply Bot 1.0: Full support - StarLight 0.1.0a: Full support ``` -------------------------------- ### chatContext.api Source: https://kbotdocs.dev/reference/irispy-client/iris.bot.models/Class/ChatContext/api Gets the IrisAPI object for interacting with the Iris server. ```APIDOC ## chatContext.api ### Description Gets the `IrisAPI` object for interacting with the Iris server. ### Syntax ```python chatContext.api ``` ### Value - **Type**: `iris.bot._internal.iris.IrisAPI` - An `IrisAPI` object for interacting with the Iris server. ``` -------------------------------- ### url Source: https://kbotdocs.dev/reference/irispy-client/iris.bot.models/Class/Avatar Gets the URL of the profile image. This property is cached. ```APIDOC ## url ### Description Gets the URL of the profile image. This property is cached. ### Property `str` - The URL of the profile image. ``` -------------------------------- ### GET /config Source: https://kbotdocs.dev/reference/iris Retrieves the current configuration as a JSON response. ```APIDOC ## GET /config ### Description Retrieves the current configuration as a JSON response. ### Method GET ### Endpoint /config ``` -------------------------------- ### Message.author Source: https://kbotdocs.dev/reference/api2/Argument/Message/author Gets the `User` object representing the sender of the message. ```APIDOC ## Message.author ### Description 메시지의 발신자에 대한 `User` 객체입니다. ### Syntax ```javascript msg.author; ``` ### Value `User` - 메시지의 발신자에 대한 `User` 객체입니다. ### Compatibility | 메신저봇R | 채팅 자동응답 봇 | StarLight | |---|---|---| | 0.3.5a 완전 지원 | 4.0 완전 지원 | 미지원 | ``` -------------------------------- ### BotManager.prepareAll() syntax Source: https://kbotdocs.dev/reference/api2/Object/BotManager/prepareAll Shows the two overloads of prepareAll(): without arguments and with the optional throwOnError boolean parameter. The default value of throwOnError is false. ```javascript BotManager.prepareAll(); BotManager.prepareAll(throwOnError); ``` -------------------------------- ### Get all script names Source: https://kbotdocs.dev/reference/legacy/Object/Api/getScriptNames Retrieves the names of all scripts as an array of strings. ```javascript Api.getScriptNames(); ``` -------------------------------- ### GlobalLog.debug() 호출 구문 Source: https://kbotdocs.dev/reference/api2/Object/GlobalLog/debug 디버그 로그를 작성하는 두 가지 호출 형태입니다. 첫 번째는 data만 전달하고, 두 번째는 showToast를 true로 설정하여 토스트 메시지로도 출력합니다. showToast의 기본값은 false입니다. ```JavaScript GlobalLog.debug(data); GlobalLog.debug(data, showToast); ``` -------------------------------- ### img Source: https://kbotdocs.dev/reference/irispy-client/iris.bot.models/Class/Avatar Gets the byte value of the profile image. This property is cached. ```APIDOC ## img ### Description Gets the byte value of the profile image. This property is cached. ### Property `bytes` - The byte value of the profile image. ``` -------------------------------- ### AppData.putInt(key: String, integer: Number) Source: https://kbotdocs.dev/reference/common/Object/AppData 앱 데이터에 key: integer (String: Number(정수) 형식) 데이터를 씁니다. ```APIDOC ## AppData.putInt(key: String, integer: Number) ### Description 앱 데이터에 key: integer (String: Number(정수) 형식) 데이터를 씁니다. ### Method putInt ### Signature void putInt(key: String, integer: Number) ### Parameters - **key** (String) - Required - 저장할 데이터의 키 - **integer** (Number) - Required - 저장할 정수 값 ### Return void ``` -------------------------------- ### create(path: String) Source: https://kbotdocs.dev/reference/common/Object/FileStream path 경로의 파일을 생성합니다. 파일 생성의 성공 여부를 반환합니다. ```APIDOC ## create(path: String) ### Description path 경로의 파일을 생성합니다. 파일 생성의 성공 여부를 반환합니다. ### Method create ### Parameters - **path** (String) - Required - 생성할 파일 경로 ### Returns - **Boolean** - 생성 성공 여부 ``` -------------------------------- ### Env.get() syntax Source: https://kbotdocs.dev/reference/starlight/Object/Env/get The basic syntax for calling the get method on the Env object. ```javascript Env.get(key); ``` -------------------------------- ### Device.getBatteryTemp() Source: https://kbotdocs.dev/reference/common/Object/Device/getBatteryTemp Documentation for the Device.getBatteryTemp() static method, including syntax, return value, and compatibility information. ```APIDOC ## Device.getBatteryTemp() ### Description Returns the battery temperature (in degrees Celsius) of the device running the app. This method is only supported in the Chat Auto Reply bot, and can be replaced with `Device.getBatteryTemperature()` in MessengerBot R and StarLight. Note that the return value of `Device.getBatteryTemperature()` is `(temp * 10)`. ### Method `Device.getBatteryTemp()` ### Syntax ```javascript Device.getBatteryTemp(); ``` ### Return Value `Number` - The battery temperature (in degrees Celsius) of the device running the app. ### Compatibility | Platform | Support | |----------|---------| | MessengerBot R | Not supported | | Chat Auto Reply Bot | Fully supported (version 1.0) | | StarLight | Not supported | ``` -------------------------------- ### write(path: String, data: String) Source: https://kbotdocs.dev/reference/common/Object/FileStream 문자열을 path 경로의 파일에 덮어씁니다. 파일이 존재하지 않을 경우 path 경로의 파일을 생성합니다. 덮어쓰거나 생성한 파일의 최종 내용을 반환합니다. ```APIDOC ## write(path: String, data: String) ### Description 문자열을 path 경로의 파일에 덮어씁니다. 파일이 존재하지 않을 경우 path 경로의 파일을 생성합니다. 덮어쓰거나 생성한 파일의 최종 내용을 반환합니다. ### Method write ### Parameters - **path** (String) - Required - 파일 경로 - **data** (String) - Required - 저장할 문자열 ### Returns - **String** - 파일의 최종 내용 ``` -------------------------------- ### GlobalLog.i(data: String, showToast?: Boolean = false) Source: https://kbotdocs.dev/reference/api2/Object/GlobalLog 정보 로그를 작성합니다. showToast의 값이 true일 경우 작성된 로그를 토스트 메시지로 출력합니다. ```APIDOC ## GlobalLog.i(data: String, showToast?: Boolean = false) ### Description 정보 로그를 작성합니다. showToast의 값이 true일 경우 작성된 로그를 토스트 메시지로 출력합니다. ### Method i ### Signature i(data: String, showToast?: Boolean = false) ### Parameters - data (String) - Required - 로그로 작성할 데이터 - showToast (Boolean) - Optional - true일 경우 토스트 메시지로 출력 (기본값: false) ### Return Value void ### Example GlobalLog.i("info message"); GlobalLog.i("info message", true); ``` -------------------------------- ### Get device charger type Source: https://kbotdocs.dev/reference/common/Object/Device/getPlugType Retrieves the charger type of the device as a string. ```javascript Device.getPlugType(); ``` -------------------------------- ### AppData.size() Syntax Source: https://kbotdocs.dev/reference/common/Object/AppData/size Use this method to get the number of items stored in the AppData. ```JavaScript AppData.size(); ``` -------------------------------- ### Event.Activity.CREATE 구문 Source: https://kbotdocs.dev/reference/api2/Object/Event/Activity.CREATE API2의 `activityCreate` 이벤트를 참조하는 상수입니다. 값은 `"activityCreate"`입니다. 메신저봇R 0.3.5a 이상과 채팅 자동응답 봇 4.0 이상에서 완전 지원되며, StarLight에서는 지원되지 않습니다. ```JavaScript Event.Activity.CREATE; ``` -------------------------------- ### Message.isDebugRoom Source: https://kbotdocs.dev/reference/api2/Argument/Message/isDebugRoom Gets a Boolean value indicating whether the room is a debug room. ```APIDOC ## Message.isDebugRoom ### Description Indicates whether the room is a debug room. ### Syntax ```javascript msg.isDebugRoom; ``` ### Value `Boolean` - Whether the room is a debug room. ### Compatibility | MessengerBot R | Chat Auto-Reply Bot | StarLight | |---|---|---| | 0.7.40-alpha.08: Full support | 4.0: Full support | No: Not supported | | 0.3.5a: Full support | | | | 0.7.40-alpha.03: Works as method (`isDebugRoom()`) | | | ``` -------------------------------- ### activityCreate 리스너 등록 (JavaScript) Source: https://kbotdocs.dev/reference/api2/Event/activityCreate Bot.addListener()를 사용하여 activityCreate 이벤트에 대한 리스너를 추가합니다. Event.Activity.CREATE 상수를 사용하여 동일한 이벤트를 등록할 수 있습니다. 콜백은 savedInstanceState(Bundle)와 activity(Activity)를 인자로 받습니다. ```JavaScript bot.addListener("activityCreate", (savedInstanceState, activity) => {}); // 또는 bot.addListener(Event.Activity.CREATE, (savedInstanceState, activity) => {}); ``` -------------------------------- ### console.info(str, showToast?) Source: https://kbotdocs.dev/reference/legacy/Object/console Writes an info log. If showToast is true, the log is also displayed as a toast message. ```APIDOC ## console.info(str, showToast?) ### Description Writes an info log. If `showToast` is `true`, the log is also displayed as a toast message. ### Method info ### Signature `void info(str: String, showToast?: Boolean = false)` ### Parameters - **str** (String) - Required - The message to log. - **showToast** (Boolean) - Optional - Default `false`. If `true`, the log is also displayed as a toast message. ### Return Value - **void** - No return value. ```