All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.freya022.botcommands.internal.components.data.timeout.PersistentTimeout.kt Maven / Gradle / Ivy

Go to download

A Kotlin-first (and Java) framework that makes creating Discord bots a piece of cake, using the JDA library.

The newest version!
package io.github.freya022.botcommands.internal.components.data.timeout

import net.dv8tion.jda.api.entities.ISnowflake

internal class PersistentTimeout private constructor(
    val handlerName: String,
    val userData: List
) : ComponentTimeout {
    internal companion object {
        internal fun create(handlerName: String, userData: List): PersistentTimeout {
            return PersistentTimeout(
                handlerName,
                userData.map { arg ->
                    when (arg) {
                        null -> null
                        is ISnowflake -> arg.id
                        else -> arg.toString()
                    }
                }
            )
        }

        internal fun fromData(handlerName: String, userData: List): PersistentTimeout {
            return PersistentTimeout(
                handlerName,
                userData
            )
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy