@@ -443,7 +443,7 @@ public function addComponent(Component $component): self
443
443
$ component = ActionRow::new ()->addComponent ($ component );
444
444
}
445
445
446
- if ($ this ->flags & Message::FLAG_IS_V2_COMPONENTS ) {
446
+ if ($ this ->flags & Message::FLAG_IS_COMPONENTS_V2 ) {
447
447
$ this ->enforceV2Limits ();
448
448
} else {
449
449
$ this ->enforceV1Limits ($ component );
@@ -775,27 +775,107 @@ public function getPoll(): ?Poll
775
775
}
776
776
777
777
/**
778
- * Sets or unsets the V2 components flag for the message.
778
+ * Sets or unsets the SUPPRESS_EMBEDS flag for the message.
779
+ *
780
+ * @since 10.19.0
781
+ *
782
+ * @param bool $enable
783
+ * @return self
784
+ */
785
+ public function setSuppressEmbedsFlag (bool $ enable = true ): self
786
+ {
787
+ if ($ enable ) {
788
+ if (! ($ this ->flags & Message::FLAG_SUPPRESS_EMBEDS )) {
789
+ $ this ->flags |= Message::FLAG_SUPPRESS_EMBEDS ;
790
+ }
791
+ } elseif ($ this ->flags & Message::FLAG_SUPPRESS_EMBEDS ) {
792
+ $ this ->flags &= ~Message::FLAG_SUPPRESS_EMBEDS ;
793
+ }
794
+
795
+ return $ this ;
796
+ }
797
+
798
+ /**
799
+ * Sets or unsets the SUPPRESS_NOTIFICATIONS flag for the message.
800
+ *
801
+ * @since 10.19.0
802
+ *
803
+ * @param bool $enable
804
+ * @return self
805
+ */
806
+ public function setSuppressNotificationsFlag (bool $ enable = true ): self
807
+ {
808
+ if ($ enable ) {
809
+ if (! ($ this ->flags & Message::FLAG_SUPPRESS_NOTIFICATIONS )) {
810
+ $ this ->flags |= Message::FLAG_SUPPRESS_NOTIFICATIONS ;
811
+ }
812
+ } elseif ($ this ->flags & Message::FLAG_SUPPRESS_NOTIFICATIONS ) {
813
+ $ this ->flags &= ~Message::FLAG_SUPPRESS_NOTIFICATIONS ;
814
+ }
815
+
816
+ return $ this ;
817
+ }
818
+
819
+ /**
820
+ * Sets or unsets the IS_VOICE_MESSAGE flag for the message.
821
+ *
822
+ * @since 10.19.0
823
+ *
824
+ * @param bool $enable
825
+ * @return self
826
+ */
827
+ public function setIsVoiceMessageFlag (bool $ enable = true ): self
828
+ {
829
+ if ($ enable ) {
830
+ if (! ($ this ->flags & Message::FLAG_IS_VOICE_MESSAGE )) {
831
+ $ this ->flags |= Message::FLAG_IS_VOICE_MESSAGE ;
832
+ }
833
+ } elseif ($ this ->flags & Message::FLAG_IS_VOICE_MESSAGE ) {
834
+ $ this ->flags &= ~Message::FLAG_IS_VOICE_MESSAGE ;
835
+ }
836
+
837
+ return $ this ;
838
+ }
839
+
840
+ /**
841
+ * Sets or unsets the IS_COMPONENTS_V2 flag for the message.
842
+ * Once a message has been sent with this flag, it can't be removed from that message.
843
+ *
844
+ * @deprecated 10.19.0 use `MessageBuilder::setIsComponentsV2Flag()` instead.
779
845
*
780
846
* @param bool $enable
781
847
* @return self
782
848
*/
783
849
public function setV2Flag (bool $ enable = true ): self
850
+ {
851
+ return $ this ->setIsComponentsV2Flag ($ enable );
852
+ }
853
+
854
+ /**
855
+ * Sets or unsets the IS_COMPONENTS_V2 flag for the message.
856
+ * Once a message has been sent with this flag, it can't be removed from that message.
857
+ *
858
+ * @since 10.19.0
859
+ *
860
+ * @param bool $enable
861
+ * @return self
862
+ */
863
+ public function setIsComponentsV2Flag (bool $ enable = true ): self
784
864
{
785
865
if ($ enable ) {
786
- if (! ($ this ->flags & Message::FLAG_IS_V2_COMPONENTS )) {
787
- $ this ->flags |= Message::FLAG_IS_V2_COMPONENTS ;
866
+ if (! ($ this ->flags & Message::FLAG_IS_COMPONENTS_V2 )) {
867
+ $ this ->flags |= Message::FLAG_IS_COMPONENTS_V2 ;
788
868
}
789
- } elseif ($ this ->flags & Message::FLAG_IS_V2_COMPONENTS ) {
790
- $ this ->flags &= ~Message::FLAG_IS_V2_COMPONENTS ;
869
+ } elseif ($ this ->flags & Message::FLAG_IS_COMPONENTS_V2 ) {
870
+ $ this ->flags &= ~Message::FLAG_IS_COMPONENTS_V2 ;
791
871
}
792
872
793
873
return $ this ;
794
874
}
795
875
796
876
/**
797
877
* Sets the flags of the message.
798
- * Only works for some message types and some message flags .
878
+ * Only `SUPPRESS_EMBEDS`, `SUPPRESS_NOTIFICATIONS`, `IS_VOICE_MESSAGE`, and `IS_COMPONENTS_V2` can be set for the Create Message endpoint .
799
879
*
800
880
* @param int $flags
801
881
*
@@ -912,7 +992,7 @@ public function jsonSerialize(): array
912
992
$ body = [];
913
993
914
994
if (isset ($ this ->content )) {
915
- if (! ($ this ->flags & Message::FLAG_IS_V2_COMPONENTS )) {
995
+ if (! ($ this ->flags & Message::FLAG_IS_COMPONENTS_V2 )) {
916
996
$ body ['content ' ] = $ this ->content ;
917
997
$ empty = false ;
918
998
}
@@ -935,7 +1015,7 @@ public function jsonSerialize(): array
935
1015
}
936
1016
937
1017
if (isset ($ this ->embeds )) {
938
- if (! ($ this ->flags & Message::FLAG_IS_V2_COMPONENTS )) {
1018
+ if (! ($ this ->flags & Message::FLAG_IS_COMPONENTS_V2 )) {
939
1019
$ body ['embeds ' ] = $ this ->embeds ;
940
1020
$ empty = false ;
941
1021
}
@@ -968,14 +1048,14 @@ public function jsonSerialize(): array
968
1048
}
969
1049
970
1050
if ($ this ->sticker_ids ) {
971
- if (! ($ this ->flags & Message::FLAG_IS_V2_COMPONENTS )) {
1051
+ if (! ($ this ->flags & Message::FLAG_IS_COMPONENTS_V2 )) {
972
1052
$ body ['sticker_ids ' ] = $ this ->sticker_ids ;
973
1053
$ empty = false ;
974
1054
}
975
1055
}
976
1056
977
1057
if (! empty ($ this ->files )) {
978
- if (! ($ this ->flags & Message::FLAG_IS_V2_COMPONENTS )) {
1058
+ if (! ($ this ->flags & Message::FLAG_IS_COMPONENTS_V2 )) {
979
1059
$ empty = false ;
980
1060
}
981
1061
}
@@ -986,7 +1066,7 @@ public function jsonSerialize(): array
986
1066
}
987
1067
988
1068
if (isset ($ this ->poll )) {
989
- if (! ($ this ->flags & Message::FLAG_IS_V2_COMPONENTS )) {
1069
+ if (! ($ this ->flags & Message::FLAG_IS_COMPONENTS_V2 )) {
990
1070
$ body ['poll ' ] = $ this ->poll ;
991
1071
$ empty = false ;
992
1072
}
0 commit comments