picker getting closer....

This commit is contained in:
41666 2025-04-07 22:07:29 -07:00
parent 023f1651f8
commit 537b430224
20 changed files with 179 additions and 100 deletions

View file

@ -10,20 +10,23 @@ import (
var (
CategoryMulti = types.Category{
ID: "multi",
Name: "Roles",
Name: "Multi",
Type: types.CategoryMultiple,
Roles: []string{RoleWithDarkColor.ID, RoleWithLightColor.ID, RoleWithoutColor.ID},
}
CategorySingle = types.Category{
ID: "single",
Name: "Roles",
Name: "Single",
Type: types.CategorySingle,
Roles: []string{RoleWithDarkColor.ID, RoleWithLightColor.ID, RoleWithoutColor.ID},
}
)
func Category(base types.Category) *types.Category {
func Category(base types.Category, name string) *types.Category {
base.ID = fmt.Sprintf("%s-%d", base.ID, rand.Uint32())
if name != "" {
base.Name = name
}
return &base
}

View file

@ -9,6 +9,8 @@ var (
Color: 0xa20000,
Permissions: 0,
Position: 10,
Safe: true,
Selected: true,
}
RoleWithDarkMediumColor = types.Role{
ID: "dark-medium-color",
@ -16,6 +18,7 @@ var (
Color: 0xeb5e4b,
Permissions: 0,
Position: 11,
Safe: true,
}
RoleWithLightMediumColor = types.Role{
ID: "light-medium-color",
@ -23,6 +26,8 @@ var (
Color: 0xfa8373,
Permissions: 0,
Position: 11,
Safe: true,
Selected: true,
}
RoleWithLightColor = types.Role{
ID: "light-color",
@ -30,6 +35,7 @@ var (
Color: 0xffaa88,
Permissions: 0,
Position: 12,
Safe: true,
}
RoleWithoutColor = types.Role{
ID: "without-color",
@ -37,6 +43,24 @@ var (
Color: 0x000000,
Permissions: 0,
Position: 11,
Safe: true,
}
RoleUnsafe = types.Role{
ID: "unsafe",
Name: "unsafe",
Color: 0x00c200,
Permissions: 0,
Position: 11,
Safe: false,
}
RoleUnsafePicked = types.Role{
ID: "unsafe-picked",
Name: "picked",
Color: 0x0000c2,
Permissions: 0,
Position: 11,
Safe: false,
Selected: true,
}
//TODO: role with admin (bad)
//TODO: role with manage roles (bad)

View file

@ -8,4 +8,8 @@ type Role struct {
UnicodeEmoji string `json:"unicode_emoji"` // unused, future?
Permissions uint64 `json:"permissions,string"`
Position uint8 `json:"position"`
// Not Discord; used internally
Selected bool `json:"-"`
Safe bool `json:"-"`
}