From f83333d9d3956003e96ec8543f99119dc3872c64 Mon Sep 17 00:00:00 2001 From: bdnugget Date: Wed, 28 May 2025 12:55:18 +0200 Subject: [PATCH] Bandname command added --- commands/bandname.go | 87 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 commands/bandname.go diff --git a/commands/bandname.go b/commands/bandname.go new file mode 100644 index 0000000..8bde4eb --- /dev/null +++ b/commands/bandname.go @@ -0,0 +1,87 @@ +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{}) +}