Skip to content

Commit

Permalink
Update Boticord Kotlin SDK documentation (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
MagM1go authored Sep 14, 2024
1 parent b0db646 commit f616e76
Showing 1 changed file with 80 additions and 23 deletions.
103 changes: 80 additions & 23 deletions docs/sdk/kotlin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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/boticord/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
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.github.boticord</groupId>
<artifactId>botikotlin</artifactId>
<version>VERSION</version>
</dependency>
</dependencies>
```

## Usage

### Sending Bot Statistics

Here’s an example of how to send bot statistics:

```kotlin
fun main(args: Array<String>) {
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?)
}.await()

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<String>) {
val serverID: Long = 0000000000000000
val client = BotiCordClient("BOTICORD_TOKEN_HERE")
fun main() {
val api = boticord(token)
val response = api.fetch(USER_ID, Type.User)

println(client.getServer(serverID))
logger.info(response)

// or use the DSL-style approach
val responseDsl = boticord(token) {
fetch(USER_ID, Type.Bot)
}.await()

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")
}
}.await()
```


---

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)

0 comments on commit f616e76

Please sign in to comment.