aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorPinapelz <donaldshan1@outlook.com>2023-04-13 14:27:34 -0700
committerPinapelz <donaldshan1@outlook.com>2023-04-13 14:27:34 -0700
commit14b301e0bc9c1cf578d05fc3e5e4f2dfbfa8e750 (patch)
treec8731a18fe203f06c99a6638132351f601d7994c /src/main
parent3f8448563aa4ff82cfea80d626257c3921199489 (diff)
Fix bug where if channel doesn't have an english name on holodex it is printed as null in chat
The Japanese name will be used if an English name is unavailable
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/builders/ScheduleMessageBuilder.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/builders/ScheduleMessageBuilder.java b/src/main/java/builders/ScheduleMessageBuilder.java
index 9dd77bf..eb47118 100644
--- a/src/main/java/builders/ScheduleMessageBuilder.java
+++ b/src/main/java/builders/ScheduleMessageBuilder.java
@@ -23,7 +23,7 @@ public class ScheduleMessageBuilder {
String pfp = videos.get(0).channel.photo;
EmbedBuilder messageBuilder = new EmbedBuilder()
.setThumbnail(pfp)
- .setTitle("Upcoming and Live Streams for " + videos.get(0).channel.org)
+ .setTitle("Upcoming and Live Streams")
.setDescription("The schedule you asked for")
.setColor(new Color(COLOR))
.setTimestamp(OffsetDateTime.now());
@@ -36,6 +36,9 @@ public class ScheduleMessageBuilder {
unixTimeStr = "LIVE \uD83D\uDD34";
}
String titleText = video.channel.english_name + " - " + unixTimeStr;
+ if (video.channel.english_name.equals(null)){
+ titleText = video.channel.name + " - " + unixTimeStr;
+ }
String videoURL = "https://www.youtube.com/watch?v=" + video.id;
messageBuilder.addField(titleText, "["+video.title+"]"+"("+videoURL+")", false);
}
@@ -46,10 +49,14 @@ public class ScheduleMessageBuilder {
public ArrayList<MessageEmbed> getUpcomingLiveListMessages(List<SimpleVideo> simpleVideos){
ArrayList<MessageEmbed> messageEmbeds = new ArrayList<>();
for (SimpleVideo video : simpleVideos){
- String title = video.channel.english_name + " is streaming soon! ⏰";
+ String channel_name = video.channel.english_name;
+ if (channel_name.equals(null)){
+ channel_name = video.channel.name;
+ }
+ String title = channel_name + " is streaming soon! ⏰";
String fieldTitle = "Scheduled Start Time";
if (video.status.equals("live")){
- title = video.channel.english_name + " is live! \uD83D\uDD34";
+ title = channel_name + " is live! \uD83D\uDD34";
fieldTitle = "Live Since";
}
String gmtStartTime = video.start_scheduled;
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage