From 8b7d361c0dcf287edaa104d6e81faf1d6d6157a8 Mon Sep 17 00:00:00 2001 From: MagM1go Date: Sat, 14 Sep 2024 21:48:57 +0800 Subject: [PATCH 1/3] Update Boticord Kotlin SDK documentation --- docs/sdk/kotlin.mdx | 103 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 80 insertions(+), 23 deletions(-) diff --git a/docs/sdk/kotlin.mdx b/docs/sdk/kotlin.mdx index 1922b75..bdcb1d0 100644 --- a/docs/sdk/kotlin.mdx +++ b/docs/sdk/kotlin.mdx @@ -4,49 +4,106 @@ description: Basic documentation for the botikotlin library slug: /sdk/botikotlin --- -An easy-to-use library designed to simplify interaction with the BotiCord API v3 +# Botikotlin Documentation -[GitHub repo](https://github.com/MagM1go/botikotlin/) -[Docs](https://magmigo2.gitbook.io/boticord-kotlin/) +### Simplified Kotlin DSL library for interacting with the BotiCord API v3. +[GitHub Repository](https://github.com/MagM1go/botikotlin/) +[Documentation](https://magmigo2.gitbook.io/boticord-kotlin/) -# Installation +## Installation -Add to your build.gradle (this example for build.gradle.kts) +To get started, add the following to your build file (build.gradle/.kts or pom.xml). + +### For Gradle ```gradle repositories { - maven(url = uri("https://jitpack.io")) + maven("https://jitpack.io") } dependencies { - implementation("com.github.MagM1go:botikotlin:1.0-beta") + implementation("com.github.boticord:botikotlin:VERSION") } ``` -# Usage -Send bot statistics: +### For Maven + +```xml + + + jitpack.io + https://jitpack.io + + + + + + com.github.boticord + botikotlin + VERSION + + +``` + +## Usage + +### Sending Bot Statistics + +Here’s an example of how to send bot statistics: ```kotlin -fun main(args: Array) { - val botID: Long = 0000000000000000 - val client = BotiCordClient("BOTICORD_TOKEN_HERE") - - client.updateBotStats(botID, BotStats( - members = 10000, - guilds = 5000, - shards = 3 - )) +fun main() { + val token = "YOUR_BOTICORD_TOKEN_HERE" + val response = boticord(token) { + update(BOT_ID, memberCount?, shardCount?, guildCount?) + } + + logger.info(response) } ``` -Get server information: +### Fetching User or Bot Information + +You can easily retrieve information about a user or bot like this: ```kotlin -fun main(args: Array) { - val serverID: Long = 0000000000000000 - val client = BotiCordClient("BOTICORD_TOKEN_HERE") +fun main() { + val api = boticord(token) + val response = api.fetch(USER_ID, Type.User) + + logger.info(response) - println(client.getServer(serverID)) + // or use the DSL-style approach + val responseDsl = boticord(token) { + fetch(USER_ID, Type.Bot) + } + + logger.info(responseDsl) } ``` + +For fetching server information, simply replace `Type.User/Bot` with `Type.Server`. + +### Receiving Notifications (e.g., bumps, comments, etc.) + +To listen for notifications like bumps or comments, use the following: + +```kotlin +boticord(token) { + notifications { event -> + logger.info("Received event: $event") + } +} +``` + + +--- + +If you encounter any difficulties, feel free to reach out! + +If you have any difficulties with library, you can ask at [Boticord Support Server](https://get.boticord.top/support). + +Or just create an issue at [SDK repository](https://github.com/boticord/botikotlin/issues/new/choose) + +Library developer: [MagMigo](https://boticord.top/profile/598387707311554570) \ No newline at end of file From ab4856477e79eac65a73a067e7d2344a95d6ed76 Mon Sep 17 00:00:00 2001 From: MagM1go Date: Sat, 14 Sep 2024 23:20:09 +0800 Subject: [PATCH 2/3] Forgotten await call --- docs/sdk/kotlin.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/sdk/kotlin.mdx b/docs/sdk/kotlin.mdx index bdcb1d0..a6527d9 100644 --- a/docs/sdk/kotlin.mdx +++ b/docs/sdk/kotlin.mdx @@ -57,7 +57,7 @@ fun main() { val token = "YOUR_BOTICORD_TOKEN_HERE" val response = boticord(token) { update(BOT_ID, memberCount?, shardCount?, guildCount?) - } + }.await() logger.info(response) } @@ -77,7 +77,7 @@ fun main() { // or use the DSL-style approach val responseDsl = boticord(token) { fetch(USER_ID, Type.Bot) - } + }.await() logger.info(responseDsl) } @@ -94,7 +94,7 @@ boticord(token) { notifications { event -> logger.info("Received event: $event") } -} +}.await() ``` From b58494deaae7391f48a8d8c6d72566ea9fa64c24 Mon Sep 17 00:00:00 2001 From: MagM1go <68418026+MagM1go@users.noreply.github.com> Date: Sun, 15 Sep 2024 01:02:48 +0800 Subject: [PATCH 3/3] Update docs/sdk/kotlin.mdx Co-authored-by: Mirdukkk <44965055+Mirdukkk@users.noreply.github.com> --- docs/sdk/kotlin.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdk/kotlin.mdx b/docs/sdk/kotlin.mdx index a6527d9..dd3d8b6 100644 --- a/docs/sdk/kotlin.mdx +++ b/docs/sdk/kotlin.mdx @@ -8,7 +8,7 @@ slug: /sdk/botikotlin ### Simplified Kotlin DSL library for interacting with the BotiCord API v3. -[GitHub Repository](https://github.com/MagM1go/botikotlin/) +[GitHub Repository](https://github.com/boticord/botikotlin/) [Documentation](https://magmigo2.gitbook.io/boticord-kotlin/) ## Installation