Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Boticord Kotlin SDK documentation #28

Merged
merged 3 commits into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading