all repos — paprika @ 1eda21165d7e41e8fcf7a6f86431972b7ab37a75

go rewrite of taigabot

plugins/location/location.go (view raw)

 1package location
 2
 3import (
 4	"fmt"
 5
 6	"git.icyphox.sh/paprika/database"
 7)
 8
 9func SetLocation(loc, nick string) error {
10	err := database.DB.Set(
11		[]byte(fmt.Sprintf("loc/%s", nick)),
12		[]byte(loc),
13	)
14
15	return err
16}
17
18func GetLocation(nick string) (string, error) {
19	loc, err := database.DB.Get([]byte(fmt.Sprintf("loc/%s", nick)))
20	if err != nil {
21		return "", err
22	}
23
24	return string(loc), nil
25}