revert b79baab1c3
revert revert 41da1617d7
revert Added the cmd_rotation command for Speed's work rotation. DateTime not imported.
This commit is contained in:
parent
b79baab1c3
commit
4ac8fdcd13
2 changed files with 45 additions and 1 deletions
|
|
@ -6,5 +6,6 @@
|
|||
"cmd_checkpoints": ["checkpoints", "check"],
|
||||
"cmd_addcommand": ["addcommand"],
|
||||
"cmd_listcommands": ["listcommands", "list"],
|
||||
"cmd_roll": ["roll", "r"]
|
||||
"cmd_roll": ["roll", "r"],
|
||||
"cmd_rotation": ["rotation"]
|
||||
}
|
||||
|
|
|
|||
43
methods.py
43
methods.py
|
|
@ -155,3 +155,46 @@ def savepoints(points_data):
|
|||
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):
|
||||
# Get today's date
|
||||
today = datetime.date.today() # For this example, assume July 24, 2025
|
||||
|
||||
# Calculate days since the start of the rotation
|
||||
days_since_start = (today - ROTATION_START_DATE).days
|
||||
|
||||
# Calculate current week number (1, 2, or 3)
|
||||
current_week = (days_since_start // 7 % 3) + 1
|
||||
|
||||
# Determine the status based on the week number
|
||||
if current_week == 1 or current_week == 2:
|
||||
status = "Work from home"
|
||||
else: # current_week == 3
|
||||
status = "Working at the office"
|
||||
|
||||
# Find the Monday of the current week
|
||||
# weekday() returns 0 for Monday, 1 for Tuesday, etc.
|
||||
current_monday = today - datetime.timedelta(days=today.weekday())
|
||||
|
||||
# Calculate weeks to add to reach the next Week 3
|
||||
if current_week == 1:
|
||||
weeks_to_add = 2
|
||||
elif current_week == 2:
|
||||
weeks_to_add = 1
|
||||
else: # current_week == 3
|
||||
weeks_to_add = 3
|
||||
|
||||
# Calculate the next Week 3 Monday
|
||||
next_week3_monday = current_monday + datetime.timedelta(weeks=weeks_to_add)
|
||||
|
||||
# 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')}**."
|
||||
)
|
||||
|
||||
# Send the response
|
||||
await ctx.send(response)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue