Home

Awesome

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

PropertyTypeDescription
activityActivityThe activity information to be set for the Discord RPC.
statusStringThe user's status, could be online, idle, dnd
sinceLongThe Unix time (in milliseconds) when the user started the activity.

Activity

Required fields are marked with *

PropertyTypeDescription
applicationIdStringThe application id of your app from discord developer portal. NOTE: applicationId is required if you want to use buttons
name*StringThe name of the activity that is being set.
detailsStringA detailed message about the activity.
stateStringA short message about the activity.
type*IntThe type of activity, could be 0 for playing, 1 for streaming, 2 for listening, 3 for watching, 5 for competing.
timestampsTimestampsThe timestamps of the activity, including start and end time.
assetsAssetsThe assets of the activity, including large image and text, and small image and text.
buttonsList<String>A list of buttons labels.
metadataMetadataAdditional metadata for the activity.

Timestamps

PropertyTypeDescription
startLongThe Unix time (in milliseconds) when the activity started.
endLongThe Unix time (in milliseconds) when the activity ends.

Assets

PropertyTypeDescription
largeImageStringThe identifier of the large image asset. See activity-object-activity-asset-image
largeTextStringThe text displayed when hovering over the large image.
smallImageStringThe identifier of the small image asset. See activity-object-activity-asset-image
smallTextStringThe text displayed when hovering over the small image.

Metadata

PropertyTypeDescription
metadataList<String>List of button url(s).