Skip to content

Commit b3a2ff2

Browse files
committed
Bug fixing.
1 parent 9e4f0fb commit b3a2ff2

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

Backend/src/main/java/de/presti/ree6/backend/utils/data/container/ChannelContainer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import net.dv8tion.jda.api.entities.channel.attribute.IWebhookContainer;
1111
import net.dv8tion.jda.api.entities.channel.concrete.Category;
1212
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
13+
import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildMessageChannel;
1314

1415
@Getter
1516
@Setter
@@ -26,6 +27,13 @@ public class ChannelContainer {
2627
String name;
2728
ChannelType type;
2829

30+
public ChannelContainer(StandardGuildMessageChannel guildChannel) {
31+
this.id = guildChannel.getIdLong();
32+
this.guildId = guildChannel.getGuild().getIdLong();
33+
this.name = guildChannel.getName();
34+
this.type = guildChannel.getType();
35+
}
36+
2937
public ChannelContainer(GuildChannel guildChannel) {
3038
this.id = guildChannel.getIdLong();
3139
this.guildId = guildChannel.getGuild().getIdLong();

Backend/src/main/java/de/presti/ree6/backend/utils/data/container/RecordContainer.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import lombok.Getter;
99
import lombok.NoArgsConstructor;
1010
import lombok.Setter;
11+
import net.dv8tion.jda.api.entities.Guild;
1112
import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildMessageChannel;
1213

1314
@Getter
@@ -28,7 +29,16 @@ public RecordContainer(Recording recording) {
2829
///this.data = Base64.encodeBase64String(recording.getRecording());
2930
this.creationTime = String.valueOf(recording.getCreation());
3031
this.guildId = recording.getGuildId();
31-
this.voiceChannel = new ChannelContainer(BotWorker.getShardManager().getChannelById(StandardGuildMessageChannel.class, recording.getVoiceId()));
3232
this.creator = new UserContainer(BotWorker.getShardManager().retrieveUserById(recording.getCreatorId()).complete());
33+
34+
Guild guild = BotWorker.getShardManager().getGuildById(recording.getGuildId());
35+
36+
if (guild != null) {
37+
StandardGuildMessageChannel channel = guild.getChannelById(StandardGuildMessageChannel.class, recording.getVoiceId());
38+
39+
if (channel != null) {
40+
this.voiceChannel = new ChannelContainer(channel);
41+
}
42+
}
3343
}
3444
}

0 commit comments

Comments
 (0)