all repos — paprika @ 8f52ee8c2bb889f5d5fdf2171d169e28b6f68081

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}