53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
package plugins
|
||
|
||
import (
|
||
"strings"
|
||
"ymgb/database"
|
||
|
||
"git.nix13.pw/scuroneko/laniakea"
|
||
)
|
||
|
||
func RegisterFun() *laniakea.Plugin[database.Context] {
|
||
p := laniakea.NewPlugin[database.Context]("Fun")
|
||
p.NewCommand(beautyFont, "bf")
|
||
p.NewCommand(beautyFontHeart, "bfh")
|
||
return p
|
||
}
|
||
|
||
var ligatures = map[string]string{
|
||
"A": "𝐴", "B": "𝐵", "C": "𝐶", "D": "𝐷", "E": "𝐸", "F": "𝐹", "G": "𝐺", "H": "𝐻", "I": "𝐼", "J": "𝐽",
|
||
"K": "𝐾", "L": "𝐿", "M": "𝑀", "N": "𝑁", "O": "𝑂", "P": "𝑃", "Q": "𝑄", "R": "𝑅", "S": "𝑆", "T": "𝑇",
|
||
"U": "𝑈", "V": "𝑉", "W": "𝑊", "X": "𝑋", "Y": "𝑌", "Z": "𝑍",
|
||
"a": "𝑎", "b": "𝑏", "c": "𝑐", "d": "𝑑", "e": "𝑒", "f": "𝑓", "g": "𝑔", "h": "𝘩", "i": "𝑖", "j": "𝑗",
|
||
"k": "𝑘", "l": "𝑙", "m": "𝑚", "n": "𝑛", "o": "𝑜", "p": "𝑝", "q": "𝑞", "r": "𝑟", "s": "𝑠", "t": "𝑡", "u": "𝑢",
|
||
"v": "𝑣", "w": "𝑤", "x": "𝑥", "y": "𝑦", "z": "𝑧",
|
||
}
|
||
|
||
func beautyFont(ctx *laniakea.MsgContext, _ *database.Context) {
|
||
m := strings.Join(ctx.Args, " ")
|
||
out := ""
|
||
for _, r := range m {
|
||
beautyL, ok := ligatures[string(r)]
|
||
if !ok {
|
||
out += string(r)
|
||
} else {
|
||
out += beautyL
|
||
}
|
||
}
|
||
ctx.Answer(out)
|
||
}
|
||
|
||
func beautyFontHeart(ctx *laniakea.MsgContext, _ *database.Context) {
|
||
m := strings.Join(ctx.Args, " ")
|
||
out := ""
|
||
for _, r := range m {
|
||
beautyL, ok := ligatures[string(r)]
|
||
if !ok {
|
||
out += string(r)
|
||
} else {
|
||
out += beautyL
|
||
}
|
||
}
|
||
ctx.Answer(out + "♡")
|
||
}
|