generated from nhcarrigan/template
docs: add data file documentation and fix data path resolution
All Python cohort scripts now use DATA_DIR = Path(__file__).parent.parent.parent / "data" to correctly resolve the repo-root data/ directory regardless of the working directory set by run.sh. All TypeScript scripts have expanded JSDoc headers documenting data file requirements and environment variables.
This commit is contained in:
@@ -1,10 +1,29 @@
|
||||
"""Send initial welcome and roster messages to all team Discord channels.
|
||||
|
||||
Creates a pinned roster message in each team channel and stores the resulting
|
||||
message ID, channel ID, and role ID in team_message_ids.json for use by
|
||||
other scripts (send_checkin.py, update_roster_messages.py, etc.).
|
||||
|
||||
Data files (place in data/):
|
||||
- team_assignments.json Team rosters with leaders and participants per team
|
||||
- applicants_to_evaluate.json Applicant data including Discord channel/role IDs
|
||||
|
||||
Outputs (written to data/):
|
||||
- team_message_ids.json Channel ID, message ID, and role ID per team
|
||||
|
||||
Env vars:
|
||||
- DISCORD_BOT_TOKEN Bot token for the Discord API
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
|
||||
# Amari's bot token
|
||||
DATA_DIR = Path(__file__).parent.parent.parent / "data"
|
||||
|
||||
TOKEN = os.environ["DISCORD_BOT_TOKEN"]
|
||||
GUILD_ID = "692816967895220344"
|
||||
|
||||
@@ -72,12 +91,12 @@ TEAMS = {
|
||||
}
|
||||
|
||||
# Load team assignments and convert to dict by team name
|
||||
with open("team_assignments.json") as f:
|
||||
with open(DATA_DIR / "team_assignments.json") as f:
|
||||
team_list = json.load(f)
|
||||
team_data = {team["name"]: team for team in team_list}
|
||||
|
||||
# Load applicants to get project_url by discord_id
|
||||
with open("applicants_to_evaluate.json") as f:
|
||||
with open(DATA_DIR / "applicants_to_evaluate.json") as f:
|
||||
applicants = json.load(f)
|
||||
applicant_lookup = {str(a["discord_id"]): a for a in applicants}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user