Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is diffent and how send message by id? #691

Closed
Kohinor46 opened this issue Jun 7, 2024 · 0 comments
Closed

What is diffent and how send message by id? #691

Kohinor46 opened this issue Jun 7, 2024 · 0 comments

Comments

@Kohinor46
Copy link

HI
Can anybody help me?
When I send message like than it's work

func main() {
	b, err := tele.NewBot(tele.Settings{
		Token:  token,
		Poller: &tele.LongPoller{Timeout: 10 * time.Second},
	})
	if err != nil {
		return
	}
	//send_to_user(6828712208)
	_,err=b.Send(&tele.User{ID: 6828712208},"HI")
	if err!=nil{
		log.Fatal("Ошибка отправки уведомления: ", err)
	}
}
Снимок экрана 2024-06-07 в 16 13 28 But if i use funcion it's panic:
func main() {
	b, err := tele.NewBot(tele.Settings{
		Token:  token,
		Poller: &tele.LongPoller{Timeout: 10 * time.Second},
	})
	if err != nil {
		return
	}
	send_to_user(6828712208)
	_,err=b.Send(&tele.User{ID: 6828712208},"HI")
	if err!=nil{
		log.Fatal("Ошибка отправки уведомления: ", err)
	}
}

func send_to_user(id int64){
	_,err:=b.Send(&tele.User{ID: id},"NEN")
	if err!=nil{
		log.Fatal("Ошибка отправки уведомления: ", err)
	}
}
Снимок экрана 2024-06-07 в 16 13 13 What's the difference between these two methods? And how to send a message correctly if i have id?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant