genshin

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 10 Imported by: 0

README

Genshingo

A wrapper to fetch your genshin user data!

Prerequisites

  • Go
  • HoyoLab Cookies - You can get you hoyolab cookies by visiting hoyolab and logging in. After you login Ctrl + Shift + I then click on the Console Tab and then type document.cookie and thats the cookie!

Quick Start

Import the genshingo package first.

package main

import (
	genshin "github.com/Nota30/genshingo"
)

func main() {
	init := genshin.Init{
		Cookie: "cookie goes here",
		Server: "os",
	}

	user, err := init.GetUserData("uid")
	if err != nil {
		println(err)
	}

	println(user.Data.Info.Nickname)
}

Issues

  • If you don't get a users data that means they haven't set their profile to public in hoyolab. You can make it public by going to hoyolab settings.
  • Currently only works with the os servers so the cn servers won't work. Will be added in a later release maybe?

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Init

type Init struct {
	Cookie string
	Server string `default:"cn"`
}

func (Init) GetUserData

func (init Init) GetUserData(uid string) (User, error)

type User

type User struct {
	Retcode int    `json:"retcode"`
	Message string `json:"message"`
	Data    data   `json:"data"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL