Skip to content

dead8309/KizzyRPC

Repository files navigation

CodeFactor Maintenance Kotlin Android Open Source? Yes!

KizzyRPC

KizzyRPC is an Android library for Discord Rich Presence in Kotlin. With KizzyRPC, you can easily implement Discord Rich Presence into your Android project and make your application more immersive.

Adding the library to your project

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
    implementation 'com.github.dead8309:KizzyRPC:1.0.71'
}

Usage

 val rpc = KizzyRPC("DISCORD ACCOUNT TOKEN")
 rpc.setActivity(
    activity = Activity(
        applicationId = "962990036020756480",
        name = "hi",
        details = "details",
        state = "state",
        type = 0,
        timestamps = Timestamps(
            start = System.currentTimeMillis(),
            end = System.currentTimeMillis() + 500000
        ),
        assets = Assets(
            largeImage = "mp:attachments/973256105515974676/983674644823412798/unknown.png",
            smallImage = "mp:attachments/973256105515974676/983674644823412798/unknown.png",
            largeText = "large-image-text",
            smallText = "small-image-text",
        ),
        buttons = listOf("Button 1", "Button 2"),
        metadata = Metadata(
            listOf(
                "https://youtu.be/1yVm_M1sKBE",
                "https://youtu.be/1yVm_M1sKBE",
            )
        )
    ),
    status = "online",
    since = System.currentTimeMillis()
)

Rpc Options

Property Type Description
activity Activity The activity information to be set for the Discord RPC.
status String The user's status, could be online, idle, dnd
since Long The Unix time (in milliseconds) when the user started the activity.

Activity

Required fields are marked with *

Property Type Description
applicationId String The application id of your app from discord developer portal. NOTE: applicationId is required if you want to use buttons
name* String The name of the activity that is being set.
details String A detailed message about the activity.
state String A short message about the activity.
type* Int The type of activity, could be 0 for playing, 1 for streaming, 2 for listening, 3 for watching, 5 for competing.
timestamps Timestamps The timestamps of the activity, including start and end time.
assets Assets The assets of the activity, including large image and text, and small image and text.
buttons List A list of buttons labels.
metadata Metadata Additional metadata for the activity.

Timestamps

Property Type Description
start Long The Unix time (in milliseconds) when the activity started.
end Long The Unix time (in milliseconds) when the activity ends.

Assets

Property Type Description
largeImage String The identifier of the large image asset. See activity-object-activity-asset-image
largeText String The text displayed when hovering over the large image.
smallImage String The identifier of the small image asset. See activity-object-activity-asset-image
smallText String The text displayed when hovering over the small image.

Metadata

Property Type Description
metadata List List of button url(s).