Compare commits
2 commits
3a9795794c
...
589997c29e
Author | SHA1 | Date | |
---|---|---|---|
589997c29e | |||
55ccb175e1 |
20 changed files with 606 additions and 596 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,7 @@
|
||||||
### CUSTOM ###
|
### CUSTOM ###
|
||||||
/run/
|
/run/
|
||||||
|
/data/
|
||||||
|
data/
|
||||||
/.idea/
|
/.idea/
|
||||||
|
|
||||||
|
|
||||||
|
|
14
README.md
14
README.md
|
@ -4,10 +4,6 @@
|
||||||
|
|
||||||
A Discord music bot, written in Kotlin using the kord library.
|
A Discord music bot, written in Kotlin using the kord library.
|
||||||
|
|
||||||
[![Latest Release](https://gitlab.com/moonleay/botendo/-/badges/release.svg)](https://gitlab.com/moonleay/botendo/-/releases)
|
|
||||||
[![pipeline status](https://gitlab.com/moonleay/botendo/badges/master/pipeline.svg)](https://gitlab.com/moonleay/botendo/-/commits/master)
|
|
||||||
[![License](https://img.shields.io/badge/license-GPL--3.0-brightgreen)](https://gitlab.com/moonleay/botendo/-/blob/master/LICENSE)
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
[![Developer](https://img.shields.io/badge/moonleay-Developer-red)](https://gitlab.com/moonleay)
|
[![Developer](https://img.shields.io/badge/moonleay-Developer-red)](https://gitlab.com/moonleay)
|
||||||
|
@ -16,9 +12,9 @@ A Discord music bot, written in Kotlin using the kord library.
|
||||||
|
|
||||||
- HopeBaron for helping me a lot
|
- HopeBaron for helping me a lot
|
||||||
|
|
||||||
## Known issues
|
## Issues
|
||||||
|
|
||||||
- None (currently). Open an issue, report issues to issues@moonleay.net or message moonleay#0001 on Discord
|
- Report issues to issues@moonleay.net or message @moonleay on Discord
|
||||||
|
|
||||||
## Commands & Features
|
## Commands & Features
|
||||||
|
|
||||||
|
@ -63,9 +59,3 @@ A Discord music bot, written in Kotlin using the kord library.
|
||||||
|
|
||||||
Install IntellJ and import the project from git.
|
Install IntellJ and import the project from git.
|
||||||
Done.
|
Done.
|
||||||
|
|
||||||
## Docker commands 4 me
|
|
||||||
|
|
||||||
- docker run -it -m 2g -v/home/limited_dev/Documents/Code/Botendo/run/data/:/data/:rw limiteddev/botendo:x.x.x
|
|
||||||
- docker build -t limiteddev/botendo:x.x.x .
|
|
||||||
- docker push limiteddev/botendo:x.x.x
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_
|
||||||
?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
|
?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
|
||||||
?: "6.5.1"
|
?: "6.5.1"
|
||||||
|
|
||||||
val kordver = "1.5.6"
|
val kordver = "1.7.1-SNAPSHOT"
|
||||||
val lavaver = "4.0.0"
|
val lavaver = "4.0.0"
|
||||||
val coroutinesver = "1.1.0"
|
val coroutinesver = "1.1.0"
|
||||||
|
|
||||||
|
@ -70,6 +70,14 @@ repositories {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = "sonatype"
|
||||||
|
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "sonatype 2"
|
||||||
|
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val shadow by configurations.getting
|
val shadow by configurations.getting
|
||||||
|
|
|
@ -24,6 +24,7 @@ import dev.kord.common.Color
|
||||||
import dev.kord.core.behavior.interaction.response.respond
|
import dev.kord.core.behavior.interaction.response.respond
|
||||||
import dev.kord.core.event.interaction.ButtonInteractionCreateEvent
|
import dev.kord.core.event.interaction.ButtonInteractionCreateEvent
|
||||||
import dev.kord.core.on
|
import dev.kord.core.on
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.LavaKord
|
import dev.schlaubi.lavakord.LavaKord
|
||||||
import dev.schlaubi.lavakord.kord.lavakord
|
import dev.schlaubi.lavakord.kord.lavakord
|
||||||
import net.moonleay.botendo.data.CredentialManager
|
import net.moonleay.botendo.data.CredentialManager
|
||||||
|
@ -91,14 +92,14 @@ object Bot {
|
||||||
return@on
|
return@on
|
||||||
}
|
}
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Error"
|
||||||
"Error",
|
this.description = "Could not find button with id \"${inter.componentId}\".\nPlease report this."
|
||||||
"Could not find button with id \"${inter.componentId}\".\nPlease report this.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u)
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@ import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteract
|
||||||
import dev.kord.core.behavior.interaction.response.respond
|
import dev.kord.core.behavior.interaction.response.respond
|
||||||
import dev.kord.core.entity.Guild
|
import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.kord.rest.builder.message.modify.actionRow
|
import dev.kord.rest.builder.message.modify.actionRow
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
|
@ -43,14 +46,14 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
|
||||||
val voiceState = user.asMember(guildId).getVoiceStateOrNull()
|
val voiceState = user.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (voiceState == null) {
|
if (voiceState == null) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not connected to a VC"
|
||||||
"You are not connected to a VC",
|
this.description = "Please connect to a VC"
|
||||||
"Please connect to a VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -58,26 +61,26 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
|
||||||
val channelId = voiceState.channelId
|
val channelId = voiceState.channelId
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not connected"
|
||||||
"Not connected",
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
"I'm not in a VC and therefore, I am not playing anything.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not in my VC"
|
||||||
"You are not in my VC",
|
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||||
"We are not in the same VC and therefore, you cannot control the music",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -86,19 +89,18 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
|
||||||
|
|
||||||
val gts = MusicManager.getGuildTrackScheduler(guild, player)
|
val gts = MusicManager.getGuildTrackScheduler(guild, player)
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = if (player.paused) "I paused" else "I'm continuing"
|
||||||
if (player.paused) "I paused" else "I'm continuing",
|
this.description = if (player.paused) "I paused the song" else "I'm continuing to play the song."
|
||||||
if (player.paused) "I paused the song" else "I'm continuing to play the song.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
this.actionRow {
|
|
||||||
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
|
components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteract
|
||||||
import dev.kord.core.behavior.interaction.response.respond
|
import dev.kord.core.behavior.interaction.response.respond
|
||||||
import dev.kord.core.entity.Guild
|
import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.kord.rest.builder.message.modify.actionRow
|
import dev.kord.rest.builder.message.modify.actionRow
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
|
@ -43,14 +46,14 @@ class QueueButton : net.moonleay.botendo.buttons.Button("btn.music.queue") {
|
||||||
val player = link.player
|
val player = link.player
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not connected"
|
||||||
"Not connected",
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
"I'm not in a VC and therefore, I am not playing anything.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -58,14 +61,14 @@ class QueueButton : net.moonleay.botendo.buttons.Button("btn.music.queue") {
|
||||||
val track = player.playingTrack
|
val track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not playing"
|
||||||
"Not playing",
|
this.description = "I'm not playing anything currently"
|
||||||
"I'm not playing anything currently",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -79,18 +82,18 @@ class QueueButton : net.moonleay.botendo.buttons.Button("btn.music.queue") {
|
||||||
desc += tr.info.title + " - " + TimeUtil.getTimeFormatedShortend(tr.info.length) + " (" + tr.info.author + ")\n"
|
desc += tr.info.title + " - " + TimeUtil.getTimeFormatedShortend(tr.info.length) + " (" + tr.info.author + ")\n"
|
||||||
}
|
}
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "Queue"
|
||||||
"Queue",
|
this.description = desc
|
||||||
desc,
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
|
||||||
|
|
||||||
this.actionRow {
|
|
||||||
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
|
components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteract
|
||||||
import dev.kord.core.behavior.interaction.response.respond
|
import dev.kord.core.behavior.interaction.response.respond
|
||||||
import dev.kord.core.entity.Guild
|
import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.kord.rest.builder.message.modify.actionRow
|
import dev.kord.rest.builder.message.modify.actionRow
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
|
@ -43,14 +46,14 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
|
||||||
val voiceState = user.asMember(guildId).getVoiceStateOrNull()
|
val voiceState = user.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (voiceState == null) {
|
if (voiceState == null) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not connected to a VC"
|
||||||
"You are not connected to a VC",
|
this.description = "Please connect to a VC"
|
||||||
"Please connect to a VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -58,26 +61,26 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
|
||||||
val channelId = voiceState.channelId
|
val channelId = voiceState.channelId
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not connected"
|
||||||
"Not connected",
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
"I'm not in a VC and therefore, I am not playing anything.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not in my VC"
|
||||||
"You are not in my VC",
|
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||||
"We are not in the same VC and therefore, you cannot control the music",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -85,19 +88,19 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
|
||||||
val gts = MusicManager.getGuildTrackScheduler(guild, player)
|
val gts = MusicManager.getGuildTrackScheduler(guild, player)
|
||||||
gts.repeating = !gts.repeating
|
gts.repeating = !gts.repeating
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = if (gts.repeating) "Now Repeating" else "Now Continuing"
|
||||||
if (gts.repeating) "Now Repeating" else "Now Continuing",
|
this.description =
|
||||||
if (gts.repeating) "The current track will now loop" else "The next track will play when this song finishes",
|
if (gts.repeating) "The current track will now loop" else "The next track will play when this song finishes"
|
||||||
UserUtil.getCommandSrc(user)
|
this.footer {
|
||||||
)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
|
|
||||||
|
|
||||||
this.actionRow {
|
|
||||||
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
|
components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,9 @@ import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteract
|
||||||
import dev.kord.core.behavior.interaction.response.respond
|
import dev.kord.core.behavior.interaction.response.respond
|
||||||
import dev.kord.core.entity.Guild
|
import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.kord.rest.builder.message.modify.actionRow
|
import dev.kord.rest.builder.message.modify.actionRow
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
|
@ -42,14 +45,14 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
|
||||||
val voiceState = user.asMember(guildId).getVoiceStateOrNull()
|
val voiceState = user.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (voiceState == null) {
|
if (voiceState == null) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not connected to a VC"
|
||||||
"You are not connected to a VC",
|
this.description = "Please connect to a VC"
|
||||||
"Please connect to a VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -57,40 +60,40 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
|
||||||
val channelId = voiceState.channelId
|
val channelId = voiceState.channelId
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not connected"
|
||||||
"Not connected",
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
"I'm not in a VC and therefore, I am not playing anything.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not in my VC"
|
||||||
"You are not in my VC",
|
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||||
"We are not in the same VC and therefore, you cannot control the music",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var track = player.playingTrack
|
var track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not Playing"
|
||||||
"Not playing",
|
this.description = "I'm not playing anything currently"
|
||||||
"I'm not playing anything currently",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -99,20 +102,22 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
|
||||||
track = gts.getHead().toTrack()
|
track = gts.getHead().toTrack()
|
||||||
gts.playNext(link)
|
gts.playNext(link)
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbedWithImage(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "Skipped song; now playing"
|
||||||
"Skipped song; now playing",
|
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} :: ${
|
||||||
"**${track.title}**\n*Now Playing*\nby ${track.author} :: ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
track.length.inWholeMilliseconds
|
||||||
track.length.inWholeMilliseconds
|
)
|
||||||
)
|
}\n" +
|
||||||
}\n" +
|
">>>${track.uri}"
|
||||||
">>>${track.uri}",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user),
|
this.text = MessageUtil.getFooter(user)
|
||||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
}
|
||||||
)
|
this.thumbnail {
|
||||||
)
|
this.url = "https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow {
|
||||||
this.components.addAll(
|
this.components.addAll(
|
||||||
|
@ -128,17 +133,17 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
|
||||||
player.stopTrack()
|
player.stopTrack()
|
||||||
|
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "Skipped song"
|
||||||
"Skipped song; now playing",
|
this.description = "Nothing"
|
||||||
"Nothing",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
|
||||||
this.actionRow {
|
|
||||||
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
|
||||||
}
|
}
|
||||||
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
|
components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import dev.kord.core.behavior.interaction.response.DeferredPublicMessageInteract
|
||||||
import dev.kord.core.behavior.interaction.response.respond
|
import dev.kord.core.behavior.interaction.response.respond
|
||||||
import dev.kord.core.entity.Guild
|
import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
import net.moonleay.botendo.util.MessageUtil
|
import net.moonleay.botendo.util.MessageUtil
|
||||||
|
@ -41,14 +42,14 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
|
||||||
val voiceState = user.asMember(guildId).getVoiceStateOrNull()
|
val voiceState = user.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (voiceState == null) {
|
if (voiceState == null) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not connected to a VC"
|
||||||
"You are not connected to a VC",
|
this.description = "Please connect to a VC"
|
||||||
"Please connect to a VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -56,26 +57,26 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
|
||||||
val channelId = voiceState.channelId
|
val channelId = voiceState.channelId
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not connected"
|
||||||
"Not connected",
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
"I'm not in a VC and therefore, I am not playing anything.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not in my VC"
|
||||||
"You are not in my VC",
|
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||||
"We are not in the same VC and therefore, you cannot control the music",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -84,14 +85,14 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
|
||||||
link.destroy()
|
link.destroy()
|
||||||
MusicManager.getGuildTrackScheduler(guild.asGuild(), player).clear()
|
MusicManager.getGuildTrackScheduler(guild.asGuild(), player).clear()
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embeds = mutableListOf(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "I stopped and left"
|
||||||
"I stopped and left",
|
this.description = "just like your girlfriend"
|
||||||
"just like your girlfriend",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,11 @@ package net.moonleay.botendo.extensions.music
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.create.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import dev.schlaubi.lavakord.kord.getLink
|
import dev.schlaubi.lavakord.kord.getLink
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
|
@ -39,55 +41,66 @@ class NowPlayingExtension : Extension() {
|
||||||
val guildId = this.guild!!.id
|
val guildId = this.guild!!.id
|
||||||
val link = net.moonleay.botendo.Bot.lava.getLink(guildId)
|
val link = net.moonleay.botendo.Bot.lava.getLink(guildId)
|
||||||
val player = link.player
|
val player = link.player
|
||||||
|
val u = this.user
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
Color(0xE0A81A),
|
this.color = Color(0xE0311A)
|
||||||
"Not connected",
|
this.title = "Not connected"
|
||||||
"I'm not in a VC and therefore, I am not playing anything."
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val track = player.playingTrack
|
val track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
Color(0xE0A81A),
|
this.color = Color(0xE0311A)
|
||||||
"Not Playing",
|
this.title = "Not Playing"
|
||||||
"I'm not playing anything currently"
|
this.description = "I'm not playing anything currently"
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val gts = MusicManager.getGuildTrackScheduler(this.guild!!.asGuild(), player)
|
val gts = MusicManager.getGuildTrackScheduler(this.guild!!.asGuild(), player)
|
||||||
|
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbedWithImage(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "Currently playing"
|
||||||
"Currently playing",
|
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
||||||
"**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
player.position
|
||||||
player.position
|
)
|
||||||
)
|
}: ${
|
||||||
}: ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
track.length.inWholeMilliseconds
|
||||||
track.length.inWholeMilliseconds
|
)
|
||||||
)
|
}\n" +
|
||||||
}\n" +
|
">>>${track.uri}"
|
||||||
">>>${track.uri}",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user),
|
this.text = MessageUtil.getFooter(u)
|
||||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri.toString()) + "/maxresdefault.jpg"
|
}
|
||||||
)
|
this.thumbnail {
|
||||||
)
|
this.url = "https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri.toString()) + "/maxresdefault.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
this.components.addAll(
|
components.addAll(
|
||||||
ButtonUtil.getMusicControllerButtons(
|
ButtonUtil.getMusicControllerButtons(
|
||||||
player.paused,
|
player.paused,
|
||||||
gts.repeating
|
gts.repeating
|
||||||
).components
|
).components
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ package net.moonleay.botendo.extensions.music
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import dev.schlaubi.lavakord.kord.getLink
|
import dev.schlaubi.lavakord.kord.getLink
|
||||||
import net.moonleay.botendo.extensions.music.components.LinkArguments
|
import net.moonleay.botendo.extensions.music.components.LinkArguments
|
||||||
|
@ -46,14 +46,14 @@ class PlayExtension : Extension() {
|
||||||
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (vcsUser == null) {
|
if (vcsUser == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not connected to a VC"
|
||||||
"You are not connected to a VC",
|
this.description = "Please connect to a VC"
|
||||||
"Please connect to a VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -64,14 +64,14 @@ class PlayExtension : Extension() {
|
||||||
link.connectAudio(channelId!!.value)
|
link.connectAudio(channelId!!.value)
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not in my VC"
|
||||||
"You are not in my VC",
|
this.description = "We are not in the same VC and therefore, you cannot play any music"
|
||||||
"We are not in the same VC and therefore, you cannot play any music",
|
this.author {
|
||||||
UserUtil.getCommandSrc(u),
|
this.name = UserUtil.getCommandSrc(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -83,14 +83,14 @@ class PlayExtension : Extension() {
|
||||||
"ytsearch:$query"
|
"ytsearch:$query"
|
||||||
}
|
}
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0A81A)
|
||||||
Color(0xE0A81A),
|
this.title = "Searching..."
|
||||||
"Searching...",
|
this.description = "We are looking for $query"
|
||||||
"We are looking for $query",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
MusicManager.addToQueue(this, link, search)
|
MusicManager.addToQueue(this, link, search)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,11 @@ package net.moonleay.botendo.extensions.music
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.create.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
import net.moonleay.botendo.util.ButtonUtil
|
import net.moonleay.botendo.util.ButtonUtil
|
||||||
|
@ -41,23 +43,32 @@ class QueueExtension : Extension() {
|
||||||
val guildId = this.guild!!.id
|
val guildId = this.guild!!.id
|
||||||
val link = net.moonleay.botendo.Bot.lava.getLink(guildId.toString())
|
val link = net.moonleay.botendo.Bot.lava.getLink(guildId.toString())
|
||||||
val player = link.player
|
val player = link.player
|
||||||
|
val u = this.user
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
Color(0xE0311A),
|
this.color = Color(0xE0311A)
|
||||||
"Not connected",
|
this.title = "Not connected"
|
||||||
"I'm not in a VC and therefore, I am not playing anything."
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val track = player.playingTrack
|
val track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
Color(0xE0A81A),
|
this.color = Color(0xE0311A)
|
||||||
"Queue empty",
|
this.title = "Queue empty"
|
||||||
"I'm not playing anything currently"
|
this.description = "I'm not playing anything currently"
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val gts = MusicManager.getGuildTrackScheduler(this.guild!!.asGuild(), player)
|
val gts = MusicManager.getGuildTrackScheduler(this.guild!!.asGuild(), player)
|
||||||
|
@ -70,23 +81,23 @@ class QueueExtension : Extension() {
|
||||||
desc += tr.info.title + " - " + TimeUtil.getTimeFormatedShortend(tr.info.length) + " (" + tr.info.author + ")\n"
|
desc += tr.info.title + " - " + TimeUtil.getTimeFormatedShortend(tr.info.length) + " (" + tr.info.author + ")\n"
|
||||||
}
|
}
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "Queue"
|
||||||
"Queue",
|
this.description = desc
|
||||||
desc,
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
this.components.addAll(
|
components.addAll(
|
||||||
ButtonUtil.getMusicControllerButtons(
|
ButtonUtil.getMusicControllerButtons(
|
||||||
player.paused,
|
player.paused,
|
||||||
gts.repeating
|
gts.repeating
|
||||||
).components
|
).components
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,10 @@ package net.moonleay.botendo.extensions.music
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
import net.moonleay.botendo.extensions.music.components.SeekArguments
|
import net.moonleay.botendo.extensions.music.components.SeekArguments
|
||||||
|
@ -43,14 +44,14 @@ class SeekExtension : Extension() {
|
||||||
val voiceState = u.asMember(guildId).getVoiceStateOrNull()
|
val voiceState = u.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (voiceState == null) {
|
if (voiceState == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not connected to a VC"
|
||||||
"You are not connected to a VC",
|
this.description = "Please connect to a VC"
|
||||||
"Please connect to a VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -58,40 +59,40 @@ class SeekExtension : Extension() {
|
||||||
val channelId = voiceState.channelId
|
val channelId = voiceState.channelId
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not connected"
|
||||||
"Not connected",
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
"I'm not in a VC and therefore, I am not playing anything.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not in my VC"
|
||||||
"You are not in my VC",
|
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||||
"We are not in the same VC and therefore, you cannot control the music",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
var track = player.playingTrack
|
var track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not playing"
|
||||||
"Not playing",
|
this.description = "I'm not playing anything currently"
|
||||||
"I'm not playing anything currently",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u)
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -101,47 +102,50 @@ class SeekExtension : Extension() {
|
||||||
player.seekTo(targetPos)
|
player.seekTo(targetPos)
|
||||||
} else {
|
} else {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Invalid position"
|
||||||
"Invalid position",
|
this.description = "The position you specified is invalid"
|
||||||
"The position you specified is invalid",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbedWithImage(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "Jumped; now playing"
|
||||||
"Jumped; now playing",
|
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
||||||
"**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
player.position
|
||||||
player.position
|
)
|
||||||
)
|
}: ${
|
||||||
}: ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
track.length.inWholeMilliseconds
|
||||||
track.length.inWholeMilliseconds
|
)
|
||||||
)
|
}\n" +
|
||||||
}\n" +
|
">>>${track.uri}"
|
||||||
">>>${track.uri}",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user),
|
this.text = MessageUtil.getFooter(u)
|
||||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
}
|
||||||
)
|
this.thumbnail {
|
||||||
)
|
this.url = "https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
||||||
|
|
||||||
this.actionRow {
|
}
|
||||||
this.components.addAll(
|
}
|
||||||
|
|
||||||
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
|
components.addAll(
|
||||||
ButtonUtil.getMusicControllerButtons(
|
ButtonUtil.getMusicControllerButtons(
|
||||||
player.paused,
|
player.paused,
|
||||||
gts.repeating
|
gts.repeating
|
||||||
).components
|
).components
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,11 @@ package net.moonleay.botendo.extensions.music
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.create.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
import net.moonleay.botendo.util.*
|
import net.moonleay.botendo.util.*
|
||||||
|
@ -41,41 +43,57 @@ class SkipExtension : Extension() {
|
||||||
val u = this.user
|
val u = this.user
|
||||||
val voiceState = u.asMember(guildId).getVoiceStateOrNull()
|
val voiceState = u.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (voiceState == null) {
|
if (voiceState == null) {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
Color(0xE0311A),
|
this.color = Color(0xE0311A)
|
||||||
"You are not connected to a VC",
|
this.title = "You are not connected to a VC"
|
||||||
"Please connect to a VC"
|
this.description = "Please connect to a VC"
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
|
||||||
val channelId = voiceState.channelId
|
val channelId = voiceState.channelId
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
Color(0xE0311A),
|
this.color = Color(0xE0311A)
|
||||||
"Not connected",
|
this.title = "Not connected"
|
||||||
"I'm not in a VC and therefore, I am not playing anything."
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return@action
|
return@action
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
Color(0xE0311A),
|
this.color = Color(0xE0311A)
|
||||||
"You are not in my VC",
|
this.title = "You are not in my VC"
|
||||||
"We are not in the same VC and therefore, you cannot control the music"
|
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
var track = player.playingTrack
|
var track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
Color(0xE0311A),
|
this.color = Color(0xE0311A)
|
||||||
"Not playing",
|
this.title = "Not playing"
|
||||||
"I'm not playing anything currently"
|
this.description = "I'm not playing anything currently"
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val gts = MusicManager.getGuildTrackScheduler(this.guild!!.asGuild(), player)
|
val gts = MusicManager.getGuildTrackScheduler(this.guild!!.asGuild(), player)
|
||||||
|
@ -88,29 +106,31 @@ class SkipExtension : Extension() {
|
||||||
|
|
||||||
|
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbedWithImage(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "Skipped song; now playing"
|
||||||
"Skipped song; now playing",
|
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ;: ${
|
||||||
"**${track.title}**\n*Now Playing*\nby ${track.author} ;: ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
track.length.inWholeMilliseconds
|
||||||
track.length.inWholeMilliseconds
|
)
|
||||||
)
|
}\n" +
|
||||||
}\n" +
|
">>>${track.uri}"
|
||||||
">>>${track.uri}",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(user),
|
this.text = MessageUtil.getFooter(u)
|
||||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
}
|
||||||
)
|
this.thumbnail {
|
||||||
)
|
this.url = "https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
this.components.addAll(
|
components.addAll(
|
||||||
ButtonUtil.getMusicControllerButtons(
|
ButtonUtil.getMusicControllerButtons(
|
||||||
player.paused,
|
player.paused,
|
||||||
gts.repeating
|
gts.repeating
|
||||||
).components
|
).components
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ package net.moonleay.botendo.extensions.music
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import dev.schlaubi.lavakord.kord.getLink
|
import dev.schlaubi.lavakord.kord.getLink
|
||||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||||
|
@ -43,40 +43,40 @@ class StopExtension : Extension() {
|
||||||
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (vcsUser == null) {
|
if (vcsUser == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not connected to a VC"
|
||||||
"You are not connected to a VC",
|
this.description = "Please connect to a VC"
|
||||||
"Please connect to my VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val channelId = vcsUser.channelId
|
val channelId = vcsUser.channelId
|
||||||
if (link.state == Link.State.NOT_CONNECTED) {
|
if (link.state == Link.State.NOT_CONNECTED) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not connected"
|
||||||
"Not connected",
|
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||||
"I'm not in a VC and therefore, I am not playing anything.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not in my VC"
|
||||||
"You are not in my VC",
|
this.description = "We are not in the same VC"
|
||||||
"We are not in the same VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -84,14 +84,14 @@ class StopExtension : Extension() {
|
||||||
link.destroy()
|
link.destroy()
|
||||||
MusicManager.getGuildTrackScheduler(this.getGuild()!!.asGuild(), player).clear()
|
MusicManager.getGuildTrackScheduler(this.getGuild()!!.asGuild(), player).clear()
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "I stopped and left"
|
||||||
"I stopped and left",
|
this.description = "just like your girlfriend"
|
||||||
"just like your girlfriend",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ package net.moonleay.botendo.extensions.music
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import dev.schlaubi.lavakord.kord.getLink
|
import dev.schlaubi.lavakord.kord.getLink
|
||||||
import net.moonleay.botendo.extensions.music.components.LinkArguments
|
import net.moonleay.botendo.extensions.music.components.LinkArguments
|
||||||
|
@ -46,14 +46,14 @@ class UpsertExtension : Extension() {
|
||||||
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
||||||
if (vcsUser == null) {
|
if (vcsUser == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not connected to a VC"
|
||||||
"You are not connected to a VC",
|
this.description = "Please connect to a VC"
|
||||||
"Please connect to a VC",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -64,14 +64,14 @@ class UpsertExtension : Extension() {
|
||||||
link.connectAudio(channelId!!.value)
|
link.connectAudio(channelId!!.value)
|
||||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "You are not in my VC"
|
||||||
"You are not in my VC",
|
this.description = "We are not in the same VC and therefore, you cannot play any music"
|
||||||
"We are not in the same VC and therefore, you cannot play any music",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -83,14 +83,14 @@ class UpsertExtension : Extension() {
|
||||||
"ytsearch:$query"
|
"ytsearch:$query"
|
||||||
}
|
}
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0A81A)
|
||||||
Color(0xE0A81A),
|
this.title = "Searching..."
|
||||||
"Searching...",
|
this.description = "We are looking for $query"
|
||||||
"We are looking for $query",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
MusicManager.upsertIntoQueue(this, link, search)
|
MusicManager.upsertIntoQueue(this, link, search)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,13 @@ package net.moonleay.botendo.extensions.music.components
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext
|
import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext
|
||||||
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
|
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
import dev.kord.common.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import dev.kord.core.entity.Guild
|
import dev.kord.core.entity.Guild
|
||||||
|
import dev.kord.rest.builder.component.ActionRowBuilder
|
||||||
|
import dev.kord.rest.builder.message.actionRow
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.create.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import dev.schlaubi.lavakord.audio.Link
|
import dev.schlaubi.lavakord.audio.Link
|
||||||
import dev.schlaubi.lavakord.audio.player.Player
|
import dev.schlaubi.lavakord.audio.player.Player
|
||||||
import dev.schlaubi.lavakord.rest.loadItem
|
import dev.schlaubi.lavakord.rest.loadItem
|
||||||
|
@ -77,29 +79,32 @@ object MusicManager {
|
||||||
gts.queue(item.track, type)
|
gts.queue(item.track, type)
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbedWithImage(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "${type.s} track from link"
|
||||||
"${type.s} track from link",
|
this.description = "**${item.track.info.title}**\n*Queue*\nby ${item.track.info.author} ;: ${
|
||||||
"**${item.track.info.title}**\n*Queue*\nby ${item.track.info.author} ;: ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
item.track.info.length
|
||||||
item.track.info.length
|
)
|
||||||
)
|
}\n" +
|
||||||
}\n" +
|
">>>${item.track.info.uri}"
|
||||||
">>>${item.track.info.uri}",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.track.info.uri) + "/maxresdefault.jpg"
|
}
|
||||||
)
|
this.thumbnail {
|
||||||
)
|
this.url =
|
||||||
|
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.track.info.uri) + "/maxresdefault.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow(fun ActionRowBuilder.() {
|
||||||
this.components.addAll(
|
components.addAll(
|
||||||
ButtonUtil.getMusicControllerButtons(
|
ButtonUtil.getMusicControllerButtons(
|
||||||
player.paused,
|
player.paused,
|
||||||
gts.repeating
|
gts.repeating
|
||||||
).components
|
).components
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,19 +115,23 @@ object MusicManager {
|
||||||
}
|
}
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "${type.s} playlist from link"
|
||||||
"${type.s} playlist from link",
|
this.description = "**${item.tracks.first().info.title}**\n*${item.playlistInfo.name}*\nby ${item.tracks.first().info.author} ;: ${
|
||||||
"**${item.tracks.first().info.title}**\n*${item.playlistInfo.name}*\nby ${item.tracks.first().info.author} ;: ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
item.tracks.first().info.length
|
||||||
item.tracks.first().info.length
|
)
|
||||||
)
|
}\n" +
|
||||||
}\n" +
|
">>>${item.tracks.first().info.uri}"
|
||||||
">>>${item.tracks.first().info.uri}",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
this.thumbnail {
|
||||||
|
this.url =
|
||||||
|
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.tracks.first().info.uri) + "/maxresdefault.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow {
|
||||||
this.components.addAll(
|
this.components.addAll(
|
||||||
|
@ -139,20 +148,23 @@ object MusicManager {
|
||||||
gts.queue(item.tracks.first(), type)
|
gts.queue(item.tracks.first(), type)
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbedWithImage(
|
this.color = Color(0x52E01A)
|
||||||
Color(0x52E01A),
|
this.title = "${type.s} track from query"
|
||||||
"${type.s} track from query",
|
this.description = "**${item.tracks.first().info.title}**\n*Queue*\nby ${item.tracks.first().info.author} ;: ${
|
||||||
"**${item.tracks.first().info.title}**\n*Queue*\nby ${item.tracks.first().info.author} ;: ${
|
TimeUtil.getTimeFormatedRaw(
|
||||||
TimeUtil.getTimeFormatedRaw(
|
item.tracks.first().info.length
|
||||||
item.tracks.first().info.length
|
)
|
||||||
)
|
}\n" +
|
||||||
}\n" +
|
">>>${item.tracks.first().info.uri}"
|
||||||
">>>${item.tracks.first().info.uri}",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.tracks.first().info.uri) + "/maxresdefault.jpg"
|
}
|
||||||
)
|
this.thumbnail {
|
||||||
)
|
this.url =
|
||||||
|
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.tracks.first().info.uri) + "/maxresdefault.jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow {
|
||||||
this.components.addAll(
|
this.components.addAll(
|
||||||
|
@ -168,28 +180,28 @@ object MusicManager {
|
||||||
TrackResponse.LoadType.NO_MATCHES -> {
|
TrackResponse.LoadType.NO_MATCHES -> {
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Not found"
|
||||||
"Not found",
|
this.description = "There were no matches."
|
||||||
"There were no matches.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackResponse.LoadType.LOAD_FAILED -> {
|
TrackResponse.LoadType.LOAD_FAILED -> {
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = Color(0xE0311A)
|
||||||
Color(0xE0311A),
|
this.title = "Load failed"
|
||||||
"Load failed",
|
this.description = "There was an error while loading."
|
||||||
"There was an error while loading.",
|
this.footer {
|
||||||
UserUtil.getCommandSrc(u),
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ package net.moonleay.botendo.extensions.util
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.botendo.util.MessageUtil
|
import net.moonleay.botendo.util.MessageUtil
|
||||||
|
|
||||||
class InfoExtension : Extension() {
|
class InfoExtension : Extension() {
|
||||||
|
@ -31,17 +32,23 @@ class InfoExtension : Extension() {
|
||||||
name = "info"
|
name = "info"
|
||||||
description = "Show infos about the bot"
|
description = "Show infos about the bot"
|
||||||
this.action {
|
this.action {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
val u = this.user
|
||||||
this,
|
this.respond {
|
||||||
Color(0x52E01A), "Botendo",
|
this.embed {
|
||||||
"Botendo ***v." + net.moonleay.botendo.build.BuildConstants.version + "***\n" +
|
this.color = Color(0x52E01A)
|
||||||
|
this.title = "Botendo"
|
||||||
|
this.description = "Botendo ***v." + net.moonleay.botendo.build.BuildConstants.version + "***\n" +
|
||||||
"Kord-Extensions ***v." + net.moonleay.botendo.build.BuildConstants.kordVersion + "***\n" +
|
"Kord-Extensions ***v." + net.moonleay.botendo.build.BuildConstants.kordVersion + "***\n" +
|
||||||
"lavalink.kt ***v." + net.moonleay.botendo.build.BuildConstants.lavaVersion + "***\n" +
|
"lavalink.kt ***v." + net.moonleay.botendo.build.BuildConstants.lavaVersion + "***\n" +
|
||||||
"Coroutines ***v." + net.moonleay.botendo.build.BuildConstants.coroutinesVersion + "***\n\n\n" +
|
"Coroutines ***v." + net.moonleay.botendo.build.BuildConstants.coroutinesVersion + "***\n\n\n" +
|
||||||
"***Bot made by moonleay***\n" +
|
"***Bot made by moonleay***\n" +
|
||||||
"(c) 2023, licensed under GPL-3.0\n" +
|
"(c) 2023, licensed under GPL-3.0\n" +
|
||||||
"More infos: https://moonleay.net/projects/botendo\n"
|
"More infos: https://moonleay.net/projects/botendo\n"
|
||||||
)
|
this.footer {
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ package net.moonleay.botendo.util
|
||||||
import com.kotlindiscord.kord.extensions.commands.Arguments
|
import com.kotlindiscord.kord.extensions.commands.Arguments
|
||||||
import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext
|
import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext
|
||||||
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
|
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.common.Color
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.core.behavior.UserBehavior
|
||||||
import dev.kord.rest.builder.message.EmbedBuilder
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
|
@ -31,74 +31,8 @@ import java.time.format.DateTimeFormatter
|
||||||
object MessageUtil {
|
object MessageUtil {
|
||||||
private val dtf: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy @ HH:mm:ss")
|
private val dtf: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy @ HH:mm:ss")
|
||||||
|
|
||||||
///Send an embedded message as a reply
|
suspend fun getFooter(u: UserBehavior? = null): String{
|
||||||
suspend fun sendEmbedForPublicSlashCommand(
|
|
||||||
ctx: PublicSlashCommandContext<Arguments, ModalForm>,
|
|
||||||
color: Color,
|
|
||||||
title: String,
|
|
||||||
description: String
|
|
||||||
) {
|
|
||||||
ctx.respond {
|
|
||||||
embeds.add(
|
|
||||||
getEmbed(
|
|
||||||
color,
|
|
||||||
title,
|
|
||||||
description,
|
|
||||||
UserUtil.getCommandSrc(ctx.user)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///Send an embedded message with an image as a reply
|
|
||||||
suspend fun sendEmbedForPublicSlashCommandWithImage(
|
|
||||||
ctx: PublicSlashCommandContext<Arguments, ModalForm>,
|
|
||||||
color: Color,
|
|
||||||
title: String,
|
|
||||||
description: String,
|
|
||||||
thumbnailUrl: String
|
|
||||||
) {
|
|
||||||
ctx.respond {
|
|
||||||
embeds.add(
|
|
||||||
getEmbedWithImage(
|
|
||||||
color,
|
|
||||||
title,
|
|
||||||
description,
|
|
||||||
UserUtil.getCommandSrc(ctx.user),
|
|
||||||
thumbnailUrl
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///Get an embedded msg with title, description and a src
|
|
||||||
fun getEmbed(
|
|
||||||
color: Color,
|
|
||||||
title: String,
|
|
||||||
description: String,
|
|
||||||
source: String
|
|
||||||
): EmbedBuilder {
|
|
||||||
val now: LocalDateTime = LocalDateTime.now()
|
val now: LocalDateTime = LocalDateTime.now()
|
||||||
val ebb = EmbedBuilder()
|
return ">" + dtf.format(now) + " - ${u?.asUser()?.username?:"Automatic Message"}"
|
||||||
ebb.title = title
|
|
||||||
ebb.description = description
|
|
||||||
ebb.footer = EmbedBuilder.Footer()
|
|
||||||
ebb.footer!!.text = ">" + dtf.format(now) + " - $source"
|
|
||||||
ebb.color = color
|
|
||||||
return ebb
|
|
||||||
}
|
|
||||||
|
|
||||||
///Get an embedded msg with image, title, description and a src
|
|
||||||
fun getEmbedWithImage(
|
|
||||||
color: Color,
|
|
||||||
title: String,
|
|
||||||
description: String,
|
|
||||||
source: String,
|
|
||||||
thumbnailUrl: String
|
|
||||||
): EmbedBuilder {
|
|
||||||
val ebb = getEmbed(color, title, description, source)
|
|
||||||
ebb.thumbnail = EmbedBuilder.Thumbnail()
|
|
||||||
ebb.thumbnail!!.url = thumbnailUrl
|
|
||||||
return ebb
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,6 @@ import dev.kord.core.behavior.UserBehavior
|
||||||
|
|
||||||
object UserUtil {
|
object UserUtil {
|
||||||
suspend fun getCommandSrc(u: UserBehavior): String {
|
suspend fun getCommandSrc(u: UserBehavior): String {
|
||||||
return "${u.asUser().username}${getUserDiscriminator(u)}"
|
return "${u.asUser().username}}"
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun getUserDiscriminator(u: UserBehavior): String {
|
|
||||||
if (u.asUser().discriminator == "0")
|
|
||||||
return ""
|
|
||||||
return "#${u.asUser().discriminator}"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue