chore: updated command source system

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-07-24 00:18:41 +02:00
parent f94d6c6ae7
commit 1cbf631f27
16 changed files with 72 additions and 69 deletions

View file

@ -31,6 +31,7 @@ import net.moonleay.botendo.extensions.music.*
import net.moonleay.botendo.extensions.util.InfoExtension
import net.moonleay.botendo.util.Logger
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.UserUtil
object Bot {
//The kord object gets set at app launch
@ -95,7 +96,7 @@ object Bot {
Color(0xE0311A),
"Error",
"Could not find button with id \"${inter.componentId}\".\nPlease report this.",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u)
)
)
}

View file

@ -29,6 +29,7 @@ import dev.schlaubi.lavakord.audio.Link
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.UserUtil
class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
override suspend fun onInteraction(
@ -47,7 +48,7 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
Color(0xE0311A),
"You are not connected to a VC",
"Please connect to a VC",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -62,7 +63,7 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
Color(0xE0311A),
"Not connected",
"I'm not in a VC and therefore, I am not playing anything.",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -74,7 +75,7 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
Color(0xE0311A),
"You are not in my VC",
"We are not in the same VC and therefore, you cannot control the music",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -90,7 +91,7 @@ class PauseButton : net.moonleay.botendo.buttons.Button("btn.music.pause") {
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.",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)

View file

@ -30,6 +30,7 @@ import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.TimeUtil
import net.moonleay.botendo.util.UserUtil
class QueueButton : net.moonleay.botendo.buttons.Button("btn.music.queue") {
override suspend fun onInteraction(
@ -47,7 +48,7 @@ class QueueButton : net.moonleay.botendo.buttons.Button("btn.music.queue") {
Color(0xE0311A),
"Not connected",
"I'm not in a VC and therefore, I am not playing anything.",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -61,7 +62,8 @@ class QueueButton : net.moonleay.botendo.buttons.Button("btn.music.queue") {
MessageUtil.getEmbed(
Color(0xE0311A),
"Not playing",
"I'm not playing anything currently", user.asUser().username + "#" + user.asUser().discriminator
"I'm not playing anything currently",
UserUtil.getCommandSrc(user)
)
)
}
@ -82,7 +84,7 @@ class QueueButton : net.moonleay.botendo.buttons.Button("btn.music.queue") {
Color(0x52E01A),
"Queue",
desc,
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)

View file

@ -29,6 +29,7 @@ import dev.schlaubi.lavakord.audio.Link
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.UserUtil
class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
override suspend fun onInteraction(
@ -47,7 +48,7 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
Color(0xE0311A),
"You are not connected to a VC",
"Please connect to a VC",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -62,7 +63,7 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
Color(0xE0311A),
"Not connected",
"I'm not in a VC and therefore, I am not playing anything.",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -74,7 +75,7 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
Color(0xE0311A),
"You are not in my VC",
"We are not in the same VC and therefore, you cannot control the music",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -89,7 +90,7 @@ class RepeatButton : net.moonleay.botendo.buttons.Button("btn.music.repeat") {
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",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)

View file

@ -28,10 +28,7 @@ import dev.kord.core.entity.User
import dev.kord.rest.builder.message.modify.actionRow
import dev.schlaubi.lavakord.audio.Link
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.TimeUtil
import net.moonleay.botendo.util.UrlUtil
import net.moonleay.botendo.util.*
class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
override suspend fun onInteraction(
@ -50,7 +47,7 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
Color(0xE0311A),
"You are not connected to a VC",
"Please connect to a VC",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -65,7 +62,7 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
Color(0xE0311A),
"Not connected",
"I'm not in a VC and therefore, I am not playing anything.",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -77,7 +74,7 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
Color(0xE0311A),
"You are not in my VC",
"We are not in the same VC and therefore, you cannot control the music",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -90,7 +87,8 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
MessageUtil.getEmbed(
Color(0xE0311A),
"Not playing",
"I'm not playing anything currently", user.asUser().username + "#" + user.asUser().discriminator
"I'm not playing anything currently",
UserUtil.getCommandSrc(user)
)
)
}
@ -111,7 +109,7 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
)
}\n" +
">>>${track.uri}",
user.asUser().username + "#" + user.asUser().discriminator,
UserUtil.getCommandSrc(user),
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
)
)
@ -135,7 +133,7 @@ class SkipButton : net.moonleay.botendo.buttons.Button("btn.music.skip") {
Color(0x52E01A),
"Skipped song; now playing",
"Nothing",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
this.actionRow {

View file

@ -27,6 +27,7 @@ import dev.kord.core.entity.User
import dev.schlaubi.lavakord.audio.Link
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.UserUtil
class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
override suspend fun onInteraction(
@ -45,7 +46,7 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
Color(0xE0311A),
"You are not connected to a VC",
"Please connect to a VC",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -60,7 +61,7 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
Color(0xE0311A),
"Not connected",
"I'm not in a VC and therefore, I am not playing anything.",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -72,7 +73,7 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
Color(0xE0311A),
"You are not in my VC",
"We are not in the same VC and therefore, you cannot control the music",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}
@ -88,7 +89,7 @@ class StopButton : net.moonleay.botendo.buttons.Button("btn.music.stop") {
Color(0x52E01A),
"I stopped and left",
"just like your girlfriend",
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user)
)
)
}

