88 lines
3.7 KiB
Go
88 lines
3.7 KiB
Go
package commands
|
|
|
|
import (
|
|
"math/rand"
|
|
"strings"
|
|
"sync"
|
|
|
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
|
)
|
|
|
|
type BandnameCommand struct{}
|
|
|
|
var (
|
|
bandnameOnce sync.Once
|
|
randomArticle = []string{"the", ""}
|
|
randomAdj = []string{
|
|
"massive", "gargantuan", "scorched", "spiteful", "hateful", "deadly", "unwise", "ignorant",
|
|
"disgusting", "fearless", "honest", "fleeting", "bloody", "foolish", "unmoving", "black", "sick", "diseased",
|
|
"undead", "terrible", "unkind", "burning", "disgraced", "conflicted", "malicious", "unclean", "dirty", "unwashed",
|
|
"muddy", "sickly", "fearless", "moon-lit", "bony", "skeletal", "burning", "flaming", "savage", "wild", "gold",
|
|
"silver", "overgrown", "wild", "untamed", "ethereal", "ghostly", "haunted", "buried", "nuclear", "radioactive",
|
|
"mutated", "accidental", "selfish", "self-serving", "hypocritical", "wicked", "dastardly", "dreadful", "obscene",
|
|
"filthy", "vulgar", "vile", "worthless", "despicable", "cruel", "inhuman", "bloodthirsty", "vicious", "sadistic",
|
|
"diabolical", "abominable", "bitter", "", "", "", "", "", "", "", "", "", "",
|
|
}
|
|
randomNounPlural = []string{
|
|
"excuses", "clocks", "machines", "needles", "cultists", "slayers", "tyrants", "sound",
|
|
"vision", "sight", "taste", "smell", "trumpets", "wanderers", "sirens", "kings", "queens", "knights", "priests",
|
|
"liars", "ogres", "devils", "angels", "demons", "screams", "cries", "pigs", "fiends", "locusts", "worms", "ravens",
|
|
"vultures", "theives", "warnings", "bodies", "bones", "fingers", "hands", "mouths", "ears", "tongues", "eyes",
|
|
"magic", "men", "women", "promises", "confessions", "kingdoms", "kisses", "fists", "suns", "moons", "stars", "weight",
|
|
"altars", "tombstones", "monuments", "rain", "artifacts", "wizards", "warlocks", "barbarians", "druids", "warriors",
|
|
"monks", "diamonds", "hoard", "embers", "ashes", "swamps", "mountains", "plains", "rivers", "islands", "forests",
|
|
"mines", "dungeons", "tombs", "hills", "sons", "daughters", "spires", "pyramids", "crypts", "catacombs", "shrines",
|
|
"pits", "whores", "bandits", "stains", "delusion", "mistakes", "weapons", "chains", "pillars", "beasts", "creatures",
|
|
}
|
|
randomNounSingular = []string{
|
|
"reason", "famine", "disease", "death", "war", "hatred", "sadness", "fear", "rage",
|
|
"terror", "awe", "disgust", "pain", "suffering", "misery", "avarice", "malice", "lust", "filth", "dirt", "skin",
|
|
"control", "pride", "decay", "flesh", "bone", "stone", "metal", "iron", "steel", "burden", "memory", "sorrow", "fire",
|
|
"hell", "silence", "loathing", "contempt", "revulsion", "horror", "abomination", "devastation", "dismay", "dread",
|
|
"panic", "frenzy", "hysteria", "grief", "remorse", "woe", "anguish", "misery", "desolation", "misfortune", "mourning",
|
|
"despair", "lamentation", "faith", "eternity", "gloom", "melancholy", "regret", "distress",
|
|
}
|
|
)
|
|
|
|
func (b BandnameCommand) Name() string {
|
|
return "bandname"
|
|
}
|
|
|
|
func (b BandnameCommand) Help() string {
|
|
return "Generate a random metal band name"
|
|
}
|
|
|
|
func (b BandnameCommand) Execute(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
|
// Generate band name: [article] [adj] [plural noun] of [singular noun]
|
|
parts := []string{
|
|
randChoice(randomArticle),
|
|
randChoice(randomAdj),
|
|
randChoice(randomNounPlural),
|
|
"of",
|
|
randChoice(randomNounSingular),
|
|
}
|
|
// Remove empty strings and extra spaces
|
|
name := strings.Join(filterNonEmpty(parts), " ")
|
|
msg := tgbotapi.NewMessage(update.Message.Chat.ID, name)
|
|
msg.ParseMode = "Markdown"
|
|
bot.Send(msg)
|
|
}
|
|
|
|
func randChoice(arr []string) string {
|
|
return arr[rand.Intn(len(arr))]
|
|
}
|
|
|
|
func filterNonEmpty(arr []string) []string {
|
|
var out []string
|
|
for _, s := range arr {
|
|
if strings.TrimSpace(s) != "" {
|
|
out = append(out, s)
|
|
}
|
|
}
|
|
return out
|
|
}
|
|
|
|
func init() {
|
|
Register(BandnameCommand{})
|
|
}
|