Skip to content

Latest commit

 

History

History
102 lines (71 loc) · 2.59 KB

README.md

File metadata and controls

102 lines (71 loc) · 2.59 KB

stars license supportServer forks issues

🚀 Go Lanyard

Use Lanyard API easily in your Go app!

📦 Installation

  • Initialize your project (go mod init example.com/example)
  • Add package (go get github.com/barbarbar338/go-lanyard)

🤓 Usage

Using without websocket:

package main

import (
	"fmt"
)

func main() {
	//                  User ID here 👇
	res := FetchUser("331846231514939392")

	// handle presence data here
	fmt.Println(res.Data.DiscordStatus)
}

Using with websocket:

package main

import (
	"fmt"
	"os"
	"os/signal"
	"syscall"

    "github.com/barbarbar338/go-lanyard"
)

func main() {
    //                       User ID here 👇
	ws := lanyard.CreateWS("331846231514939392", func(data *LanyardData) {

        // handle presence data here
		fmt.Println(data.DiscordStatus)
	})

	sc := make(chan os.Signal, 1)
	signal.Notify(
		sc,
		syscall.SIGINT,
		syscall.SIGTERM,
		os.Interrupt,
	)
	<-sc

	fmt.Println("Closing client.")

    // destroy ws before exit
	ws.Destroy()
}

📄 License

Copyright © 2021 Barış DEMİRCİ.

Distributed under the GPL-3.0 License. See LICENSE for more information.

🧦 Contributing

Feel free to use GitHub's features.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/my-feature)
  3. Commit your Changes (git commit -m 'my awesome feature my-feature')
  4. Push to the Branch (git push origin feature/my-feature)
  5. Open a Pull Request

🔥 Show your support

Give a ⭐️ if this project helped you!

📞 Contact

✨ Special Thanks