Answer the question
In order to leave comments, you need to log in
Golang vksdk, data type problem, how to solve?
Good afternoon/evening, I have a problem with deleting a message through the SevereCloud/vksdk library.
lp.MessageNew(func(_ context.Context, obj events.MessageNewObject) {
var admins = 380236476
var event = 2000000001
if obj.Message.FromID == admins{
if obj.Message.PeerID == event {
b := params.NewMessagesDeleteBuilder()
b.DeleteForAll(true)
b.MessageIDs(obj.Message.ID)
_, err := vk.MessagesDelete(b.Params)
if err != nil {
log.Fatal(err)
}
}
}
})
./main.go:68:18: cannot use test (type int) as type []int in argument to b.MessageIDs
Answer the question
In order to leave comments, you need to log in
instead of b.MessageIDs(obj.Message.ID) write b.MessageIDs([]int{obj.Message.ID})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question