Skip to content

Commit 8083230

Browse files
committed
Compiles under new jda
1 parent ff9dc76 commit 8083230

11 files changed

Lines changed: 28 additions & 10 deletions

File tree

bot/src/main/java/me/duncte123/skybot/CommandManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import me.duncte123.skybot.commands.guild.owner.settings.*;
4040
import me.duncte123.skybot.commands.image.*;
4141
import me.duncte123.skybot.commands.image.filter.*;
42-
import me.duncte123.skybot.commands.lgbtq.SetPronounsCommand;
4342
import me.duncte123.skybot.commands.mod.*;
4443
import me.duncte123.skybot.commands.music.*;
4544
import me.duncte123.skybot.commands.uncategorized.*;

bot/src/main/java/me/duncte123/skybot/SkyBot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private SkyBot() throws LoginException {
120120
GatewayIntent.GUILD_MEMBERS,
121121
GatewayIntent.GUILD_INVITES,
122122
GatewayIntent.GUILD_MODERATION,
123-
GatewayIntent.GUILD_EMOJIS_AND_STICKERS,
123+
GatewayIntent.GUILD_EXPRESSIONS,
124124
GatewayIntent.GUILD_VOICE_STATES,
125125
GatewayIntent.GUILD_MESSAGES
126126
)

bot/src/main/java/me/duncte123/skybot/commands/utils/EnlargeCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import net.dv8tion.jda.api.entities.sticker.Sticker.StickerFormat;
3535
import net.dv8tion.jda.api.entities.sticker.StickerItem;
3636
import net.dv8tion.jda.api.utils.FileUpload;
37+
import net.dv8tion.jda.api.utils.ImageFormat;
3738
import org.jetbrains.annotations.NotNull;
3839