View file

@ -27,10 +27,7 @@ import dev.kord.rest.builder.message.create.actionRow
import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.kord.getLink
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.TimeUtil
import net.moonleay.botendo.util.UrlUtil
import net.moonleay.botendo.util.*
class NowPlayingExtension : Extension() {
override val name = "nowplaying"
@ -78,7 +75,7 @@ class NowPlayingExtension : Extension() {
)
}\n" +
">>>${track.uri}",
user.asUser().username + "#" + user.asUser().discriminator,
UserUtil.getCommandSrc(user),
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri.toString()) + "/maxresdefault.jpg"
)
)

View file

@ -28,6 +28,7 @@ import dev.schlaubi.lavakord.kord.getLink
import net.moonleay.botendo.extensions.music.components.LinkArguments
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.UserUtil
class PlayExtension : Extension() {
@ -50,7 +51,7 @@ class PlayExtension : Extension() {
Color(0xE0311A),
"You are not connected to a VC",
"Please connect to a VC",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u),
)
)
}
@ -68,7 +69,7 @@ class PlayExtension : Extension() {
Color(0xE0311A),
"You are not in my VC",
"We are not in the same VC and therefore, you cannot play any music",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u),
)
)
}
@ -87,7 +88,7 @@ class PlayExtension : Extension() {
Color(0xE0A81A),
"Searching...",
"We are looking for $query",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u),
)
)
}

View file

@ -29,6 +29,7 @@ import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.TimeUtil
import net.moonleay.botendo.util.UserUtil
class QueueExtension : Extension() {
override val name = "queue"
@ -74,7 +75,7 @@ class QueueExtension : Extension() {
Color(0x52E01A),
"Queue",
desc,
user.asUser().username + "#" + user.asUser().discriminator
UserUtil.getCommandSrc(user),
)
)

View file

@ -27,10 +27,7 @@ import dev.kord.rest.builder.message.create.actionRow
import dev.schlaubi.lavakord.audio.Link
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.extensions.music.components.SeekArguments
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.TimeUtil
import net.moonleay.botendo.util.UrlUtil
import net.moonleay.botendo.util.*
class SeekExtension : Extension() {
override val name = "seek"
@ -51,7 +48,7 @@ class SeekExtension : Extension() {
Color(0xE0311A),
"You are not connected to a VC",
"Please connect to a VC",
"${u.asUser().username}#${u.asUser().discriminator}"
UserUtil.getCommandSrc(u),
)
)
}
@ -66,7 +63,7 @@ class SeekExtension : Extension() {
Color(0xE0311A),
"Not connected",
"I'm not in a VC and therefore, I am not playing anything.",
"${u.asUser().username}#${u.asUser().discriminator}"
UserUtil.getCommandSrc(u),
)
)
}
@ -78,7 +75,7 @@ class SeekExtension : Extension() {
Color(0xE0311A),
"You are not in my VC",
"We are not in the same VC and therefore, you cannot control the music",
"${u.asUser().username}#${u.asUser().discriminator}"
UserUtil.getCommandSrc(u),
)
)
}
@ -92,7 +89,7 @@ class SeekExtension : Extension() {
Color(0xE0311A),
"Not playing",
"I'm not playing anything currently",
"${u.asUser().username}#${u.asUser().discriminator}"
UserUtil.getCommandSrc(u)
)
)
}
@ -109,7 +106,7 @@ class SeekExtension : Extension() {
Color(0xE0311A),
"Invalid position",
"The position you specified is invalid",
"${u.asUser().username}#${u.asUser().discriminator}"
UserUtil.getCommandSrc(u),
)
)
}
@ -132,7 +129,7 @@ class SeekExtension : Extension() {
)
}\n" +
">>>${track.uri}",
user.asUser().username + "#" + user.asUser().discriminator,
UserUtil.getCommandSrc(user),
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
)
)

View file

@ -26,10 +26,7 @@ import dev.kord.common.Color
import dev.kord.rest.builder.message.create.actionRow
import dev.schlaubi.lavakord.audio.Link
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.TimeUtil
import net.moonleay.botendo.util.UrlUtil
import net.moonleay.botendo.util.*
class SkipExtension : Extension() {
override val name = "skip"
@ -101,7 +98,7 @@ class SkipExtension : Extension() {
)
}\n" +
">>>${track.uri}",
user.asUser().username + "#" + user.asUser().discriminator,
UserUtil.getCommandSrc(user),
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(track.uri!!) + "/maxresdefault.jpg"
)
)

View file

