如何在golang中发送用户左电报消息

I'm writing a telegram bot with golang programming language. How can i send a message when a user left or join? I try this

if (message.UserJoined == true){
        bot.SendMessage(message.Chat, "" ,nil)
    }

but it does not work and I get this error

./main.go:291: invalid operation: message.UserJoined == true (mismatched types telebot.User and bool)

In this case because you are trying to compare two different types it is failing. However, I'm not sure which API you are using or if you are using your own so I'm not sure what message.UserJoined is supposed to represent. However I would think based on your apparent use case that you should be comparing it to nil instead. i.e. use if message.UserJoined != nil {}

UserJoined is a User Struct defined:

// UserJoined might be the Bot itself.

UserJoined User `json:"new_chat_participant"`

Found Here

It does not match a bool

Without seeing the rest of the code, I cant tell what you are testing the message for.

I beileve what your needing is something like

if message.UserJoined.ID > 0 {
    //Dosomething 
}