3940
import java.io.*;
@@ -91,7 +92,7 @@ public void execute(@NotNull CommandContext ctx) {
9192
if (!emotes.isEmpty()) {
9293
final CustomEmoji emote = emotes.get(0);
9394

94-
this.uploadFile(emote.getImageUrl().replace("gif", "png"), ctx);
95+
this.uploadFile(emote.getImageUrl(ImageFormat.PNG), ctx);
9596

9697
return;
9798
}

bot/src/main/java/me/duncte123/skybot/objects/command/MusicCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import net.dv8tion.jda.api.entities.Guild;
2828
import net.dv8tion.jda.api.entities.channel.unions.AudioChannelUnion;
2929
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
30+
import net.dv8tion.jda.api.interactions.InteractionContextType;
3031
import net.dv8tion.jda.api.interactions.commands.build.Commands;
3132
import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData;
3233
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
@@ -147,7 +148,7 @@ public void handleSlashWithAutoJoin(@Nonnull SlashCommandInteractionEvent event,
147148

148149
public static SlashCommandData getMusicCommandData(CommandManager mngr) {
149150
final var base = Commands.slash("music", "base command for music commands")
150-
.setGuildOnly(true);
151+
.setContexts(InteractionContextType.GUILD);
151152

152153
mngr.getCommands(CommandCategory.MUSIC).forEach((cmd) -> base.addSubcommands(
153154
((MusicCommand) cmd).getSubData()

bot/src/main/java/me/duncte123/skybot/objects/user/FakeUser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,11 @@ public int getFlagsRaw() {
164164
return 0;
165165
}
166166

167+
@Override
168+
public @org.jspecify.annotations.Nullable PrimaryGuild getPrimaryGuild() {
169+
return null;
170+
}
171+
167172
@Override
168173
public void formatTo(Formatter formatter, int flags, int width, int precision) {
169174
final boolean alt = (flags & FormattableFlags.ALTERNATE) == FormattableFlags.ALTERNATE;

bot/src/main/kotlin/me/duncte123/skybot/commands/music/SearchCommand.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ import me.duncte123.skybot.entities.jda.DunctebotGuild
2626
import me.duncte123.skybot.objects.Emotes.SEARCH_EMOTE
2727
import me.duncte123.skybot.objects.command.CommandContext
2828
import me.duncte123.skybot.objects.command.MusicCommand
29+
import net.dv8tion.jda.api.components.actionrow.ActionRow
30+
import net.dv8tion.jda.api.components.selections.StringSelectMenu
2931
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
30-
import net.dv8tion.jda.api.interactions.components.selections.StringSelectMenu
3132
import java.util.*
3233
import java.util.concurrent.TimeUnit
3334
import kotlin.math.min
@@ -93,7 +94,9 @@ class SearchCommand : MusicCommand() {
9394
.setChannel(ctx.channel)
9495
.addEmbed(EmbedUtils.embedMessage(string))
9596
.configureMessageBuilder {
96-
it.addActionRow(menu.build())
97+
it.addComponents(
98+
ActionRow.of(menu.build())
99+
)
97100
}
98101
.setSuccessAction {
99102
handler.waitForReaction(TimeUnit.SECONDS.toMillis(timeout), it, componentId, userId, ctx)

bot/src/main/kotlin/me/duncte123/skybot/commands/utils/EmoteCommand.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import net.dv8tion.jda.api.entities.emoji.CustomEmoji
3232
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
3333
import net.dv8tion.jda.api.interactions.commands.OptionType
3434
import net.dv8tion.jda.api.interactions.commands.build.SlashCommandData
35+
import net.dv8tion.jda.api.utils.ImageFormat
3536

3637
class EmoteCommand : SlashSupport() {
3738
init {
@@ -77,7 +78,7 @@ class EmoteCommand : SlashSupport() {
7778
private fun customEmoteMentioned(emote: CustomEmoji): String {
7879
val name = emote.name
7980
val id = emote.id
80-
val url = emote.imageUrl
81+
val url = emote.getImageUrl(ImageFormat.PNG)
8182
val markdownStr = "< :${emote.name}:${emote.idLong}>"
8283

8384
return """**Emote:** $name

bot/src/main/kotlin/me/duncte123/skybot/entities/jda/FakeMember.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class FakeMember(private val name: String) : Member {
6363
override fun getNickname(): String = throw NotImplementedError("An operation is not implemented: not implemented")
6464

6565
override fun getRoles(): MutableList<Role> = throw NotImplementedError("An operation is not implemented: not implemented")
66+
override fun getUnsortedRoles(): Set<Role?> = throw NotImplementedError("An operation is not implemented: not implemented")
67+
68+
override fun getColors(): RoleColors = throw NotImplementedError("An operation is not implemented: not implemented")
6669

6770
override fun getColorRaw(): Int = throw NotImplementedError("An operation is not implemented: not implemented")
6871

@@ -123,4 +126,8 @@ class FakeMember(private val name: String) : Member {
123126
override fun getDefaultAvatarId(): String {
124127
TODO("Not yet implemented")
125128
}
129+
130+
override fun isDetached(): Boolean {
131+
TODO("Not yet implemented")
132+
}
126133
}

bot/src/main/kotlin/me/duncte123/skybot/objects/SlashSupport.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import me.duncte123.skybot.entities.jda.DunctebotGuild
2323
import me.duncte123.skybot.objects.command.CommandCategory
2424
import me.duncte123.skybot.utils.AirUtils
2525
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent
26+
import net.dv8tion.jda.api.interactions.InteractionContextType
2627
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions
2728
import net.dv8tion.jda.api.interactions.commands.build.CommandData
2829
import net.dv8tion.jda.api.interactions.commands.build.Commands
@@ -42,7 +43,7 @@ abstract class SlashSupport : SkyCommand() {
4243
0, min(help.length, CommandData.MAX_DESCRIPTION_LENGTH)
4344
)
4445
)
45-
.setGuildOnly(true)
46+
.setContexts(InteractionContextType.GUILD)
4647
.setNSFW(category == CommandCategory.NSFW)
4748
.setDefaultPermissions(DefaultMemberPermissions.enabledFor(this.userPermissions.toList()))
4849

dashboard/src/main/kotlin/com/dunctebot/jda/JDARestClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class JDARestClient(token: String) {
5454
threadConfig.setEventPool(jdaVirtualThread, true)
5555
threadConfig.setCallbackPool(jdaVirtualThread, true)
5656

57-
jda = JDAImpl(authConfig, null, threadConfig, null, null)
57+
jda = JDAImpl(authConfig, null, threadConfig, null, null, null)
5858

5959
jda.initRequester()
6060

0 commit comments

Comments
 (0)