slash roleypoly yay
This commit is contained in:
parent
02f5075d3b
commit
607d7e121c
22 changed files with 394 additions and 66 deletions
5
utils/const.go
Normal file
5
utils/const.go
Normal file
|
@ -0,0 +1,5 @@
|
|||
package utils
|
||||
|
||||
const (
|
||||
EmbedColor = 0x453e3d
|
||||
)
|
61
utils/emojis.go
Normal file
61
utils/emojis.go
Normal file
|
@ -0,0 +1,61 @@
|
|||
package utils
|
||||
|
||||
import (
|
||||
"math/rand/v2"
|
||||
|
||||
"git.sapphic.engineer/roleypoly/v4/types"
|
||||
)
|
||||
|
||||
var (
|
||||
AllEmojis = []types.Emoji{
|
||||
// Repeated for probability reasons
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext", ID: "785201823945850942"},
|
||||
{Name: "roleypolynext_420", ID: "785201824101564466"},
|
||||
{Name: "roleypolynext_ace", ID: "785201823497715723"},
|
||||
{Name: "roleypolynext_ace", ID: "785201823497715723"},
|
||||
{Name: "roleypolynext_ace", ID: "785201823497715723"},
|
||||
{Name: "roleypolynext_ace", ID: "785201823497715723"},
|
||||
{Name: "roleypolynext_ace", ID: "785201823497715723"},
|
||||
{Name: "roleypolynext_ace", ID: "785201823497715723"},
|
||||
{Name: "roleypolynext_anim", ID: "785203654125682698", Animated: true},
|
||||
{Name: "roleypolynext_bi", ID: "785201823584616500"},
|
||||
{Name: "roleypolynext_bi", ID: "785201823584616500"},
|
||||
{Name: "roleypolynext_bi", ID: "785201823584616500"},
|
||||
{Name: "roleypolynext_bi", ID: "785201823584616500"},
|
||||
{Name: "roleypolynext_bi", ID: "785201823584616500"},
|
||||
{Name: "roleypolynext_bi", ID: "785201823584616500"},
|
||||
{Name: "roleypolynext_lesbian", ID: "785201823627476993"},
|
||||
{Name: "roleypolynext_lesbian", ID: "785201823627476993"},
|
||||
{Name: "roleypolynext_lesbian", ID: "785201823627476993"},
|
||||
{Name: "roleypolynext_lesbian", ID: "785201823627476993"},
|
||||
{Name: "roleypolynext_lesbian", ID: "785201823627476993"},
|
||||
{Name: "roleypolynext_lny", ID: "785201824092651560"},
|
||||
{Name: "roleypolynext_newyear", ID: "785201824277200956"},
|
||||
{Name: "roleypolynext_pride", ID: "785201823501385749"},
|
||||
{Name: "roleypolynext_pride", ID: "785201823501385749"},
|
||||
{Name: "roleypolynext_pride", ID: "785201823501385749"},
|
||||
{Name: "roleypolynext_pride", ID: "785201823501385749"},
|
||||
{Name: "roleypolynext_pride", ID: "785201823501385749"},
|
||||
{Name: "roleypolynext_spectrum", ID: "785201823526682666"},
|
||||
{Name: "roleypolynext_trans", ID: "785201823967215617"},
|
||||
{Name: "roleypolynext_trans", ID: "785201823967215617"},
|
||||
{Name: "roleypolynext_trans", ID: "785201823967215617"},
|
||||
{Name: "roleypolynext_trans", ID: "785201823967215617"},
|
||||
{Name: "roleypolynext_trans", ID: "785201823967215617"},
|
||||
}
|
||||
)
|
||||
|
||||
func GetRandomEmoji() types.Emoji {
|
||||
idx := rand.UintN(uint(len(AllEmojis)))
|
||||
return AllEmojis[idx]
|
||||
}
|
12
utils/env.go
Normal file
12
utils/env.go
Normal file
|
@ -0,0 +1,12 @@
|
|||
package utils
|
||||
|
||||
import "os"
|
||||
|
||||
var (
|
||||
DiscordBotToken = os.Getenv("DISCORD_BOT_TOKEN")
|
||||
DiscordClientID = os.Getenv("DISCORD_CLIENT_ID")
|
||||
DiscordClientSecret = os.Getenv("DISCORD_CLIENT_SECRET")
|
||||
DiscordPublicKey = os.Getenv("DISCORD_PUBLIC_KEY")
|
||||
ListenAddr = Or(os.Getenv("LISTEN_ADDR"), ":8169")
|
||||
PublicBaseURL = os.Getenv("PUBLIC_BASE_URL")
|
||||
)
|
|
@ -12,3 +12,11 @@ func HeadTitle(text string) string {
|
|||
func J(parts ...string) string {
|
||||
return "/" + strings.Join(parts, "/")
|
||||
}
|
||||
|
||||
func Or(input, fallback string) string {
|
||||
if input == "" {
|
||||
return fallback
|
||||
}
|
||||
|
||||
return input
|
||||
}
|
||||
|
|
|
@ -15,3 +15,8 @@ func TestHeadTitle(t *testing.T) {
|
|||
func TestJ(t *testing.T) {
|
||||
assert.Equal(t, "/a/b/c", utils.J("a", "b", "c"))
|
||||
}
|
||||
|
||||
func TestOr(t *testing.T) {
|
||||
assert.Equal(t, "a", utils.Or("a", "b"))
|
||||
assert.Equal(t, "b", utils.Or("", "b"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue