friends/database/3ds/update_user_mii.go
Daniel López Guimaraes f9071cbed3
feat: Update modules and new Mii database fields
Add Mii profanity flag and character set to the 3DS friends database.
This in theory allows better support of Mii names that use characters
exclusive to the following regions: CHN, KOR or TWN.

Also get the Mii changed timestamp from the database, and not use the
current time for it.

Update the go modules to get the latest stability updates and use the
new fields on the Mii structure.
2024-05-20 21:55:56 +01:00

28 lines
762 B
Go

package database_3ds
import (
"github.com/PretendoNetwork/friends/database"
"github.com/PretendoNetwork/nex-go/v2/types"
friends_3ds_types "github.com/PretendoNetwork/nex-protocols-go/v2/friends-3ds/types"
)
// UpdateUserMii updates a user's mii
func UpdateUserMii(pid uint32, mii *friends_3ds_types.Mii) error {
_, err := database.Manager.Exec(`
INSERT INTO "3ds".user_data (pid, mii_name, mii_data, mii_changed)
VALUES ($1, $2, $3, $4)
ON CONFLICT (pid)
DO UPDATE SET
mii_name = $2,
mii_profanity = $3,
mii_character_set = $4,
mii_data = $5,
mii_changed = $6`, pid, mii.Name.Value, mii.ProfanityFlag.Value, mii.CharacterSet.Value, mii.MiiData.Value, types.NewDateTime(0).Now().Value())
if err != nil {
return err
}
return nil
}