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 ###
|
||||
/run/
|
||||
/data/
|
||||
data/
|
||||
/.idea/
|
||||
|
||||
|
||||
|
|
14
README.md
14
README.md
|
@ -4,10 +4,6 @@
|
|||
|
||||
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
|
||||
|
||||
[![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
|
||||
|
||||
## 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
|
||||
|
||||
|
@ -63,9 +59,3 @@ A Discord music bot, written in Kotlin using the kord library.
|
|||
|
||||
Install IntellJ and import the project from git.
|
||||
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" }
|
||||
?: "6.5.1"
|
||||
|
||||
val kordver = "1.5.6"
|
||||
val kordver = "1.7.1-SNAPSHOT"
|
||||
val lavaver = "4.0.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
|
||||
|
|
|
@ -24,6 +24,7 @@ import dev.kord.common.Color
|
|||
import dev.kord.core.behavior.interaction.response.respond
|
||||
import dev.kord.core.event.interaction.ButtonInteractionCreateEvent
|
||||
import dev.kord.core.on
|
||||
import dev.kord.rest.builder.message.embed
|
||||
import dev.schlaubi.lavakord.LavaKord
|
||||
import dev.schlaubi.lavakord.kord.lavakord
|
||||
import net.moonleay.botendo.data.CredentialManager
|
||||
|
@ -91,14 +92,14 @@ object Bot {
|
|||
return@on
|
||||
}
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Error",
|
||||
"Could not find button with id \"${inter.componentId}\".\nPlease report this.",
|
||||
UserUtil.getCommandSrc(u)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Error"
|
||||
this.description = "Could not find button with id \"${inter.componentId}\".\nPlease report this."
|
||||
this.footer {
|
||||
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.entity.Guild
|
||||
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.schlaubi.lavakord.audio.Link
|
||||
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()
|
||||
if (voiceState == null) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to a VC",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -58,26 +61,26 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
|
|||
val channelId = voiceState.channelId
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything.",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC and therefore, you cannot control the music",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -86,19 +89,18 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
|
|||
|
||||
val gts = MusicManager.getGuildTrackScheduler(guild, player)
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
if (player.paused) "I paused" else "I'm continuing",
|
||||
if (player.paused) "I paused the song" else "I'm continuing to play the song.",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
this.actionRow {
|
||||
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = 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."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
|
||||
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.entity.Guild
|
||||
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.schlaubi.lavakord.audio.Link
|
||||
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
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything.",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -58,14 +61,14 @@ class QueueButton : net.moonleay.botendo.buttons.Button("btn.music.queue") {
|
|||
val track = player.playingTrack
|
||||
if (track == null) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not playing",
|
||||
"I'm not playing anything currently",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not playing"
|
||||
this.description = "I'm not playing anything currently"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
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"
|
||||
}
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
"Queue",
|
||||
desc,
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
|
||||
this.actionRow {
|
||||
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "Queue"
|
||||
this.description = desc
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
|
||||
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.entity.Guild
|
||||
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.schlaubi.lavakord.audio.Link
|
||||
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()
|
||||
if (voiceState == null) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to a VC",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -58,26 +61,26 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
|
|||
val channelId = voiceState.channelId
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything.",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC and therefore, you cannot control the music",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -85,19 +88,19 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
|
|||
val gts = MusicManager.getGuildTrackScheduler(guild, player)
|
||||
gts.repeating = !gts.repeating
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
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",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
this.actionRow {
|
||||
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = 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"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
|
||||
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.entity.Guild
|
||||
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.schlaubi.lavakord.audio.Link
|
||||
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()
|
||||
if (voiceState == null) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to a VC",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -57,40 +60,40 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
|
|||
val channelId = voiceState.channelId
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything.",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC and therefore, you cannot control the music",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
var track = player.playingTrack
|
||||
if (track == null) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not playing",
|
||||
"I'm not playing anything currently",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not Playing"
|
||||
this.description = "I'm not playing anything currently"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -99,20 +102,22 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
|
|||
track = gts.getHead().toTrack()
|
||||
gts.playNext(link)
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbedWithImage(
|
||||
Color(0x52E01A),
|
||||
"Skipped song; now playing",
|
||||
"**${track.title}**\n*Now Playing*\nby ${track.author} :: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
track.length.inWholeMilliseconds
|
||||
)
|
||||
}\n" +
|
||||
">>>${track.uri}",
|
||||
UserUtil.getCommandSrc(user),
|
||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "Skipped song; now playing"
|
||||
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} :: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
track.length.inWholeMilliseconds
|
||||
)
|
||||
}\n" +
|
||||
">>>${track.uri}"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
this.thumbnail {
|
||||
this.url = "https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
||||
}
|
||||
}
|
||||
|
||||
this.actionRow {
|
||||
this.components.addAll(
|
||||
|
@ -128,17 +133,17 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
|
|||
player.stopTrack()
|
||||
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
"Skipped song; now playing",
|
||||
"Nothing",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.actionRow {
|
||||
this.components.addAll(ButtonUtil.getMusicControllerButtons(player.paused, gts.repeating).components)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "Skipped song"
|
||||
this.description = "Nothing"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
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.entity.Guild
|
||||
import dev.kord.core.entity.User
|
||||
import dev.kord.rest.builder.message.embed
|
||||
import dev.schlaubi.lavakord.audio.Link
|
||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||
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()
|
||||
if (voiceState == null) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to a VC",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -56,26 +57,26 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
|
|||
val channelId = voiceState.channelId
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything.",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC and therefore, you cannot control the music",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
this.description = "We are not in the same VC and therefore, you cannot control the music"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(user)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -84,14 +85,14 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
|
|||
link.destroy()
|
||||
MusicManager.getGuildTrackScheduler(guild.asGuild(), player).clear()
|
||||
response.respond {
|
||||
this.embeds = mutableListOf(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
"I stopped and left",
|
||||
"just like your girlfriend",
|
||||
UserUtil.getCommandSrc(user)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "I stopped and left"
|
||||
this.description = "just like your girlfriend"
|
||||
this.footer {
|
||||
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.publicSlashCommand
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
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.embed
|
||||
import dev.schlaubi.lavakord.audio.Link
|
||||
import dev.schlaubi.lavakord.kord.getLink
|
||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||
|
@ -39,55 +41,66 @@ class NowPlayingExtension : Extension() {
|
|||
val guildId = this.guild!!.id
|
||||
val link = net.moonleay.botendo.Bot.lava.getLink(guildId)
|
||||
val player = link.player
|
||||
val u = this.user
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0xE0A81A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything."
|
||||
)
|
||||
this.respond {
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
val track = player.playingTrack
|
||||
if (track == null) {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0xE0A81A),
|
||||
"Not Playing",
|
||||
"I'm not playing anything currently"
|
||||
)
|
||||
this.respond {
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not Playing"
|
||||
this.description = "I'm not playing anything currently"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
val gts = MusicManager.getGuildTrackScheduler(this.guild!!.asGuild(), player)
|
||||
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithImage(
|
||||
Color(0x52E01A),
|
||||
"Currently playing",
|
||||
"**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
player.position
|
||||
)
|
||||
}: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
track.length.inWholeMilliseconds
|
||||
)
|
||||
}\n" +
|
||||
">>>${track.uri}",
|
||||
UserUtil.getCommandSrc(user),
|
||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri.toString()) + "/maxresdefault.jpg"
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "Currently playing"
|
||||
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
player.position
|
||||
)
|
||||
}: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
track.length.inWholeMilliseconds
|
||||
)
|
||||
}\n" +
|
||||
">>>${track.uri}"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
this.thumbnail {
|
||||
this.url = "https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri.toString()) + "/maxresdefault.jpg"
|
||||
}
|
||||
}
|
||||
|
||||
this.actionRow {
|
||||
this.components.addAll(
|
||||
this.actionRow(fun ActionRowBuilder.() {
|
||||
components.addAll(
|
||||
ButtonUtil.getMusicControllerButtons(
|
||||
player.paused,
|
||||
gts.repeating
|
||||
).components
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ package net.moonleay.botendo.extensions.music
|
|||
|
||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.rest.builder.message.embed
|
||||
import dev.schlaubi.lavakord.audio.Link
|
||||
import dev.schlaubi.lavakord.kord.getLink
|
||||
import net.moonleay.botendo.extensions.music.components.LinkArguments
|
||||
|
@ -46,14 +46,14 @@ class PlayExtension : Extension() {
|
|||
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
||||
if (vcsUser == null) {
|
||||
this.respond {
|
||||
embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to a VC",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
@ -64,14 +64,14 @@ class PlayExtension : Extension() {
|
|||
link.connectAudio(channelId!!.value)
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
this.respond {
|
||||
embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC and therefore, you cannot play any music",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
this.description = "We are not in the same VC and therefore, you cannot play any music"
|
||||
this.author {
|
||||
this.name = UserUtil.getCommandSrc(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ class PlayExtension : Extension() {
|
|||
"ytsearch:$query"
|
||||
}
|
||||
this.respond {
|
||||
embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0A81A),
|
||||
"Searching...",
|
||||
"We are looking for $query",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0A81A)
|
||||
this.title = "Searching..."
|
||||
this.description = "We are looking for $query"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
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.publicSlashCommand
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
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.embed
|
||||
import dev.schlaubi.lavakord.audio.Link
|
||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||
import net.moonleay.botendo.util.ButtonUtil
|
||||
|
@ -41,23 +43,32 @@ class QueueExtension : Extension() {
|
|||
val guildId = this.guild!!.id
|
||||
val link = net.moonleay.botendo.Bot.lava.getLink(guildId.toString())
|
||||
val player = link.player
|
||||
val u = this.user
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything."
|
||||
)
|
||||
this.respond {
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
val track = player.playingTrack
|
||||
if (track == null) {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0xE0A81A),
|
||||
"Queue empty",
|
||||
"I'm not playing anything currently"
|
||||
)
|
||||
this.respond {
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Queue empty"
|
||||
this.description = "I'm not playing anything currently"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
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"
|
||||
}
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
"Queue",
|
||||
desc,
|
||||
UserUtil.getCommandSrc(user),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "Queue"
|
||||
this.description = desc
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
|
||||
this.actionRow {
|
||||
this.components.addAll(
|
||||
this.actionRow(fun ActionRowBuilder.() {
|
||||
components.addAll(
|
||||
ButtonUtil.getMusicControllerButtons(
|
||||
player.paused,
|
||||
gts.repeating
|
||||
).components
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,10 @@ package net.moonleay.botendo.extensions.music
|
|||
|
||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
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 net.moonleay.botendo.extensions.music.components.MusicManager
|
||||
import net.moonleay.botendo.extensions.music.components.SeekArguments
|
||||
|
@ -43,14 +44,14 @@ class SeekExtension : Extension() {
|
|||
val voiceState = u.asMember(guildId).getVoiceStateOrNull()
|
||||
if (voiceState == null) {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to a VC",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
@ -58,40 +59,40 @@ class SeekExtension : Extension() {
|
|||
val channelId = voiceState.channelId
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything.",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC and therefore, you cannot control the music",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
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
|
||||
}
|
||||
var track = player.playingTrack
|
||||
if (track == null) {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not playing",
|
||||
"I'm not playing anything currently",
|
||||
UserUtil.getCommandSrc(u)
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not playing"
|
||||
this.description = "I'm not playing anything currently"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
@ -101,47 +102,50 @@ class SeekExtension : Extension() {
|
|||
player.seekTo(targetPos)
|
||||
} else {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Invalid position",
|
||||
"The position you specified is invalid",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Invalid position"
|
||||
this.description = "The position you specified is invalid"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
||||
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithImage(
|
||||
Color(0x52E01A),
|
||||
"Jumped; now playing",
|
||||
"**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
player.position
|
||||
)
|
||||
}: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
track.length.inWholeMilliseconds
|
||||
)
|
||||
}\n" +
|
||||
">>>${track.uri}",
|
||||
UserUtil.getCommandSrc(user),
|
||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "Jumped; now playing"
|
||||
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ; ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
player.position
|
||||
)
|
||||
}: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
track.length.inWholeMilliseconds
|
||||
)
|
||||
}\n" +
|
||||
">>>${track.uri}"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
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(
|
||||
player.paused,
|
||||
gts.repeating
|
||||
).components
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,11 @@ package net.moonleay.botendo.extensions.music
|
|||
|
||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
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.embed
|
||||
import dev.schlaubi.lavakord.audio.Link
|
||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||
import net.moonleay.botendo.util.*
|
||||
|
@ -41,41 +43,57 @@ class SkipExtension : Extension() {
|
|||
val u = this.user
|
||||
val voiceState = u.asMember(guildId).getVoiceStateOrNull()
|
||||
if (voiceState == null) {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to a VC"
|
||||
)
|
||||
this.respond {
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
||||
val channelId = voiceState.channelId
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything."
|
||||
)
|
||||
this.respond {
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC and therefore, you cannot control the music"
|
||||
)
|
||||
this.respond {
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
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
|
||||
}
|
||||
var track = player.playingTrack
|
||||
if (track == null) {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0xE0311A),
|
||||
"Not playing",
|
||||
"I'm not playing anything currently"
|
||||
)
|
||||
this.respond {
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not playing"
|
||||
this.description = "I'm not playing anything currently"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
val gts = MusicManager.getGuildTrackScheduler(this.guild!!.asGuild(), player)
|
||||
|
@ -88,29 +106,31 @@ class SkipExtension : Extension() {
|
|||
|
||||
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithImage(
|
||||
Color(0x52E01A),
|
||||
"Skipped song; now playing",
|
||||
"**${track.title}**\n*Now Playing*\nby ${track.author} ;: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
track.length.inWholeMilliseconds
|
||||
)
|
||||
}\n" +
|
||||
">>>${track.uri}",
|
||||
UserUtil.getCommandSrc(user),
|
||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "Skipped song; now playing"
|
||||
this.description = "**${track.title}**\n*Now Playing*\nby ${track.author} ;: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
track.length.inWholeMilliseconds
|
||||
)
|
||||
}\n" +
|
||||
">>>${track.uri}"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
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(
|
||||
player.paused,
|
||||
gts.repeating
|
||||
).components
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ package net.moonleay.botendo.extensions.music
|
|||
|
||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.rest.builder.message.embed
|
||||
import dev.schlaubi.lavakord.audio.Link
|
||||
import dev.schlaubi.lavakord.kord.getLink
|
||||
import net.moonleay.botendo.extensions.music.components.MusicManager
|
||||
|
@ -43,40 +43,40 @@ class StopExtension : Extension() {
|
|||
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
||||
if (vcsUser == null) {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to my VC",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
val channelId = vcsUser.channelId
|
||||
if (link.state == Link.State.NOT_CONNECTED) {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not connected",
|
||||
"I'm not in a VC and therefore, I am not playing anything.",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not connected"
|
||||
this.description = "I'm not in a VC and therefore, I am not playing anything."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
this.description = "We are not in the same VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
@ -84,14 +84,14 @@ class StopExtension : Extension() {
|
|||
link.destroy()
|
||||
MusicManager.getGuildTrackScheduler(this.getGuild()!!.asGuild(), player).clear()
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
"I stopped and left",
|
||||
"just like your girlfriend",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "I stopped and left"
|
||||
this.description = "just like your girlfriend"
|
||||
this.footer {
|
||||
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.publicSlashCommand
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.rest.builder.message.embed
|
||||
import dev.schlaubi.lavakord.audio.Link
|
||||
import dev.schlaubi.lavakord.kord.getLink
|
||||
import net.moonleay.botendo.extensions.music.components.LinkArguments
|
||||
|
@ -46,14 +46,14 @@ class UpsertExtension : Extension() {
|
|||
val vcsUser = u.asMember(guildId).getVoiceStateOrNull()
|
||||
if (vcsUser == null) {
|
||||
this.respond {
|
||||
embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not connected to a VC",
|
||||
"Please connect to a VC",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not connected to a VC"
|
||||
this.description = "Please connect to a VC"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
@ -64,14 +64,14 @@ class UpsertExtension : Extension() {
|
|||
link.connectAudio(channelId!!.value)
|
||||
} else if (link.state == Link.State.CONNECTED && link.lastChannelId != channelId!!.value) {
|
||||
this.respond {
|
||||
embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"You are not in my VC",
|
||||
"We are not in the same VC and therefore, you cannot play any music",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "You are not in my VC"
|
||||
this.description = "We are not in the same VC and therefore, you cannot play any music"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
return@action
|
||||
}
|
||||
|
@ -83,14 +83,14 @@ class UpsertExtension : Extension() {
|
|||
"ytsearch:$query"
|
||||
}
|
||||
this.respond {
|
||||
embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0A81A),
|
||||
"Searching...",
|
||||
"We are looking for $query",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0A81A)
|
||||
this.title = "Searching..."
|
||||
this.description = "We are looking for $query"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
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.components.forms.ModalForm
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.common.entity.Snowflake
|
||||
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.embed
|
||||
import dev.schlaubi.lavakord.audio.Link
|
||||
import dev.schlaubi.lavakord.audio.player.Player
|
||||
import dev.schlaubi.lavakord.rest.loadItem
|
||||
|
@ -77,29 +79,32 @@ object MusicManager {
|
|||
gts.queue(item.track, type)
|
||||
if (!silent)
|
||||
ctx.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithImage(
|
||||
Color(0x52E01A),
|
||||
"${type.s} track from link",
|
||||
"**${item.track.info.title}**\n*Queue*\nby ${item.track.info.author} ;: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
item.track.info.length
|
||||
)
|
||||
}\n" +
|
||||
">>>${item.track.info.uri}",
|
||||
UserUtil.getCommandSrc(u),
|
||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.track.info.uri) + "/maxresdefault.jpg"
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "${type.s} track from link"
|
||||
this.description = "**${item.track.info.title}**\n*Queue*\nby ${item.track.info.author} ;: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
item.track.info.length
|
||||
)
|
||||
}\n" +
|
||||
">>>${item.track.info.uri}"
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
this.thumbnail {
|
||||
this.url =
|
||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.track.info.uri) + "/maxresdefault.jpg"
|
||||
}
|
||||
}
|
||||
|
||||
this.actionRow {
|
||||
this.components.addAll(
|
||||
this.actionRow(fun ActionRowBuilder.() {
|
||||
components.addAll(
|
||||
ButtonUtil.getMusicControllerButtons(
|
||||
player.paused,
|
||||
gts.repeating
|
||||
).components
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,19 +115,23 @@ object MusicManager {
|
|||
}
|
||||
if (!silent)
|
||||
ctx.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0x52E01A),
|
||||
"${type.s} playlist from link",
|
||||
"**${item.tracks.first().info.title}**\n*${item.playlistInfo.name}*\nby ${item.tracks.first().info.author} ;: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
item.tracks.first().info.length
|
||||
)
|
||||
}\n" +
|
||||
">>>${item.tracks.first().info.uri}",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "${type.s} playlist from link"
|
||||
this.description = "**${item.tracks.first().info.title}**\n*${item.playlistInfo.name}*\nby ${item.tracks.first().info.author} ;: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
item.tracks.first().info.length
|
||||
)
|
||||
}\n" +
|
||||
">>>${item.tracks.first().info.uri}"
|
||||
this.footer {
|
||||
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.components.addAll(
|
||||
|
@ -139,20 +148,23 @@ object MusicManager {
|
|||
gts.queue(item.tracks.first(), type)
|
||||
if (!silent)
|
||||
ctx.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbedWithImage(
|
||||
Color(0x52E01A),
|
||||
"${type.s} track from query",
|
||||
"**${item.tracks.first().info.title}**\n*Queue*\nby ${item.tracks.first().info.author} ;: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
item.tracks.first().info.length
|
||||
)
|
||||
}\n" +
|
||||
">>>${item.tracks.first().info.uri}",
|
||||
UserUtil.getCommandSrc(u),
|
||||
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.tracks.first().info.uri) + "/maxresdefault.jpg"
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0x52E01A)
|
||||
this.title = "${type.s} track from query"
|
||||
this.description = "**${item.tracks.first().info.title}**\n*Queue*\nby ${item.tracks.first().info.author} ;: ${
|
||||
TimeUtil.getTimeFormatedRaw(
|
||||
item.tracks.first().info.length
|
||||
)
|
||||
}\n" +
|
||||
">>>${item.tracks.first().info.uri}"
|
||||
this.footer {
|
||||
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.components.addAll(
|
||||
|
@ -168,28 +180,28 @@ object MusicManager {
|
|||
TrackResponse.LoadType.NO_MATCHES -> {
|
||||
if (!silent)
|
||||
ctx.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Not found",
|
||||
"There were no matches.",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Not found"
|
||||
this.description = "There were no matches."
|
||||
this.footer {
|
||||
this.text = MessageUtil.getFooter(u)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TrackResponse.LoadType.LOAD_FAILED -> {
|
||||
if (!silent)
|
||||
ctx.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
Color(0xE0311A),
|
||||
"Load failed",
|
||||
"There was an error while loading.",
|
||||
UserUtil.getCommandSrc(u),
|
||||
)
|
||||
)
|
||||
this.embed {
|
||||
this.color = Color(0xE0311A)
|
||||
this.title = "Load failed"
|
||||
this.description = "There was an error while loading."
|
||||
this.footer {
|
||||
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.publicSlashCommand
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.rest.builder.message.embed
|
||||
import net.moonleay.botendo.util.MessageUtil
|
||||
|
||||
class InfoExtension : Extension() {
|
||||
|
@ -31,17 +32,23 @@ class InfoExtension : Extension() {
|
|||
name = "info"
|
||||
description = "Show infos about the bot"
|
||||
this.action {
|
||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
||||
this,
|
||||
Color(0x52E01A), "Botendo",
|
||||
"Botendo ***v." + net.moonleay.botendo.build.BuildConstants.version + "***\n" +
|
||||
val u = this.user
|
||||
this.respond {
|
||||
this.embed {
|
||||
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" +
|
||||
"lavalink.kt ***v." + net.moonleay.botendo.build.BuildConstants.lavaVersion + "***\n" +
|
||||
"Coroutines ***v." + net.moonleay.botendo.build.BuildConstants.coroutinesVersion + "***\n\n\n" +
|
||||
"***Bot made by moonleay***\n" +
|
||||
"(c) 2023, licensed under GPL-3.0\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.application.slash.PublicSlashCommandContext
|
||||
import com.kotlindiscord.kord.extensions.components.forms.ModalForm
|
||||
import com.kotlindiscord.kord.extensions.types.respond
|
||||
import dev.kord.common.Color
|
||||
import dev.kord.core.behavior.UserBehavior
|
||||
import dev.kord.rest.builder.message.EmbedBuilder
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
|
@ -31,74 +31,8 @@ import java.time.format.DateTimeFormatter
|
|||
object MessageUtil {
|
||||
private val dtf: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy @ HH:mm:ss")
|
||||
|
||||
///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 {
|
||||
suspend fun getFooter(u: UserBehavior? = null): String{
|
||||
val now: LocalDateTime = LocalDateTime.now()
|
||||
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
|
||||
return ">" + dtf.format(now) + " - ${u?.asUser()?.username?:"Automatic Message"}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,12 +23,6 @@ import dev.kord.core.behavior.UserBehavior
|
|||
|
||||
object UserUtil {
|
||||
suspend fun getCommandSrc(u: UserBehavior): String {
|
||||
return "${u.asUser().username}${getUserDiscriminator(u)}"
|
||||
}
|
||||
|
||||
private suspend fun getUserDiscriminator(u: UserBehavior): String {
|
||||
if (u.asUser().discriminator == "0")
|
||||
return ""
|
||||
return "#${u.asUser().discriminator}"
|
||||
return "${u.asUser().username}}"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue