Compare commits
No commits in common. "589997c29ef99f5f6efb48d8fba4b27ce53ef402" and "3a9795794c9b05b87b6a787b3fe801c05d5e6dc8" have entirely different histories.
589997c29e
...
3a9795794c
20 changed files with 596 additions and 606 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,7 +1,5 @@
|
||||||
### CUSTOM ###
|
### CUSTOM ###
|
||||||
/run/
|
/run/
|
||||||
/data/
|
|
||||||
data/
|
|
||||||
/.idea/
|
/.idea/
|
||||||
|
|
||||||
|
|
||||||
|
|
14
README.md
14
README.md
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
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)
|
||||||
|
@ -12,9 +16,9 @@ A Discord music bot, written in Kotlin using the kord library.
|
||||||
|
|
||||||
- HopeBaron for helping me a lot
|
- HopeBaron for helping me a lot
|
||||||
|
|
||||||
## Issues
|
## Known issues
|
||||||
|
|
||||||
- Report issues to issues@moonleay.net or message @moonleay on Discord
|
- None (currently). Open an issue, report issues to issues@moonleay.net or message moonleay#0001 on Discord
|
||||||
|
|
||||||
## Commands & Features
|
## Commands & Features
|
||||||
|
|
||||||
|
@ -59,3 +63,9 @@ 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.7.1-SNAPSHOT"
|
val kordver = "1.5.6"
|
||||||
val lavaver = "4.0.0"
|
val lavaver = "4.0.0"
|
||||||
val coroutinesver = "1.1.0"
|
val coroutinesver = "1.1.0"
|
||||||
|
|
||||||
|
@ -70,14 +70,6 @@ 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,7 +24,6 @@ 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
|
||||||
|
@ -92,14 +91,14 @@ object Bot {
|
||||||
return@on
|
return@on
|
||||||
}
|
}
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Error"
|
Color(0xE0311A),
|
||||||
this.description = "Could not find button with id \"${inter.componentId}\".\nPlease report this."
|
"Error",
|
||||||
this.footer {
|
"Could not find button with id \"${inter.componentId}\".\nPlease report this.",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,6 @@ 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
|
||||||
|
@ -46,14 +43,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not connected to a VC"
|
Color(0xE0311A),
|
||||||
this.description = "Please connect to a VC"
|
"You are not connected to a VC",
|
||||||
this.footer {
|
"Please connect to a VC",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -61,26 +58,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not connected"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
"Not connected",
|
||||||
this.footer {
|
"I'm not in a VC and therefore, I am not playing anything.",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not in my VC"
|
Color(0xE0311A),
|
||||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
"You are not in my VC",
|
||||||
this.footer {
|
"We are not in the same VC and therefore, you cannot control the music",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -89,18 +86,19 @@ 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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbed(
|
||||||
this.title = if (player.paused) "I paused" else "I'm continuing"
|
Color(0x52E01A),
|
||||||
this.description = if (player.paused) "I paused the song" else "I'm continuing to play the song."
|
if (player.paused) "I paused" else "I'm continuing",
|
||||||
this.footer {
|
if (player.paused) "I paused the song" else "I'm continuing to play the song.",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
|
|
||||||
this.actionRow(fun ActionRowBuilder.() {
|
|
||||||
components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
this.actionRow {
|
||||||
})
|
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,6 @@ 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
|
||||||
|
@ -46,14 +43,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not connected"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
"Not connected",
|
||||||
this.footer {
|
"I'm not in a VC and therefore, I am not playing anything.",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -61,14 +58,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not playing"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not playing anything currently"
|
"Not playing",
|
||||||
this.footer {
|
"I'm not playing anything currently",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -82,18 +79,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Queue"
|
Color(0x52E01A),
|
||||||
this.description = desc
|
"Queue",
|
||||||
this.footer {
|
desc,
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
|
|
||||||
this.actionRow(fun ActionRowBuilder.() {
|
this.actionRow {
|
||||||
components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,6 @@ 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
|
||||||
|
@ -46,14 +43,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not connected to a VC"
|
Color(0xE0311A),
|
||||||
this.description = "Please connect to a VC"
|
"You are not connected to a VC",
|
||||||
this.footer {
|
"Please connect to a VC",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -61,26 +58,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not connected"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
"Not connected",
|
||||||
this.footer {
|
"I'm not in a VC and therefore, I am not playing anything.",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not in my VC"
|
Color(0xE0311A),
|
||||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
"You are not in my VC",
|
||||||
this.footer {
|
"We are not in the same VC and therefore, you cannot control the music",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -88,19 +85,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbed(
|
||||||
this.title = if (gts.repeating) "Now Repeating" else "Now Continuing"
|
Color(0x52E01A),
|
||||||
this.description =
|
if (gts.repeating) "Now Repeating" else "Now Continuing",
|
||||||
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",
|
||||||
this.footer {
|
UserUtil.getCommandSrc(user)
|
||||||
this.text = MessageUtil.getFooter(user)
|
)
|
||||||
}
|
)
|
||||||
}
|
|
||||||
|
|
||||||
this.actionRow(fun ActionRowBuilder.() {
|
|
||||||
components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
this.actionRow {
|
||||||
})
|
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,6 @@ 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
|
||||||
|
@ -45,14 +42,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not connected to a VC"
|
Color(0xE0311A),
|
||||||
this.description = "Please connect to a VC"
|
"You are not connected to a VC",
|
||||||
this.footer {
|
"Please connect to a VC",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -60,40 +57,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not connected"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
"Not connected",
|
||||||
this.footer {
|
"I'm not in a VC and therefore, I am not playing anything.",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not in my VC"
|
Color(0xE0311A),
|
||||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
"You are not in my VC",
|
||||||
this.footer {
|
"We are not in the same VC and therefore, you cannot control the music",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var track = player.playingTrack
|
var track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not Playing"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not playing anything currently"
|
"Not playing",
|
||||||
this.footer {
|
"I'm not playing anything currently",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -102,22 +99,20 @@ 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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbedWithImage(
|
||||||
this.title = "Skipped song; now playing"
|
Color(0x52E01A),
|
||||||
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} :: ${
|
"Skipped song; now playing",
|
||||||
|
"**${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(
|
||||||
|
@ -133,17 +128,17 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
|
||||||
player.stopTrack()
|
player.stopTrack()
|
||||||
|
|
||||||
response.respond {
|
response.respond {
|
||||||
this.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Skipped song"
|
Color(0x52E01A),
|
||||||
this.description = "Nothing"
|
"Skipped song; now playing",
|
||||||
this.footer {
|
"Nothing",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
this.actionRow(fun ActionRowBuilder.() {
|
this.actionRow {
|
||||||
components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ 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
|
||||||
|
@ -42,14 +41,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not connected to a VC"
|
Color(0xE0311A),
|
||||||
this.description = "Please connect to a VC"
|
"You are not connected to a VC",
|
||||||
this.footer {
|
"Please connect to a VC",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -57,26 +56,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not connected"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
"Not connected",
|
||||||
this.footer {
|
"I'm not in a VC and therefore, I am not playing anything.",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not in my VC"
|
Color(0xE0311A),
|
||||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
"You are not in my VC",
|
||||||
this.footer {
|
"We are not in the same VC and therefore, you cannot control the music",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -85,14 +84,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.embed {
|
this.embeds = mutableListOf(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "I stopped and left"
|
Color(0x52E01A),
|
||||||
this.description = "just like your girlfriend"
|
"I stopped and left",
|
||||||
this.footer {
|
"just like your girlfriend",
|
||||||
this.text = MessageUtil.getFooter(user)
|
UserUtil.getCommandSrc(user)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,9 @@ 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
|
||||||
|
@ -41,41 +39,33 @@ 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) {
|
||||||
this.respond {
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.embed {
|
this,
|
||||||
this.color = Color(0xE0311A)
|
Color(0xE0A81A),
|
||||||
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 {
|
)
|
||||||
this.text = MessageUtil.getFooter(u)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val track = player.playingTrack
|
val track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
this.respond {
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.embed {
|
this,
|
||||||
this.color = Color(0xE0311A)
|
Color(0xE0A81A),
|
||||||
this.title = "Not Playing"
|
"Not Playing",
|
||||||
this.description = "I'm not playing anything currently"
|
"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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbedWithImage(
|
||||||
this.title = "Currently playing"
|
Color(0x52E01A),
|
||||||
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
"Currently playing",
|
||||||
|
"**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
||||||
TimeUtil.getTimeFormatedRaw(
|
TimeUtil.getTimeFormatedRaw(
|
||||||
player.position
|
player.position
|
||||||
)
|
)
|
||||||
|
@ -84,23 +74,20 @@ class NowPlayingExtension : Extension() {
|
||||||
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(fun ActionRowBuilder.() {
|
this.actionRow {
|
||||||
components.addAll(
|
this.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 {
|
||||||
this.embed {
|
embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not connected to a VC"
|
Color(0xE0311A),
|
||||||
this.description = "Please connect to a VC"
|
"You are not connected to a VC",
|
||||||
this.footer {
|
"Please connect to a VC",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(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 {
|
||||||
this.embed {
|
embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not in my VC"
|
Color(0xE0311A),
|
||||||
this.description = "We are not in the same VC and therefore, you cannot play any music"
|
"You are not in my VC",
|
||||||
this.author {
|
"We are not in the same VC and therefore, you cannot play any music",
|
||||||
this.name = UserUtil.getCommandSrc(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -83,14 +83,14 @@ class PlayExtension : Extension() {
|
||||||
"ytsearch:$query"
|
"ytsearch:$query"
|
||||||
}
|
}
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embed {
|
embeds.add(
|
||||||
this.color = Color(0xE0A81A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Searching..."
|
Color(0xE0A81A),
|
||||||
this.description = "We are looking for $query"
|
"Searching...",
|
||||||
this.footer {
|
"We are looking for $query",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
MusicManager.addToQueue(this, link, search)
|
MusicManager.addToQueue(this, link, search)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,11 +21,9 @@ 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
|
||||||
|
@ -43,32 +41,23 @@ 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) {
|
||||||
this.respond {
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.embed {
|
this,
|
||||||
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 {
|
)
|
||||||
this.text = MessageUtil.getFooter(u)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val track = player.playingTrack
|
val track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
this.respond {
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.embed {
|
this,
|
||||||
this.color = Color(0xE0311A)
|
Color(0xE0A81A),
|
||||||
this.title = "Queue empty"
|
"Queue empty",
|
||||||
this.description = "I'm not playing anything currently"
|
"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)
|
||||||
|
@ -81,23 +70,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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Queue"
|
Color(0x52E01A),
|
||||||
this.description = desc
|
"Queue",
|
||||||
this.footer {
|
desc,
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(user),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
|
|
||||||
this.actionRow(fun ActionRowBuilder.() {
|
this.actionRow {
|
||||||
components.addAll(
|
this.components.addAll(
|
||||||
ButtonUtil.getMusicControllerButtons(
|
ButtonUtil.getMusicControllerButtons(
|
||||||
player.paused,
|
player.paused,
|
||||||
gts.repeating
|
gts.repeating
|
||||||
).components
|
).components
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,9 @@ 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.create.actionRow
|
||||||
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
|
||||||
|
@ -44,14 +43,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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not connected to a VC"
|
Color(0xE0311A),
|
||||||
this.description = "Please connect to a VC"
|
"You are not connected to a VC",
|
||||||
this.footer {
|
"Please connect to a VC",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -59,40 +58,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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not connected"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
"Not connected",
|
||||||
this.footer {
|
"I'm not in a VC and therefore, I am not playing anything.",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not in my VC"
|
Color(0xE0311A),
|
||||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
"You are not in my VC",
|
||||||
this.footer {
|
"We are not in the same VC and therefore, you cannot control the music",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
var track = player.playingTrack
|
var track = player.playingTrack
|
||||||
if (track == null) {
|
if (track == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not playing"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not playing anything currently"
|
"Not playing",
|
||||||
this.footer {
|
"I'm not playing anything currently",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u)
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -102,24 +101,25 @@ class SeekExtension : Extension() {
|
||||||
player.seekTo(targetPos)
|
player.seekTo(targetPos)
|
||||||
} else {
|
} else {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Invalid position"
|
Color(0xE0311A),
|
||||||
this.description = "The position you specified is invalid"
|
"Invalid position",
|
||||||
this.footer {
|
"The position you specified is invalid",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbedWithImage(
|
||||||
this.title = "Jumped; now playing"
|
Color(0x52E01A),
|
||||||
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
"Jumped; now playing",
|
||||||
|
"**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
||||||
TimeUtil.getTimeFormatedRaw(
|
TimeUtil.getTimeFormatedRaw(
|
||||||
player.position
|
player.position
|
||||||
)
|
)
|
||||||
|
@ -128,24 +128,20 @@ class SeekExtension : Extension() {
|
||||||
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,11 +21,9 @@ 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.*
|
||||||
|
@ -43,57 +41,41 @@ 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) {
|
||||||
this.respond {
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.embed {
|
this,
|
||||||
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 {
|
)
|
||||||
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) {
|
||||||
this.respond {
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.embed {
|
this,
|
||||||
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 {
|
)
|
||||||
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 {
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.embed {
|
this,
|
||||||
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 {
|
)
|
||||||
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 {
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.embed {
|
this,
|
||||||
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 {
|
)
|
||||||
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)
|
||||||
|
@ -106,31 +88,29 @@ class SkipExtension : Extension() {
|
||||||
|
|
||||||
|
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbedWithImage(
|
||||||
this.title = "Skipped song; now playing"
|
Color(0x52E01A),
|
||||||
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ;: ${
|
"Skipped song; now playing",
|
||||||
|
"**${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(fun ActionRowBuilder.() {
|
this.actionRow {
|
||||||
components.addAll(
|
this.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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not connected to a VC"
|
Color(0xE0311A),
|
||||||
this.description = "Please connect to a VC"
|
"You are not connected to a VC",
|
||||||
this.footer {
|
"Please connect to my VC",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not connected"
|
Color(0xE0311A),
|
||||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
"Not connected",
|
||||||
this.footer {
|
"I'm not in a VC and therefore, I am not playing anything.",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not in my VC"
|
Color(0xE0311A),
|
||||||
this.description = "We are not in the same VC"
|
"You are not in my VC",
|
||||||
this.footer {
|
"We are not in the same VC",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(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.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "I stopped and left"
|
Color(0x52E01A),
|
||||||
this.description = "just like your girlfriend"
|
"I stopped and left",
|
||||||
this.footer {
|
"just like your girlfriend",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(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 {
|
||||||
this.embed {
|
embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not connected to a VC"
|
Color(0xE0311A),
|
||||||
this.description = "Please connect to a VC"
|
"You are not connected to a VC",
|
||||||
this.footer {
|
"Please connect to a VC",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(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 {
|
||||||
this.embed {
|
embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "You are not in my VC"
|
Color(0xE0311A),
|
||||||
this.description = "We are not in the same VC and therefore, you cannot play any music"
|
"You are not in my VC",
|
||||||
this.footer {
|
"We are not in the same VC and therefore, you cannot play any music",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -83,14 +83,14 @@ class UpsertExtension : Extension() {
|
||||||
"ytsearch:$query"
|
"ytsearch:$query"
|
||||||
}
|
}
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embed {
|
embeds.add(
|
||||||
this.color = Color(0xE0A81A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Searching..."
|
Color(0xE0A81A),
|
||||||
this.description = "We are looking for $query"
|
"Searching...",
|
||||||
this.footer {
|
"We are looking for $query",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
MusicManager.upsertIntoQueue(this, link, search)
|
MusicManager.upsertIntoQueue(this, link, search)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,11 @@ 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
|
||||||
|
@ -79,32 +77,29 @@ object MusicManager {
|
||||||
gts.queue(item.track, type)
|
gts.queue(item.track, type)
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbedWithImage(
|
||||||
this.title = "${type.s} track from link"
|
Color(0x52E01A),
|
||||||
this.description = "**${item.track.info.title}**\n*Queue*\nby ${item.track.info.author} ;: ${
|
"${type.s} track from link",
|
||||||
|
"**${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)
|
|
||||||
}
|
|
||||||
this.thumbnail {
|
|
||||||
this.url =
|
|
||||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.track.info.uri) + "/maxresdefault.jpg"
|
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.track.info.uri) + "/maxresdefault.jpg"
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
|
|
||||||
this.actionRow(fun ActionRowBuilder.() {
|
this.actionRow {
|
||||||
components.addAll(
|
this.components.addAll(
|
||||||
ButtonUtil.getMusicControllerButtons(
|
ButtonUtil.getMusicControllerButtons(
|
||||||
player.paused,
|
player.paused,
|
||||||
gts.repeating
|
gts.repeating
|
||||||
).components
|
).components
|
||||||
)
|
)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,23 +110,19 @@ object MusicManager {
|
||||||
}
|
}
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "${type.s} playlist from link"
|
Color(0x52E01A),
|
||||||
this.description = "**${item.tracks.first().info.title}**\n*${item.playlistInfo.name}*\nby ${item.tracks.first().info.author} ;: ${
|
"${type.s} playlist from link",
|
||||||
|
"**${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(
|
||||||
|
@ -148,23 +139,20 @@ object MusicManager {
|
||||||
gts.queue(item.tracks.first(), type)
|
gts.queue(item.tracks.first(), type)
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0x52E01A)
|
MessageUtil.getEmbedWithImage(
|
||||||
this.title = "${type.s} track from query"
|
Color(0x52E01A),
|
||||||
this.description = "**${item.tracks.first().info.title}**\n*Queue*\nby ${item.tracks.first().info.author} ;: ${
|
"${type.s} track from query",
|
||||||
|
"**${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)
|
|
||||||
}
|
|
||||||
this.thumbnail {
|
|
||||||
this.url =
|
|
||||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.tracks.first().info.uri) + "/maxresdefault.jpg"
|
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.tracks.first().info.uri) + "/maxresdefault.jpg"
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow {
|
||||||
this.components.addAll(
|
this.components.addAll(
|
||||||
|
@ -180,28 +168,28 @@ object MusicManager {
|
||||||
TrackResponse.LoadType.NO_MATCHES -> {
|
TrackResponse.LoadType.NO_MATCHES -> {
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Not found"
|
Color(0xE0311A),
|
||||||
this.description = "There were no matches."
|
"Not found",
|
||||||
this.footer {
|
"There were no matches.",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackResponse.LoadType.LOAD_FAILED -> {
|
TrackResponse.LoadType.LOAD_FAILED -> {
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ctx.respond {
|
ctx.respond {
|
||||||
this.embed {
|
this.embeds.add(
|
||||||
this.color = Color(0xE0311A)
|
MessageUtil.getEmbed(
|
||||||
this.title = "Load failed"
|
Color(0xE0311A),
|
||||||
this.description = "There was an error while loading."
|
"Load failed",
|
||||||
this.footer {
|
"There was an error while loading.",
|
||||||
this.text = MessageUtil.getFooter(u)
|
UserUtil.getCommandSrc(u),
|
||||||
}
|
)
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ 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() {
|
||||||
|
@ -32,23 +31,17 @@ class InfoExtension : Extension() {
|
||||||
name = "info"
|
name = "info"
|
||||||
description = "Show infos about the bot"
|
description = "Show infos about the bot"
|
||||||
this.action {
|
this.action {
|
||||||
val u = this.user
|
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||||
this.respond {
|
this,
|
||||||
this.embed {
|
Color(0x52E01A), "Botendo",
|
||||||
this.color = Color(0x52E01A)
|
"Botendo ***v." + net.moonleay.botendo.build.BuildConstants.version + "***\n" +
|
||||||
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,8 +31,74 @@ 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")
|
||||||
|
|
||||||
suspend fun getFooter(u: UserBehavior? = null): String{
|
///Send an embedded message as a reply
|
||||||
|
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()
|
||||||
return ">" + dtf.format(now) + " - ${u?.asUser()?.username?:"Automatic Message"}"
|
val ebb = EmbedBuilder()
|
||||||
|
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,6 +23,12 @@ 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}}"
|
return "${u.asUser().username}${getUserDiscriminator(u)}"
|
||||||
|
}
|
||||||
|
|
||||||
|
private suspend fun getUserDiscriminator(u: UserBehavior): String {
|
||||||
|
if (u.asUser().discriminator == "0")
|
||||||
|
return ""
|
||||||
|
return "#${u.asUser().discriminator}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue