commonMain.dev.schlaubi.lavakord.plugins.lavasrc.DeezerHelperFunctions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lavasrc-jvm Show documentation
Show all versions of lavasrc-jvm Show documentation
Coroutine based client for Lavalink (Kotlin and Java)
// DO NOT EDIT!! - This code has been generated by QueryUtilityProcessor
// Edit this file instead lavasrc/src/commonMain/kotlin/QueryUtils.kt
@file:Suppress(names = arrayOf("IncorrectFormatting", "INVISIBLE_REFERENCE"))
package dev.schlaubi.lavakord.plugins.lavasrc
import dev.arbjerg.lavalink.protocol.v4.LoadResult
import dev.schlaubi.lavakord.audio.Node
import dev.schlaubi.lavakord.audio.player.PlayOptions
import dev.schlaubi.lavakord.audio.player.Player
import dev.schlaubi.lavakord.rest.loadItem
import kotlin.contracts.InvocationKind.EXACTLY_ONCE
import kotlin.contracts.contract
/**
* Performs a track search and plays the result using [Deezer](https://deezer.com).
*/
public suspend fun Player.searchAndPlayUsingDeezer(query: String,
playOptionsBuilder: PlayOptions.() -> Unit = {}) {
contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) }
searchAndPlayTrack("dzsearch:$query", playOptionsBuilder)
}
/**
* Performs a track search using [Deezer](https://deezer.com).
*/
public suspend fun Node.searchUsingDeezer(query: String): LoadResult = loadItem("dzsearch:$query")
/**
* Performs a track search and plays the result using [Deezer](https://deezer.com).
*
* @param isrc The [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) of
* the song you want to play
*/
public suspend fun Player.loadAndPlayUsingDeezer(isrc: String,
playOptionsBuilder: PlayOptions.() -> Unit = {}) {
contract { callsInPlace(playOptionsBuilder, EXACTLY_ONCE) }
searchAndPlayTrack("dzisrc:$isrc", playOptionsBuilder)
}
/**
* Performs a track search using [Deezer](https://deezer.com).
*
* @param isrc The [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) of
* the song you want to play
*/
public suspend fun Node.loadUsingDeezer(isrc: String): LoadResult = loadItem("dzisrc:$isrc")