Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/SevereCloud/vksdk
VK SDK for Golang готовая реализация основных функций VK API для языка Go.
# go mod init mymodulename
go get github.com/SevereCloud/vksdk@latest
package main
import (
"log"
"github.com/SevereCloud/vksdk/api"
"github.com/SevereCloud/vksdk/api/params"
"github.com/SevereCloud/vksdk/longpoll-bot"
"github.com/SevereCloud/vksdk/object"
)
func main() {
token := "<TOKEN>" // рекомендуется использовать os.Getenv("TOKEN")
vk := api.NewVK(token)
// Получаем информацию о группе
group, err := vk.GroupsGetByID(api.Params{})
if err != nil {
log.Fatal(err)
}
// Инициализируем longpoll
lp, err := longpoll.NewLongpoll(vk, group[0].ID)
if err != nil {
log.Fatal(err)
}
// Событие нового сообщения
lp.MessageNew(func(obj object.MessageNewObject, groupID int) {
log.Printf("%d: %s", obj.Message.PeerID, obj.Message.Text)
if obj.Message.Text == "ping" {
b := params.NewMessagesSendBuilder()
b.Message("pong")
b.RandomID(0)
b.PeerID(obj.Message.PeerID)
_, err := vk.MessagesSend(b.Params)
if err != nil {
log.Fatal(err)
}
}
})
// Запускаем Bots Longpoll
log.Println("Start longpoll")
if err := lp.Run(); err != nil {
log.Fatal(err)
}
}
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.