Skip to content

Commit 17b8f8e

Browse files
committed
Add getter methods for LazyEmbed
1 parent 5bd2c16 commit 17b8f8e

File tree

1 file changed

+157
-38
lines changed

1 file changed

+157
-38
lines changed

src/main/java/xyz/srnyx/lazylibrary/LazyEmbed.java

Lines changed: 157 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,163 @@ public MessageEmbed build(@NotNull LazyLibrary library) {
467467
return builder.build();
468468
}
469469

470+
/**
471+
* Get {@link #color}
472+
*
473+
* @return {@link #color}
474+
*/
475+
public int getColor() {
476+
return color;
477+
}
478+
479+
/**
480+
* Get {@link #authorName}
481+
*
482+
* @return {@link #authorName}
483+
*/
484+
@Nullable
485+
public String getAuthorName() {
486+
return authorName;
487+
}
488+
489+
/**
490+
* Get {@link #authorUrl}
491+
*
492+
* @return {@link #authorUrl}
493+
*/
494+
@Nullable
495+
public String getAuthorUrl() {
496+
return authorUrl;
497+
}
498+
499+
/**
500+
* Get {@link #authorIcon}
501+
*
502+
* @return {@link #authorIcon}
503+
*/
504+
@Nullable
505+
public String getAuthorIcon() {
506+
return authorIcon;
507+
}
508+
509+
/**
510+
* Get {@link #titleText}
511+
*
512+
* @return {@link #titleText}
513+
*/
514+
@Nullable
515+
public String getTitleText() {
516+
return titleText;
517+
}
518+
519+
/**
520+
* Get {@link #titleUrl}
521+
*
522+
* @return {@link #titleUrl}
523+
*/
524+
@Nullable
525+
public String getTitleUrl() {
526+
return titleUrl;
527+
}
528+
529+
/**
530+
* Get {@link #description}
531+
*
532+
* @return {@link #description}
533+
*/
534+
@Nullable
535+
public String getDescription() {
536+
return description;
537+
}
538+
539+
/**
540+
* Get {@link #thumbnail}
541+
*
542+
* @return {@link #thumbnail}
543+
*/
544+
@Nullable
545+
public String getThumbnail() {
546+
return thumbnail;
547+
}
548+
549+
/**
550+
* Get {@link #image}
551+
*
552+
* @return {@link #image}
553+
*/
554+
@Nullable
555+
public String getImage() {
556+
return image;
557+
}
558+
559+
/**
560+
* Returns an unmodifiable list of all fields in the embed
561+
*
562+
* @return an unmodifiable list of all fields in the embed
563+
*/
564+
@NotNull
565+
public List<MessageEmbed.Field> getFields() {
566+
return Collections.unmodifiableList(fields);
567+
}
568+
569+
/**
570+
* Returns a field from the embed by its name
571+
*
572+
* @param name the name of the field
573+
*
574+
* @return the field, or {@link Optional#empty() empty} if not found
575+
*/
576+
@NotNull
577+
public Optional<MessageEmbed.Field> getField(@NotNull String name) {
578+
for (final MessageEmbed.Field field : fields) {
579+
final String fieldName = field.getName();
580+
if (fieldName != null && fieldName.equals(name)) return Optional.of(field);
581+
}
582+
return Optional.empty();
583+
}
584+
585+
/**
586+
* Returns the value of a field from the embed by its name
587+
*
588+
* @param name the name of the field
589+
*
590+
* @return the value of the field, or {@link Optional#empty() empty} if not found
591+
*/
592+
@NotNull
593+
public Optional<String> getFieldValue(@NotNull String name) {
594+
return getField(name).map(MessageEmbed.Field::getValue);
595+
}
596+
597+
/**
598+
* Get {@link #footerText}
599+
*
600+
* @return {@link #footerText}
601+
*/
602+
@Nullable
603+
public String getFooterText() {
604+
return footerText;
605+
}
606+
607+
/**
608+
* Get {@link #footerIcon}
609+
*
610+
* @return {@link #footerIcon}
611+
*/
612+
@Nullable
613+
public String getFooterIcon() {
614+
return footerIcon;
615+
}
616+
617+
/**
618+
* Get {@link #timestamp}
619+
*
620+
* @return {@link #timestamp}
621+
*/
622+
@Nullable
623+
public TemporalAccessor getTimestamp() {
624+
return timestamp;
625+
}
626+
470627
/**
471628
* Sets the color of the embed
472629
*
@@ -730,44 +887,6 @@ public final LazyEmbed gridFields(@NotNull Map<String, String>... rows) {
730887
return gridFields(Arrays.asList(rows));
731888
}
732889

733-
/**
734-
* Returns an unmodifiable list of all fields in the embed
735-
*
736-
* @return an unmodifiable list of all fields in the embed
737-
*/
738-
@NotNull
739-
public List<MessageEmbed.Field> getFields() {
740-
return Collections.unmodifiableList(fields);
741-
}
742-
743-
/**
744-
* Returns a field from the embed by its name
745-
*
746-
* @param name the name of the field
747-
*
748-
* @return the field, or {@link Optional#empty() empty} if not found
749-
*/
750-
@NotNull
751-
public Optional<MessageEmbed.Field> getField(@NotNull String name) {
752-
for (final MessageEmbed.Field field : fields) {
753-
final String fieldName = field.getName();
754-
if (fieldName != null && fieldName.equals(name)) return Optional.of(field);
755-
}
756-
return Optional.empty();
757-
}
758-
759-
/**
760-
* Returns the value of a field from the embed by its name
761-
*
762-
* @param name the name of the field
763-
*
764-
* @return the value of the field, or {@link Optional#empty() empty} if not found
765-
*/
766-
@NotNull
767-
public Optional<String> getFieldValue(@NotNull String name) {
768-
return getField(name).map(MessageEmbed.Field::getValue);
769-
}
770-
771890
/**
772891
* Clears all fields from the embed
773892
*

0 commit comments

Comments
 (0)