From 095514d95d537bfcd540b60edac9a08d6890267f Mon Sep 17 00:00:00 2001 From: Kami Date: Sun, 2 Feb 2025 00:59:53 +0100 Subject: [PATCH] Added howling dictionary with conditional selection --- cmd_common/common_commands.py | 21 +++++----- dictionary/howl_replies.json | 79 +++++++++++++++++++++++++++++++++++ permissions.json | 2 +- 3 files changed, 90 insertions(+), 12 deletions(-) create mode 100644 dictionary/howl_replies.json diff --git a/cmd_common/common_commands.py b/cmd_common/common_commands.py index cf0175f..7b9432c 100644 --- a/cmd_common/common_commands.py +++ b/cmd_common/common_commands.py @@ -6,19 +6,18 @@ import globals def howl(username: str) -> str: """ - Return a random howl message (0-100). - - If 0%: a fail message. - - If 100%: a perfect success. - - Otherwise: normal message with the random %. + Generates a howl response based on a random percentage. + Uses a dictionary to allow flexible, randomized responses. """ howl_percentage = random.randint(0, 100) - - if howl_percentage == 0: - return f"Uh oh, {username} failed with a miserable 0% howl ..." - elif howl_percentage == 100: - return f"Wow, {username} performed a perfect 100% howl!" - else: - return f"{username} howled at {howl_percentage}%!" + + # Round percentage down to nearest 10 (except 0 and 100) + rounded_percentage = 0 if howl_percentage == 0 else 100 if howl_percentage == 100 else (howl_percentage // 10) * 10 + + # Fetch a random response from the dictionary + response = utility.get_random_reply("howl_replies", str(rounded_percentage), username=username, howl_percentage=howl_percentage) + + return response def ping() -> str: """ diff --git a/dictionary/howl_replies.json b/dictionary/howl_replies.json new file mode 100644 index 0000000..2829538 --- /dev/null +++ b/dictionary/howl_replies.json @@ -0,0 +1,79 @@ +{ + "0": [ + "Uh oh, {username} failed with a miserable {howl_percentage}% howl ...", + "Yikes, {username}'s howl didn't even register. A complete failure!", + "{username} tried to howl, but it came out as a pathetic whisper...", + "Not a single sound from {username}... {howl_percentage}% howl detected!", + "{username} choked on their howl and ended up coughing instead!" + ], + "10": [ + "{username} let out a weak {howl_percentage}% howl... barely noticeable.", + "{username} howled at {howl_percentage}%, but it sounded more like a sigh.", + "That {howl_percentage}% howl was more of a breath than a call, {username}...", + "{username} tried to howl at {howl_percentage}%, but the wind drowned it out.", + "A faint {howl_percentage}% howl from {username}. A whisper in the night!" + ], + "20": [ + "{username} howled at {howl_percentage}%! Not great, but not silent!", + "A shaky {howl_percentage}% howl from {username}. At least it's audible!", + "That {howl_percentage}% howl had some spirit, {username}!", + "{username} let out a {howl_percentage}% howl. Could use more power!", + "At {howl_percentage}%, {username}'s howl barely stirred the trees." + ], + "30": [ + "{username} howled at {howl_percentage}%! A decent attempt!", + "A soft but clear {howl_percentage}% howl from {username}.", + "{username} gave a {howl_percentage}% howl! The wolves tilt their heads.", + "That {howl_percentage}% howl had some potential, {username}!", + "{username}'s {howl_percentage}% howl echoed weakly, but it carried." + ], + "40": [ + "{username} howled at {howl_percentage}%! Getting a bit of force behind it!", + "A sturdy {howl_percentage}% howl from {username}. The pack listens.", + "{username}'s {howl_percentage}% howl carried through the trees.", + "That {howl_percentage}% howl had some presence! Not bad, {username}.", + "A respectable {howl_percentage}% howl from {username}! Almost strong." + ], + "50": [ + "A solid {howl_percentage}% howl from {username}! Right in the middle of the scale!", + "{username} let out a {howl_percentage}% howl. Steady and clear.", + "{username}'s {howl_percentage}% howl echoed nicely into the night.", + "That {howl_percentage}% howl had a good ring to it, {username}!", + "{username} howled at {howl_percentage}%, solid but not overwhelming." + ], + "60": [ + "{username} howled at {howl_percentage}%! A strong and steady call!", + "That {howl_percentage}% howl had some real strength behind it, {username}!", + "A deep {howl_percentage}% howl from {username}, heard from afar!", + "{username} howled at {howl_percentage}%, and the night air carried it far!", + "That {howl_percentage}% howl had a great tone, {username}!" + ], + "70": [ + "{username} howled at {howl_percentage}%! A bold, commanding call!", + "That {howl_percentage}% howl from {username} had serious power!", + "{username}'s howl at {howl_percentage}% sent a chill through the air!", + "A howling force at {howl_percentage}%! {username} is getting loud!", + "{username} let out a {howl_percentage}% howl! The pack takes notice." + ], + "80": [ + "{username} howled at {howl_percentage}%! That was a proper call!", + "A mighty {howl_percentage}% howl from {username}! The wolves approve!", + "At {howl_percentage}%, {username}'s howl rang through the valley!", + "{username} let out an {howl_percentage}% howl! Strong and proud!", + "That {howl_percentage}% howl had real weight to it, {username}!" + ], + "90": [ + "{username} howled at {howl_percentage}%! Almost a perfect call!", + "A thunderous {howl_percentage}% howl from {username}! Almost legendary!", + "That {howl_percentage}% howl from {username} shook the trees!", + "{username} let out a {howl_percentage}% howl! Nearly flawless!", + "That {howl_percentage}% howl was near perfection, {username}!" + ], + "100": [ + "Wow, {username} performed a perfect {howl_percentage}% howl!", + "A magnificent howl! {username} reached a legendary {howl_percentage}%!", + "{username}'s howl echoed through the mountains at a flawless {howl_percentage}%!", + "The wolves bow before {username}, whose {howl_percentage}% howl was unmatched!", + "Perfect pitch, perfect strength—{username} unleashed a {howl_percentage}% howl!" + ] +} diff --git a/permissions.json b/permissions.json index 83b31fd..f87193c 100644 --- a/permissions.json +++ b/permissions.json @@ -17,7 +17,7 @@ "commands": { "hi": { "min_role": "", - "allowed_roles": [], + "allowed_roles": ["broadcaster", "owner"], "allowed_users": ["203190147582394369"] } }