@ -27,6 +27,7 @@ import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.kord.getLink
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.UserUtil
class StopExtension : Extension() {
override val name = "stop"
@ -46,7 +47,8 @@ class StopExtension : Extension() {
MessageUtil.getEmbed(
Color(0xE0311A),
"You are not connected to a VC",
"Please connect to my VC", u.asUser().username + "#" + u.asUser().discriminator
"Please connect to my VC",
UserUtil.getCommandSrc(u),
)
)
}
@ -60,7 +62,7 @@ class StopExtension : Extension() {
Color(0xE0311A),
"Not connected",
"I'm not in a VC and therefore, I am not playing anything.",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u),
)
)
}
@ -71,7 +73,8 @@ class StopExtension : Extension() {
MessageUtil.getEmbed(
Color(0xE0311A),
"You are not in my VC",
"We are not in the same VC", u.asUser().username + "#" + u.asUser().discriminator
"We are not in the same VC",
UserUtil.getCommandSrc(u),
)
)
}
@ -86,7 +89,7 @@ class StopExtension : Extension() {
Color(0x52E01A),
"I stopped and left",
"just like your girlfriend",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u),
)
)
}

View file

@ -28,6 +28,7 @@ import dev.schlaubi.lavakord.kord.getLink
import net.moonleay.botendo.extensions.music.components.LinkArguments
import net.moonleay.botendo.extensions.music.components.MusicManager
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.UserUtil
class UpsertExtension : Extension() {
@ -50,7 +51,7 @@ class UpsertExtension : Extension() {
Color(0xE0311A),
"You are not connected to a VC",
"Please connect to a VC",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u),
)
)
}
@ -68,7 +69,7 @@ class UpsertExtension : Extension() {
Color(0xE0311A),
"You are not in my VC",
"We are not in the same VC and therefore, you cannot play any music",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u),
)
)
}
@ -87,7 +88,7 @@ class UpsertExtension : Extension() {
Color(0xE0A81A),
"Searching...",
"We are looking for $query",
u.asUser().username + "#" + u.asUser().discriminator
UserUtil.getCommandSrc(u),
)
)
}

View file

@ -30,10 +30,7 @@ import dev.schlaubi.lavakord.audio.Link
import dev.schlaubi.lavakord.audio.player.Player
import dev.schlaubi.lavakord.rest.loadItem
import dev.schlaubi.lavakord.rest.models.TrackResponse
import net.moonleay.botendo.util.ButtonUtil
import net.moonleay.botendo.util.MessageUtil
import net.moonleay.botendo.util.TimeUtil
import net.moonleay.botendo.util.UrlUtil
import net.moonleay.botendo.util.*
object MusicManager {
private var musicManagerMap: MutableMap<Snowflake, GuildTrackScheduler> = mutableMapOf()
@ -89,7 +86,8 @@ object MusicManager {
item.track.info.length
)
}\n" +
">>>${item.track.info.uri}", u.username + "#" + u.discriminator,
">>>${item.track.info.uri}",
UserUtil.getCommandSrc(u),
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.track.info.uri) + "/maxresdefault.jpg"
)
)
@ -121,7 +119,8 @@ object MusicManager {
item.tracks.first().info.length
)
}\n" +
">>>${item.tracks.first().info.uri}", u.username + "#" + u.discriminator
">>>${item.tracks.first().info.uri}",
UserUtil.getCommandSrc(u),
)
)
@ -149,7 +148,8 @@ object MusicManager {
item.tracks.first().info.length
)
}\n" +
">>>${item.tracks.first().info.uri}", u.username + "#" + u.discriminator,
">>>${item.tracks.first().info.uri}",
UserUtil.getCommandSrc(u),
"https://img.youtube.com/vi/" + UrlUtil.getYtThumbnailUrl(item.tracks.first().info.uri) + "/maxresdefault.jpg"
)
)
@ -173,7 +173,7 @@ object MusicManager {
Color(0xE0311A),
"Not found",
"There were no matches.",
u.username + "#" + u.discriminator
UserUtil.getCommandSrc(u),
)
)
}
@ -186,7 +186,8 @@ object MusicManager {
MessageUtil.getEmbed(
Color(0xE0311A),
"Load failed",
"There was an error while loading.", u.username + "#" + u.discriminator
"There was an error while loading.",
UserUtil.getCommandSrc(u),
)
)
}

View file

@ -32,7 +32,8 @@ class InfoExtension : Extension() {
description = "Show infos about the bot"
this.action {
MessageUtil.sendEmbedForPublicSlashCommand(
this, Color(0x52E01A), "Botendo",
this,
Color(0x52E01A), "Botendo",
"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" +

View file

@ -44,7 +44,7 @@ object MessageUtil {
color,
title,
description,
ctx.user.asUser().username + "#" + ctx.user.asUser().discriminator
UserUtil.getCommandSrc(ctx.user)
)
)
}
@ -64,7 +64,7 @@ object MessageUtil {
color,
title,
description,
ctx.user.asUser().username + "#" + ctx.user.asUser().discriminator,
UserUtil.getCommandSrc(ctx.user),
thumbnailUrl
)
)