changedItems = items.stream()
- .map((playlistItem) -> playListItemToTrackInfo(playlistItem, apiKey))
- .filter(Objects::nonNull)
- .collect(Collectors.toList());
-
- return new YoutubePlaylistMetadata(playlistId, title, playlistItems.getNextPageToken(), changedItems);
- }
-
- public static String getThumbnail(Video video) {
- return getThumbnail(video.getId());
- }
-
- public static String getThumbnail(String videoID) {
- return "https://i.ytimg.com/vi/" + videoID + "/hq720.jpg";
- }
-
- @Nullable
- public static AudioTrackInfo videoToTrackInfo(@Nullable Video video) {
- if (video == null) {
- return null;
- }
-
- final VideoSnippet snippet = video.getSnippet();
- final VideoContentDetails details = video.getContentDetails();
-
- return new AudioTrackInfo(
- snippet.getTitle(),
- snippet.getChannelTitle(),
- Duration.parse(details.getDuration()).toMillis(),
- video.getId(),
- false,
- "https://www.youtube.com/watch?v=" + video.getId()
- );
- }
-
- public static AudioTrackInfo playListItemToTrackInfo(PlaylistItem playlistItem, String apiKey) {
- try {
- final String videoId = playlistItem.getContentDetails().getVideoId();
-
- if (videoId == null) {
- return null;
- }
-
- final Video video = getVideoById(videoId, apiKey);
-
- return videoToTrackInfo(video);
- }
- catch (IOException e) {
- e.printStackTrace();
- return null; // Should never happen tbh
- }
- }
-
- public static YoutubeAudioTrack videoToTrack(Video video, YoutubeAudioSourceManager sourceManager) {
- return new YoutubeAudioTrack(videoToTrackInfo(video), sourceManager);
- }
-
- private static YouTube.Videos.List getVideosByIdBase(String videoIds, String apiKey) throws IOException {
- return youtube.videos()
- .list("id,snippet,contentDetails")
- .setId(videoIds)
- .setKey(apiKey)
- .setFields("items(id/*,snippet/title,snippet/channelTitle,contentDetails/duration)");
- }
-
- /**
- * Gets the name for a playlist
- *
- * IMPORTANT: returns null if the playlist does not exist
- */
- @Nullable
- private static String getPlayListName(String playlistId, String apiKey) throws IOException {
- final List playlists = youtube.playlists()
- .list("snippet")
- .setId(playlistId)
- .setKey(apiKey)
- .execute()
- .getItems();
-
- if (playlists.isEmpty()) {
- return null;
- }
-
- final Playlist playlist = playlists.get(0);
-
- return playlist.getSnippet().getTitle();
- }
-
- /*private static YoutubeTrack searchCache(String title, String author, CacheClient cacheClient) {
- final SearchParams params = new SearchParams()
- .setSearch(title + " " + author)
- .setTitle(title.split("\\s+"))
- .setAuthor(author.split("\\s+"));
-
- final List found = cacheClient.search(params);
-
- if (found.isEmpty()) {
- return null;
- }
-
- return found.get(0);
- }
-
- private static Video cacheToYoutubeVideo(YoutubeTrack track) {
- return new Video()
- .setId(track.getId())
- .setKind("youtube#video")
- .setSnippet(
- new VideoSnippet()
- .setTitle(track.getTitle())
- .setChannelTitle(track.getAuthor())
- )
- .setContentDetails(
- new VideoContentDetails()
- .setDuration(
- Duration.ofMillis(track.getLength()).toString()
- )
- );
- }*/
-}
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/admin/BlackListCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/admin/BlackListCommand.kt
index 56df840f3..0a32ec694 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/admin/BlackListCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/admin/BlackListCommand.kt
@@ -33,7 +33,6 @@ import net.dv8tion.jda.api.utils.FileUpload
import java.util.concurrent.atomic.AtomicLong
class BlackListCommand : ModBaseCommand() {
-
init {
this.requiresArgs = true
this.category = CommandCategory.ADMINISTRATION
@@ -166,7 +165,7 @@ class BlackListCommand : ModBaseCommand() {
word: String,
database: AbstractDatabase,
guild: DunctebotGuild,
- ctx: CommandContext
+ ctx: CommandContext,
) {
val list = guild.settings.blacklistedWords
@@ -187,7 +186,7 @@ class BlackListCommand : ModBaseCommand() {
word: String,
database: AbstractDatabase,
guild: DunctebotGuild,
- ctx: CommandContext
+ ctx: CommandContext,
) {
val list = guild.settings.blacklistedWords
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/admin/VcAutoRoleCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/admin/VcAutoRoleCommand.kt
index 6a0e7c933..672aec567 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/admin/VcAutoRoleCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/admin/VcAutoRoleCommand.kt
@@ -32,7 +32,6 @@ import net.dv8tion.jda.api.entities.channel.concrete.VoiceChannel
import java.util.stream.Collectors
class VcAutoRoleCommand : ModBaseCommand() {
-
init {
this.requiresArgs = true
this.category = CommandCategory.ADMINISTRATION
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/animals/BirbCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/animals/BirbCommand.kt
index 17e94f454..4df49bbb9 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/animals/BirbCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/animals/BirbCommand.kt
@@ -27,7 +27,6 @@ import ml.duncte123.skybot.objects.command.CommandCategory
import ml.duncte123.skybot.objects.command.CommandContext
class BirbCommand : Command() {
-
init {
this.category = CommandCategory.ANIMALS
this.name = "bird"
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/RemindersCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/RemindersCommand.kt
index 8ffcb4a32..b19cd76c5 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/RemindersCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/RemindersCommand.kt
@@ -28,7 +28,6 @@ import ml.duncte123.skybot.utils.AirUtils
import net.dv8tion.jda.api.utils.TimeFormat
class RemindersCommand : Command() {
-
init {
this.name = "reminders"
this.aliases = arrayOf("remindmanager", "reminder")
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/RestartShardCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/RestartShardCommand.kt
index 86f3967c6..2fe53ae60 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/RestartShardCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/RestartShardCommand.kt
@@ -33,7 +33,6 @@ import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
class RestartShardCommand : Command() {
-
private val thread = Executors.newSingleThreadExecutor()
private val restartInSec = 5L
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/StatsCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/StatsCommand.kt
index 63ba49a87..6beda577d 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/StatsCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/essentials/StatsCommand.kt
@@ -33,7 +33,6 @@ import java.text.DecimalFormat
import kotlin.math.floor
class StatsCommand : Command() {
-
init {
this.category = CommandCategory.UTILS
this.name = "stats"
@@ -121,7 +120,7 @@ class StatsCommand : Command() {
return
}
- val availableNodes = llm.lavalink.nodes.filter { it.isAvailable }
+ val availableNodes = llm.lavalink.nodes.filter { it.available }
val embed = EmbedUtils.getDefaultEmbed()
.setFooter("Available nodes: ${availableNodes.size}")
@@ -132,10 +131,10 @@ class StatsCommand : Command() {
embed.addField(
"Lavalink node #$index",
"""**Uptime:** ${AirUtils.getUptime(stats.uptime)}
- |**CPU cores:** ${stats.cpuCores}
- |**System Load:** ${stats.systemLoad}%
- |**Used memory:** ${stats.memUsed shr 20}MB
- |**Free memory:** ${stats.memFree shr 20}MB
+ |**CPU cores:** ${stats.cpu.cores}
+ |**System Load:** ${stats.cpu.systemLoad}%
+ |**Used memory:** ${stats.memory.used shr 20}MB
+ |**Free memory:** ${stats.memory.free shr 20}MB
|**Players:** ${stats.players}
|**Players playing:** ${stats.playingPlayers}
""".trimMargin(),
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/AdviceCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/AdviceCommand.kt
similarity index 93%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/AdviceCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/AdviceCommand.kt
index 95afdb1f8..c52e4d373 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/AdviceCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/AdviceCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import com.github.natanbc.reliqua.limiter.RateLimiter
import com.github.natanbc.reliqua.request.RequestException
@@ -28,7 +28,6 @@ import ml.duncte123.skybot.objects.command.CommandCategory
import ml.duncte123.skybot.objects.command.CommandContext
class AdviceCommand : Command() {
-
init {
this.category = CommandCategory.FUN
this.name = "advice"
@@ -37,7 +36,9 @@ class AdviceCommand : Command() {
override fun execute(ctx: CommandContext) {
try {
- val json = WebUtils.ins.getJSONObject("https://api.adviceslip.com/advice") { it.setRateLimiter(RateLimiter.directLimiter()) }.execute()
+ val json = WebUtils.ins.getJSONObject("https://api.adviceslip.com/advice") {
+ it.setRateLimiter(RateLimiter.directLimiter())
+ }.execute()
if (json.has("message")) {
val type = json["message"]["type"].asText()
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/ChatCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/ChatCommand.kt
similarity index 94%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/ChatCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/ChatCommand.kt
index 0fcbbee4e..58ba7b98c 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/ChatCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/ChatCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import gnu.trove.map.hash.TLongObjectHashMap
import me.duncte123.botcommons.messaging.MessageConfig
@@ -42,9 +42,8 @@ import javax.xml.xpath.XPathConstants
import javax.xml.xpath.XPathFactory
class ChatCommand : Command() {
-
private val sessions = MapUtils.newLongObjectMap()
- private val MAX_DURATION = MILLISECONDS.convert(20, MINUTES)
+ private val maxDuration = MILLISECONDS.convert(20, MINUTES)
private val responses = arrayOf(
"My prefix in this guild is *`{PREFIX}`*",
"Thanks for asking, my prefix here is *`{PREFIX}`*",
@@ -70,7 +69,7 @@ class ChatCommand : Command() {
var cleared = 0
for (it in temp.keys()) {
val duration = now.time - sessions.get(it).time.time
- if (duration >= MAX_DURATION) {
+ if (duration >= maxDuration) {
sessions.remove(it)
cleared++
}
@@ -125,7 +124,10 @@ class ChatCommand : Command() {
sendMsg(
MessageConfig.Builder.fromCtx(ctx)
.replyTo(ctx.message)
- .setMessage("$NO_STATIC Chatbot error: no content returned, this is likely due to the chatbot banning you (we are working on a fix)")
+ .setMessage(
+ "$NO_STATIC Chatbot error: no content returned, " +
+ "this is likely due to the chatbot banning you (we are working on a fix)"
+ )
)
return@think
}
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/CoinCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/CoinCommand.kt
similarity index 97%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/CoinCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/CoinCommand.kt
index 085614506..9fa1f32a6 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/CoinCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/CoinCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import me.duncte123.botcommons.messaging.EmbedUtils.embedImage
import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed
@@ -26,7 +26,6 @@ import ml.duncte123.skybot.objects.command.CommandContext
import java.util.concurrent.TimeUnit
class CoinCommand : Command() {
-
private val imagesArr = arrayOf("heads.png", "tails.png")
init {
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/DeletCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/DeletCommand.kt
similarity index 97%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/DeletCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/DeletCommand.kt
index 9753d8032..eabe6abc5 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/DeletCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/DeletCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed
import me.duncte123.weebJava.configs.ImageConfig
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/DiscordMemesCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/DiscordMemesCommand.kt
similarity index 97%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/DiscordMemesCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/DiscordMemesCommand.kt
index 8d6dcbc1a..ec199a399 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/DiscordMemesCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/DiscordMemesCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed
import me.duncte123.weebJava.configs.ImageConfig
@@ -25,7 +25,6 @@ import ml.duncte123.skybot.objects.command.CommandCategory
import ml.duncte123.skybot.objects.command.CommandContext
class DiscordMemesCommand : WeebCommandBase() {
-
init {
this.displayAliasesInHelp = false
this.category = CommandCategory.FUN
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/EveryoneCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/EveryoneCommand.kt
similarity index 97%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/EveryoneCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/EveryoneCommand.kt
index cc9dd8c86..8fb679d3f 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/EveryoneCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/EveryoneCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed
import me.duncte123.weebJava.configs.ImageConfig
@@ -25,7 +25,6 @@ import ml.duncte123.skybot.objects.command.CommandCategory
import ml.duncte123.skybot.objects.command.CommandContext
class EveryoneCommand : WeebCommandBase() {
-
init {
this.category = CommandCategory.FUN
this.name = "everyone"
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/FakeWordCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/FakeWordCommand.kt
similarity index 98%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/FakeWordCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/FakeWordCommand.kt
index a99ea20a9..61d3de5d3 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/FakeWordCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/FakeWordCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import com.fasterxml.jackson.databind.JsonNode
import me.duncte123.botcommons.messaging.EmbedUtils
@@ -32,7 +32,6 @@ import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEve
import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData
class FakeWordCommand : SlashSupport() {
-
init {
this.category = CommandCategory.FUN
this.name = "fakeword"
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/JokeCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/JokeCommand.kt
similarity index 98%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/JokeCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/JokeCommand.kt
index ffab85816..1d4071f7a 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/JokeCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/JokeCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import com.github.natanbc.reliqua.limiter.RateLimiter
import me.duncte123.botcommons.messaging.EmbedUtils
@@ -29,7 +29,6 @@ import ml.duncte123.skybot.objects.command.CommandContext
import net.dv8tion.jda.api.entities.MessageEmbed
class JokeCommand : Command() {
-
init {
this.category = CommandCategory.FUN
this.name = "joke"
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/MemeCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/MemeCommand.kt
similarity index 97%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/MemeCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/MemeCommand.kt
index 9241dbd5b..2253235a3 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/MemeCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/MemeCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import me.duncte123.botcommons.messaging.EmbedUtils
import me.duncte123.botcommons.messaging.MessageUtils
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/OldestCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/OldestCommand.kt
similarity index 97%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/OldestCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/OldestCommand.kt
index 729a34c8c..17cb51c54 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/OldestCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/OldestCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import ml.duncte123.skybot.objects.CooldownScope
import ml.duncte123.skybot.objects.command.Command
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/TrashCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/TrashCommand.kt
similarity index 98%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/TrashCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/TrashCommand.kt
index 27f8534ea..c3355bbdf 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/TrashCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/TrashCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import me.duncte123.botcommons.messaging.MessageUtils.sendMsg
import ml.duncte123.skybot.commands.image.NoPatronImageCommand
@@ -24,7 +24,6 @@ import ml.duncte123.skybot.extensions.getStaticAvatarUrl
import ml.duncte123.skybot.objects.command.CommandContext
class TrashCommand : NoPatronImageCommand() {
-
init {
this.requiresArgs = true
this.name = "trash"
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/XkcdCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/XkcdCommand.kt
similarity index 98%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/XkcdCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/XkcdCommand.kt
index 9c3e83eae..31fcbf84b 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/XkcdCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/XkcdCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import com.fasterxml.jackson.databind.node.ObjectNode
import com.github.natanbc.reliqua.limiter.RateLimiter
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/YoungestCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/YoungestCommand.kt
similarity index 97%
rename from bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/YoungestCommand.kt
rename to bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/YoungestCommand.kt
index 51578aa42..17ec8d989 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/fun/YoungestCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/funCmds/YoungestCommand.kt
@@ -16,7 +16,7 @@
* along with this program. If not, see .
*/
-package ml.duncte123.skybot.commands.`fun`
+package ml.duncte123.skybot.commands.funCmds
import ml.duncte123.skybot.objects.CooldownScope
import ml.duncte123.skybot.objects.command.Command
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/DeHoistUtils.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/DeHoistUtils.kt
index 79de4d8fd..109b803ca 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/DeHoistUtils.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/DeHoistUtils.kt
@@ -31,7 +31,6 @@ import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameE
import net.dv8tion.jda.api.hooks.ListenerAdapter
class DeHoistCommand : ModBaseCommand() {
-
init {
this.requiresArgs = true
this.name = "dehoist"
@@ -69,7 +68,6 @@ class DeHoistCommand : ModBaseCommand() {
}
class DeHoistListener(private val variables: Variables) : ListenerAdapter() {
-
private val regex = "[!\"#\$%&'()*+,-./](?:.*)".toRegex()
private val dehoistChar = "▪"
@@ -100,6 +98,6 @@ class DeHoistListener(private val variables: Variables) : ListenerAdapter() {
!memberName.startsWith(dehoistChar) && matcher &&
member.guild.selfMember.hasPermission(Permission.NICKNAME_MANAGE) &&
GuildSettingsUtils.getGuild(member.guild.idLong, this.variables).isAutoDeHoist
- )
+ )
}
}
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/SlowModeCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/SlowModeCommand.kt
index 5e4c8a37c..c04681646 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/SlowModeCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/SlowModeCommand.kt
@@ -29,7 +29,6 @@ import net.dv8tion.jda.api.entities.channel.attribute.ISlowmodeChannel
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel
class SlowModeCommand : ModBaseCommand() {
-
init {
this.name = "slowmode"
this.aliases = arrayOf("sm")
@@ -77,7 +76,12 @@ class SlowModeCommand : ModBaseCommand() {
}
if (intDelay < 0 || intDelay > TextChannel.MAX_SLOWMODE) {
- sendMsg(ctx, "$intDelay is not valid, a valid delay is a number in the range 0-${TextChannel.MAX_SLOWMODE} (21600 is 6 hours in seconds)")
+ sendMsg(
+ ctx,
+ "$intDelay is not valid, a valid delay is a number in the range 0-${
+ TextChannel.MAX_SLOWMODE
+ } (21600 is 6 hours in seconds)"
+ )
return
}
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/VoiceKickCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/VoiceKickCommand.kt
index d3e3c59e2..42fe7266f 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/VoiceKickCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/VoiceKickCommand.kt
@@ -25,7 +25,6 @@ import ml.duncte123.skybot.objects.command.CommandContext
import net.dv8tion.jda.api.Permission
class VoiceKickCommand : ModBaseCommand() {
-
init {
this.requiresArgs = true
this.name = "voicekick"
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarnCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarnCommand.kt
index fcd12798a..5de529a5b 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarnCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarnCommand.kt
@@ -38,7 +38,6 @@ import net.dv8tion.jda.api.requests.ErrorResponse.CANNOT_SEND_TO_USER
import java.util.concurrent.TimeUnit
class WarnCommand : ModBaseCommand() {
-
init {
this.requiresArgs = true
this.name = "warn"
@@ -155,7 +154,12 @@ class WarnCommand : ModBaseCommand() {
if ((action.type == WarnAction.Type.MUTE || action.type == WarnAction.Type.TEMP_MUTE) &&
!muteRoleCheck(guild)
) {
- modLog("[warn actions] Failed to apply automatic mute `${targetUser.asTag}` as there is no mute role set in the settings of this server", guild)
+ modLog(
+ "[warn actions] Failed to apply automatic mute `${
+ targetUser.asTag
+ }` as there is no mute role set in the settings of this server",
+ guild
+ )
return
}
@@ -211,7 +215,12 @@ class WarnCommand : ModBaseCommand() {
val role = guild.getRoleById(roleId)
if (role == null) {
- modLog("[warn actions] Failed to apply automatic mute `${target.user.asTag}` as I could not find the role that is specified in the settings", guild)
+ modLog(
+ "[warn actions] Failed to apply automatic mute `${
+ target.user.asTag
+ }` as I could not find the role that is specified in the settings",
+ guild
+ )
return
}
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarningsCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarningsCommand.kt
index a89b4a9ec..54894b1a0 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarningsCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/mod/WarningsCommand.kt
@@ -26,7 +26,6 @@ import ml.duncte123.skybot.objects.command.CommandContext
import net.dv8tion.jda.api.Permission
class WarningsCommand : ModBaseCommand() {
-
init {
this.requiresArgs = true
this.name = "warnings"
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/BassBoostCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/BassBoostCommand.kt
index 2189d24c9..79a804af2 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/BassBoostCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/BassBoostCommand.kt
@@ -18,6 +18,9 @@
package ml.duncte123.skybot.commands.music
+import dev.arbjerg.lavalink.protocol.v4.Band
+import dev.arbjerg.lavalink.protocol.v4.Filters
+import dev.arbjerg.lavalink.protocol.v4.toOmissible
import me.duncte123.botcommons.messaging.MessageUtils.sendMsg
import ml.duncte123.skybot.Variables
import ml.duncte123.skybot.objects.command.CommandContext
@@ -29,7 +32,6 @@ import net.dv8tion.jda.api.interactions.commands.build.OptionData
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData
class BassBoostCommand : MusicCommand() {
-
init {
this.name = "bassboost"
this.aliases = arrayOf("bb", "baseboost")
@@ -78,13 +80,17 @@ class BassBoostCommand : MusicCommand() {
private fun setLavalinkEQ(gain: Float, variable: Variables, guildId: Long) {
val player = variable.audioUtils.getMusicManager(guildId).player
- val filters = player.filters
+ val bands = mutableListOf()
for (i in 0..2) {
- filters.setBand(i, gain)
+ bands.add(Band(i, gain))
}
- filters.commit()
+ player.setFilters(
+ Filters(
+ equalizer = bands.toOmissible()
+ )
+ )
}
override fun getSubData(): SubcommandData {
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/ForceSkip.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/ForceSkip.kt
index ecf79757b..f89a72c80 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/ForceSkip.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/ForceSkip.kt
@@ -18,13 +18,10 @@
package ml.duncte123.skybot.commands.music
-import com.sedmelluq.discord.lavaplayer.track.AudioTrack
import me.duncte123.botcommons.messaging.EmbedUtils
import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed
import me.duncte123.botcommons.messaging.MessageUtils.sendMsg
import ml.duncte123.skybot.Variables
-import ml.duncte123.skybot.extensions.getImageUrl
-import ml.duncte123.skybot.objects.TrackUserData
import ml.duncte123.skybot.objects.command.CommandContext
import ml.duncte123.skybot.objects.command.MusicCommand
import ml.duncte123.skybot.objects.user.UnknownUser
@@ -34,7 +31,6 @@ import net.dv8tion.jda.api.interactions.commands.OptionType
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData
class ForceSkip : MusicCommand() {
-
init {
this.name = "forceskip"
this.aliases = arrayOf("modskip")
@@ -49,7 +45,7 @@ class ForceSkip : MusicCommand() {
val mng = ctx.audioUtils.getMusicManager(ctx.guildId)
val player = mng.player
- if (player.playingTrack == null) {
+ if (player.currentTrack == null) {
sendMsg(ctx, "The player is not playing.")
return
}
@@ -67,14 +63,14 @@ class ForceSkip : MusicCommand() {
1
}
- val trackData = player.playingTrack.getUserData(TrackUserData::class.java)
+ val trackData = scheduler.getUserData(player.currentTrack)
scheduler.skipTracks(count, false)
// Return the console user if the requester is null
val user = ctx.jda.getUserById(trackData.requester) ?: UnknownUser()
- val track: AudioTrack? = player.playingTrack
+ val track = player.currentTrack
if (track == null) {
sendMsg(
@@ -92,7 +88,7 @@ class ForceSkip : MusicCommand() {
"Now playing: ${track.info.title}\n" +
"Requester: ${user.asTag}"
)
- .setThumbnail(track.getImageUrl())
+ .setThumbnail(track.info.artworkUrl)
)
}
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/JoinCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/JoinCommand.kt
index ee16d3b4d..9a9036d9d 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/JoinCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/JoinCommand.kt
@@ -27,7 +27,6 @@ import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEve
import net.dv8tion.jda.api.exceptions.PermissionException
class JoinCommand : MusicCommand() {
-
init {
this.justRunLmao = true
@@ -54,7 +53,7 @@ class JoinCommand : MusicCommand() {
val lavalink = getLavalinkManager()
- if (lavalink.isConnected(event.guild) && mng.player.playingTrack != null) {
+ if (lavalink.isConnected(event.guild) && mng.player.currentTrack != null) {
val channel = lavalink.getConnectedChannel(event.guild)
if (channel == null) {
@@ -102,7 +101,7 @@ class JoinCommand : MusicCommand() {
val lavalink = getLavalinkManager()
- if (lavalink.isConnected(event.guild) && mng.player.playingTrack != null) {
+ if (lavalink.isConnected(event.guild) && mng.player.currentTrack != null) {
val channel = lavalink.getConnectedChannel(event.guild!!)
if (channel == null) {
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/LeaveCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/LeaveCommand.kt
index 5bf3ad31a..2189168c8 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/LeaveCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/LeaveCommand.kt
@@ -26,7 +26,6 @@ import ml.duncte123.skybot.objects.command.MusicCommand
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
class LeaveCommand : MusicCommand() {
-
init {
this.name = "leave"
this.aliases = arrayOf("disconnect", "exit", "fuckoff")
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/LyricsCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/LyricsCommand.kt
index 5cefa34a2..97f1e747d 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/LyricsCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/LyricsCommand.kt
@@ -61,7 +61,7 @@ class LyricsCommand : MusicCommand() {
}
val player = ctx.audioUtils.getMusicManager(ctx.guildId).player
- val playingTrack = player.playingTrack
+ val playingTrack = player.currentTrack
if (playingTrack == null) {
sendMsg(ctx, "The player is not currently playing anything!")
@@ -96,7 +96,7 @@ class LyricsCommand : MusicCommand() {
if (opt == null) {
val player = variables.audioUtils.getMusicManager(event.guild!!.idLong).player
- val playingTrack = player.playingTrack
+ val playingTrack = player.currentTrack
if (playingTrack == null) {
event.reply("The player is not currently playing anything!").queue()
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/NowPlayingCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/NowPlayingCommand.kt
index f119f986f..5cd450247 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/NowPlayingCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/NowPlayingCommand.kt
@@ -27,7 +27,6 @@ import ml.duncte123.skybot.objects.command.MusicCommand
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
class NowPlayingCommand : MusicCommand() {
-
init {
this.name = "nowplaying"
this.aliases = arrayOf("np", "song")
@@ -37,27 +36,35 @@ class NowPlayingCommand : MusicCommand() {
override fun run(ctx: CommandContext) {
val mng = ctx.audioUtils.getMusicManager(ctx.guildId)
val player = mng.player
+ val currentTrack = player.currentTrack
- sendEmbed(
- ctx,
- when {
- player.playingTrack != null -> player.playingTrack.toEmbed(mng, ctx.shardManager)
+ if (currentTrack == null) {
+ sendEmbed(
+ ctx,
+ embedMessage("The player is not currently playing anything!")
+ )
+ return
+ }
- else -> embedMessage("The player is not currently playing anything!")
- }
- )
+ currentTrack.toEmbed(mng, ctx.shardManager) { message ->
+ sendEmbed(ctx, message)
+ }
}
override fun handleEvent(event: SlashCommandInteractionEvent, variables: Variables) {
val mng = variables.audioUtils.getMusicManager(event.guild!!.idLong)
val player = mng.player
+ val currentTrack = player.currentTrack
- event.replyEmbeds(
- when {
- player.playingTrack != null -> player.playingTrack.toEmbed(mng, event.jda.shardManager!!)
+ if (currentTrack == null) {
+ event.replyEmbeds(
+ embedMessage("The player is not currently playing anything!").build()
+ ).queue()
+ return
+ }
- else -> embedMessage("The player is not currently playing anything!")
- }.build()
- ).queue()
+ currentTrack.toEmbed(mng, event.jda.shardManager!!) { message ->
+ event.replyEmbeds(message.build()).queue()
+ }
}
}
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PPlayCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PPlayCommand.kt
index 397d78aaf..8677a1bcc 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PPlayCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PPlayCommand.kt
@@ -26,7 +26,6 @@ import ml.duncte123.skybot.objects.command.MusicCommand
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
class PPlayCommand : MusicCommand() {
-
init {
this.mayAutoJoin = true
this.name = "pplay"
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PauseCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PauseCommand.kt
index 059f9770e..913f9ee06 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PauseCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PauseCommand.kt
@@ -25,7 +25,6 @@ import ml.duncte123.skybot.objects.command.MusicCommand
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
class PauseCommand : MusicCommand() {
-
init {
this.name = "pause"
this.aliases = arrayOf("resume")
@@ -34,27 +33,31 @@ class PauseCommand : MusicCommand() {
override fun run(ctx: CommandContext) {
val mng = ctx.audioUtils.getMusicManager(ctx.guildId)
- val player = mng.player
+ val localPlayer = mng.player
+ val player = localPlayer.lavalinkPlayer.block()!!
- if (player.playingTrack == null) {
+ if (player.track == null) {
sendMsg(ctx, "Cannot pause or resume player because no track is loaded for playing.")
return
}
- player.isPaused = !player.isPaused
- sendMsg(ctx, "The player has ${if (player.isPaused) "been paused" else "resumed playing"}.")
+ player.setPaused(!player.paused).asMono().subscribe {
+ sendMsg(ctx, "The player has ${if (it.paused) "been paused" else "resumed playing"}.")
+ }
}
override fun handleEvent(event: SlashCommandInteractionEvent, variables: Variables) {
val mng = variables.audioUtils.getMusicManager(event.guild!!.idLong)
- val player = mng.player
+ val localPlayer = mng.player
+ val player = localPlayer.lavalinkPlayer.block()!!
- if (player.playingTrack == null) {
+ if (player.track == null) {
event.reply("Cannot pause or resume player because no track is loaded for playing.").queue()
return
}
- player.isPaused = !player.isPaused
- event.reply("The player has ${if (player.isPaused) "been paused" else "resumed playing"}.").queue()
+ player.setPaused(!player.paused).asMono().subscribe {
+ event.reply("The player has ${if (it.paused) "been paused" else "resumed playing"}.").queue()
+ }
}
}
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PlayCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PlayCommand.kt
index e77bd8296..16575e6ef 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PlayCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/PlayCommand.kt
@@ -18,7 +18,6 @@
package ml.duncte123.skybot.commands.music
-import com.dunctebot.sourcemanagers.pornhub.PornHubAudioSourceManager
import me.duncte123.botcommons.messaging.MessageUtils
import me.duncte123.botcommons.messaging.MessageUtils.sendMsg
import ml.duncte123.skybot.Variables
@@ -33,6 +32,7 @@ import net.dv8tion.jda.api.interactions.commands.OptionType
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData
open class PlayCommand(private val skipParsing: Boolean = false) : MusicCommand() {
+ private val pornhubRegex = "https?://([a-z]+\\.)?pornhub\\.(com|net|org)"
private val acceptedExtensions = listOf("wav", "mkv", "mp4", "flac", "ogg", "mp3", "aac", "ts")
init {
@@ -50,17 +50,17 @@ open class PlayCommand(private val skipParsing: Boolean = false) : MusicCommand(
}
val mng = ctx.audioUtils.getMusicManager(ctx.guildId)
- val player = mng.player
+ val player = mng.player.lavalinkPlayer.block()!!
val scheduler = mng.scheduler
when {
- player.isPaused -> {
- player.isPaused = false
+ player.paused -> {
+ player.setPaused(false).asMono().subscribe()
sendMsg(ctx, "Playback has been resumed.")
}
- player.playingTrack != null -> sendMsg(ctx, "Player is already playing!")
+ player.track != null -> sendMsg(ctx, "Player is already playing!")
scheduler.queue.isEmpty() -> sendMsg(
ctx,
@@ -74,7 +74,7 @@ open class PlayCommand(private val skipParsing: Boolean = false) : MusicCommand(
var toPlay = ctx.argsRaw
- if (toPlay.contains(PornHubAudioSourceManager.DOMAIN_REGEX.toRegex()) && !ctx.isChannelNSFW) {
+ if (toPlay.contains(pornhubRegex.toRegex()) && !ctx.isChannelNSFW) {
sendMsg(ctx, "Because of thumbnails being loaded you can only use PornHub links in channels that are marked as NSFW")
return
}
@@ -85,7 +85,7 @@ open class PlayCommand(private val skipParsing: Boolean = false) : MusicCommand(
}
if (!AirUtils.isURL(toPlay) && !toPlay.startsWith("OCR", true)) {
- val vidId = searchYt(toPlay, ctx.variables)
+ val vidId = searchYt(ctx.guildId, toPlay, ctx.variables)
if (vidId == null) {
MessageUtils.sendError(ctx.message)
@@ -118,14 +118,14 @@ open class PlayCommand(private val skipParsing: Boolean = false) : MusicCommand(
return true
}
- private fun searchYt(search: String, variables: Variables): String? {
- val playlist = variables.audioUtils.searchYoutube(search)
+ private fun searchYt(guildId: Long, search: String, variables: Variables): String? {
+ val playlist = variables.audioUtils.searchYoutube(guildId, search)
- if (playlist == null || playlist.tracks.isEmpty()) {
+ if (playlist.isNullOrEmpty()) {
return null
}
- return playlist.tracks[0].identifier
+ return playlist[0].info.identifier
}
private fun handlePlay(toPlay: String, ctx: CommandContext) {
@@ -163,7 +163,7 @@ open class PlayCommand(private val skipParsing: Boolean = false) : MusicCommand(
override fun handleEvent(event: SlashCommandInteractionEvent, variables: Variables) {
var toPlay = event.getOption("item")!!.asString
- if (toPlay.contains(PornHubAudioSourceManager.DOMAIN_REGEX.toRegex()) && !event.channel.isNSFW) {
+ if (toPlay.contains(pornhubRegex.toRegex()) && !event.channel.isNSFW) {
event.reply("Because of thumbnails being loaded you can only use PornHub links in channels that are marked as NSFW").queue()
return
}
@@ -174,7 +174,7 @@ open class PlayCommand(private val skipParsing: Boolean = false) : MusicCommand(
}
if (!AirUtils.isURL(toPlay) && !toPlay.startsWith("OCR", true)) {
- val vidId = searchYt(toPlay, variables)
+ val vidId = searchYt(event.guild!!.idLong, toPlay, variables)
if (vidId == null) {
event.reply("No tracks were found").queue()
diff --git a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/QueueCommand.kt b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/QueueCommand.kt
index 4d89f8e74..5906e458c 100644
--- a/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/QueueCommand.kt
+++ b/bot/src/main/kotlin/ml/duncte123/skybot/commands/music/QueueCommand.kt
@@ -18,7 +18,7 @@
package ml.duncte123.skybot.commands.music
-import com.sedmelluq.discord.lavaplayer.track.AudioTrack
+import dev.arbjerg.lavalink.protocol.v4.Track
import me.duncte123.botcommons.messaging.EmbedUtils
import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed
import ml.duncte123.skybot.Variables
@@ -33,7 +33,6 @@ import java.util.*
import kotlin.math.min
class QueueCommand : MusicCommand() {
-
init {
this.name = "queue"
this.aliases = arrayOf("list", "q")
@@ -55,8 +54,8 @@ class QueueCommand : MusicCommand() {
private fun generateQueueEmbed(variables: Variables, guild: Guild, prefix: String): EmbedBuilder {
val mng = variables.audioUtils.getMusicManager(guild.idLong)
val scheduler = mng.scheduler
- val queue: Queue = scheduler.queue
- val playingTrack = mng.player.playingTrack
+ val queue: Queue