File tree Expand file tree Collapse file tree
Backend/src/main/java/de/presti/ree6/backend/utils/data/container Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import net .dv8tion .jda .api .entities .channel .attribute .IWebhookContainer ;
1111import net .dv8tion .jda .api .entities .channel .concrete .Category ;
1212import 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 ();
Original file line number Diff line number Diff line change 88import lombok .Getter ;
99import lombok .NoArgsConstructor ;
1010import lombok .Setter ;
11+ import net .dv8tion .jda .api .entities .Guild ;
1112import 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}
You can’t perform that action at this time.
0 commit comments