diff --git a/cmd_common/common_commands.py b/cmd_common/common_commands.py new file mode 100644 index 0000000..b954e99 --- /dev/null +++ b/cmd_common/common_commands.py @@ -0,0 +1,38 @@ +# cmd_common/common_commands.py +import random +import time + +def generate_howl_message(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 %. + """ + 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}%!" + +def ping(): + """ + Returns a string, confirming the bot is online. + """ + from modules.utility import format_uptime + from bots import bot_start_time # where you stored the start timestamp + + current_time = time.time() + elapsed = current_time - bot_start_time + uptime_str = format_uptime(elapsed) + response = f"Pong! I've been awake for {uptime_str}. Send coffee!" + return f"{response}" + +def greet(target_display_name: str, platform_name: str) -> str: + """ + Returns a greeting string for the given user displayname on a given platform. + """ + return f"Hello {target_display_name}, welcome to {platform_name}!" \ No newline at end of file