@@ -73,7 +73,7 @@ func TestSendWithMessage(t *testing.T) {
7373 bot , _ := getBot (t )
7474
7575 msg := NewMessage (ChatID , "A test message from the test library in telegram-bot-api" )
76- msg .ParseMode = "markdown"
76+ msg .ParseMode = ModeMarkdown
7777 _ , err := bot .Send (msg )
7878
7979 if err != nil {
@@ -104,6 +104,26 @@ func TestSendWithMessageForward(t *testing.T) {
104104 }
105105}
106106
107+ func TestCopyMessage (t * testing.T ) {
108+ bot , _ := getBot (t )
109+
110+ msg := NewMessage (ChatID , "A test message from the test library in telegram-bot-api" )
111+ message , err := bot .Send (msg )
112+ if err != nil {
113+ t .Error (err )
114+ }
115+
116+ copyMessageConfig := NewCopyMessage (SupergroupChatID , message .Chat .ID , message .MessageID )
117+ messageID , err := bot .CopyMessage (copyMessageConfig )
118+ if err != nil {
119+ t .Error (err )
120+ }
121+
122+ if messageID .MessageID == message .MessageID {
123+ t .Error ("copied message ID was the same as original message" )
124+ }
125+ }
126+
107127func TestSendWithNewPhoto (t * testing.T ) {
108128 bot , _ := getBot (t )
109129
@@ -724,7 +744,7 @@ func TestDeleteMessage(t *testing.T) {
724744 bot , _ := getBot (t )
725745
726746 msg := NewMessage (ChatID , "A test message from the test library in telegram-bot-api" )
727- msg .ParseMode = "markdown"
747+ msg .ParseMode = ModeMarkdown
728748 message , _ := bot .Send (msg )
729749
730750 deleteMessageConfig := DeleteMessageConfig {
@@ -742,7 +762,7 @@ func TestPinChatMessage(t *testing.T) {
742762 bot , _ := getBot (t )
743763
744764 msg := NewMessage (SupergroupChatID , "A test message from the test library in telegram-bot-api" )
745- msg .ParseMode = "markdown"
765+ msg .ParseMode = ModeMarkdown
746766 message , _ := bot .Send (msg )
747767
748768 pinChatMessageConfig := PinChatMessageConfig {
@@ -761,7 +781,7 @@ func TestUnpinChatMessage(t *testing.T) {
761781 bot , _ := getBot (t )
762782
763783 msg := NewMessage (SupergroupChatID , "A test message from the test library in telegram-bot-api" )
764- msg .ParseMode = "markdown"
784+ msg .ParseMode = ModeMarkdown
765785 message , _ := bot .Send (msg )
766786
767787 // We need pin message to unpin something
@@ -776,14 +796,41 @@ func TestUnpinChatMessage(t *testing.T) {
776796 }
777797
778798 unpinChatMessageConfig := UnpinChatMessageConfig {
779- ChatID : message .Chat .ID ,
799+ ChatID : message .Chat .ID ,
800+ MessageID : message .MessageID ,
780801 }
781802
782803 if _ , err := bot .Request (unpinChatMessageConfig ); err != nil {
783804 t .Error (err )
784805 }
785806}
786807
808+ func TestUnpinAllChatMessages (t * testing.T ) {
809+ bot , _ := getBot (t )
810+
811+ msg := NewMessage (SupergroupChatID , "A test message from the test library in telegram-bot-api" )
812+ msg .ParseMode = ModeMarkdown
813+ message , _ := bot .Send (msg )
814+
815+ pinChatMessageConfig := PinChatMessageConfig {
816+ ChatID : message .Chat .ID ,
817+ MessageID : message .MessageID ,
818+ DisableNotification : true ,
819+ }
820+
821+ if _ , err := bot .Request (pinChatMessageConfig ); err != nil {
822+ t .Error (err )
823+ }
824+
825+ unpinAllChatMessagesConfig := UnpinAllChatMessagesConfig {
826+ ChatID : message .Chat .ID ,
827+ }
828+
829+ if _ , err := bot .Request (unpinAllChatMessagesConfig ); err != nil {
830+ t .Error (err )
831+ }
832+ }
833+
787834func TestPolls (t * testing.T ) {
788835 bot , _ := getBot (t )
789836
0 commit comments