Skip to content

barbarbar338/go-lanyard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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