From 4407f71d1f43337aaf6b68af24349f88e7ba544d Mon Sep 17 00:00:00 2001 From: Speediestsaf Date: Thu, 24 Jul 2025 17:16:21 +0000 Subject: [PATCH] Moved the rotation command to the commands section, renamed it to speedrotation as well as its prompt. Put the dateline import onto the same line as the import. Changed the wording of speedrotation to speak about Speed and not 2nd person. --- commands.json | 2 +- methods.py | 70 +++++++++++++++++++++++++-------------------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/commands.json b/commands.json index feb63e9..ab289ee 100644 --- a/commands.json +++ b/commands.json @@ -7,5 +7,5 @@ "cmd_addcommand": ["addcommand"], "cmd_listcommands": ["listcommands", "list"], "cmd_roll": ["roll", "r"], - "cmd_rotation": ["rotation"] + "cmd_speedrotation": ["speedrotation"] } diff --git a/methods.py b/methods.py index 92ed9d5..af24440 100644 --- a/methods.py +++ b/methods.py @@ -125,42 +125,11 @@ async def cmd_roll(ctx, inputValue, sign = None, addition = None): except ValueError as e: await ctx.send(f"Invalid input - {e}.") -######################################################## -### INTERNAL METHODS - ALL METHODS MUST BE LOWERCASE ### -######################################################## - -#Loads commands into variable. -def loadcommands(filename): - if not os.path.exists(filename): - with open(filename, "w", encoding="utf-8") as file: - json.dump({}, file) # Create an empty JSON file - - with open(filename, "r", encoding="utf-8") as file: - return json.load(file) - -#Loads points into variable. -def loadpoints(): - if not os.path.exists("points.json"): - with open("points.json", "w", encoding="utf-8") as file: - json.dump({}, file) # Create an empty JSON file - - with open("points.json", "r", encoding="utf-8") as file: - return json.load(file) - -# Saves points to the points.json file. -def savepoints(points_data): - with open("points.json", "w", encoding="utf-8") as file: - json.dump(points_data, file, indent=4) - -#Rolls die for cmd_roll -def rolldie(sides): - return random.randint(1, sides) - # Define the rotation start date (Week 1) ROTATION_START_DATE = datetime.date(2025, 7, 14) -#@bot.command(name='rotation') -async def cmd_rotation(ctx): +#@bot.command(name='speedrotation') +async def cmd_speedrotation(ctx): # Get today's date today = datetime.date.today() # For this example, assume July 24, 2025 @@ -193,9 +162,40 @@ async def cmd_rotation(ctx): # Format the response response = ( - f"You are currently in **Week {current_week}** ({status}).\n" - f"You will be back to working at the office on **{next_week3_monday.strftime('%B %d, %Y')}**." + f"Speed is currently in **Week {current_week}** ({status}).\n" + f"Speed will be back to working at the office on **{next_week3_monday.strftime('%B %d, %Y')}**." ) # Send the response await ctx.send(response) + +######################################################## +### INTERNAL METHODS - ALL METHODS MUST BE LOWERCASE ### +######################################################## + +#Loads commands into variable. +def loadcommands(filename): + if not os.path.exists(filename): + with open(filename, "w", encoding="utf-8") as file: + json.dump({}, file) # Create an empty JSON file + + with open(filename, "r", encoding="utf-8") as file: + return json.load(file) + +#Loads points into variable. +def loadpoints(): + if not os.path.exists("points.json"): + with open("points.json", "w", encoding="utf-8") as file: + json.dump({}, file) # Create an empty JSON file + + with open("points.json", "r", encoding="utf-8") as file: + return json.load(file) + +# Saves points to the points.json file. +def savepoints(points_data): + with open("points.json", "w", encoding="utf-8") as file: + json.dump(points_data, file, indent=4) + +#Rolls die for cmd_roll +def rolldie(sides): + return random.randint(1, sides)