diff --git a/client_test.go b/client_test.go index 5cd4dd9..34a24c1 100644 --- a/client_test.go +++ b/client_test.go @@ -1,15 +1,19 @@ package tg_test +import "git.fromouter.space/hamcha/tg" + // This example creates a basic client that connects to a broker and checks for message containing greetings. // If it finds a greeting message it will greet back the user (using the reply_to parameter) func ExampleCreateBrokerClient() { - CreateBrokerClient("localhost:7314", func(broker *Broker, message APIMessage) { + tg.CreateBrokerClient("localhost:7314", func(broker *tg.Broker, update tg.APIUpdate) { // Check if it's a text message - if message.Text != nil { + if update.Message != nil && update.Message.Text != nil { // Check that it's a greeting - if *(message.Text) == "hello" || *(message.Text) == "hi" { + if *(update.Message.Text) == "hello" || *(update.Message.Text) == "hi" { // Reply with a greeting! - broker.SendTextMessage(message.Chat, "Hello!", message.MessageID) + broker.SendTextMessage(update.Message.Chat, "Hello!", &tg.MessageOptions{ + ReplyID: &update.Message.MessageID, + }) } } })