97 lines
6.0 KiB
Python
97 lines
6.0 KiB
Python
import logging
|
|
from random import choice as random_choice
|
|
import pickle
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
ID_TO_NAME: dict[int, str] = {
|
|
620319269233885226 : "Devan",
|
|
957378132061618217 : "CJ",
|
|
1077533292687007794 : "Connor",
|
|
964563429190930465 : "Michael",
|
|
909865829313683536 : "Bea",
|
|
821891090411421747 : "Mika",
|
|
1093276870688133171 : "Daniel",
|
|
625861445833457694 : "Paul",
|
|
1336780587662446593: "Mr. Jacobs"
|
|
}
|
|
|
|
STUDENT_IDS: set = (620319269233885226, 957378132061618217, 1077533292687007794, 964563429190930465, 909865829313683536, 821891090411421747, 1093276870688133171, 625861445833457694)
|
|
|
|
try:
|
|
ASSIGNED_ESSAY: dict = pickle.load(open("./data/assigned_essay.pkl", "rb"))
|
|
except FileNotFoundError:
|
|
logger.warning("No assigned essays found/saved, creating new dictionary.")
|
|
ASSIGNED_ESSAY: dict[int, str] = {}
|
|
with open("./data/assigned_essay.pkl", "xb"):
|
|
pass
|
|
except EOFError:
|
|
logger.warning("Assigned essays file is empty, creating new dictionary.")
|
|
ASSIGNED_ESSAY: dict[int, str] = {}
|
|
finally:
|
|
logger.debug(f"Assigned essays: {ASSIGNED_ESSAY}")
|
|
|
|
STUDENTS: dict[int, str] = {
|
|
620319269233885226 : "Devan\nWhile he's not super far ahead of the class, he's still ahead enough that he isn't forced to be on top of things like the rest of the class. You remain more straightforward with him despite some more greivences with him.",
|
|
1077533292687007794 : "Connor\nYou are particularly scrutinizing to all of his behavior, especially whenever you find him 1. Playing chess. 2. On YouTube. 3. Listening to music on Spotify. Occasionally, you go beyond simply scolding him for not actively slaving away at his Cisco work, even making awkward analogies to explain how other people are being more productive than him on the other side, and that he should focus on his Cisco work. You'll wait for him to tab back to something on topic before you leave him alone.",
|
|
957378132061618217 : "CJ\nHe's the best student in the class by far and large. He's already almost finished with his CCNA, which makes sense as he is a senior that only has until he graduates to get his CCNA done in order to get it paid for by the school. He's a really good kid, and you treat him as such. You'll even tell him that he's done good work, which is rather infrequent for your other students.",
|
|
964563429190930465 : "Michael\nFor the most part you disregard him if he's not working on Cisco, occasionally requesting that he get back on track and then quickly disregarding him again and moving on. As for when he's on Cisco work, when he asks questions, you typically give him a vague non-answer, and you get easily irriated with him, ESPECIALLY if it's something that has EVER been mentioned before. Usually you'll end up yelling at him with things like \"I'm not tryna be mean, but...you should know this already.\" and then walking away.",
|
|
909865829313683536 : "Bea\nA student from Graphic Commerical Arts with blue hair and is not in the Computer Networking and Cybersecurity. Because of that, you can't really be mad at them for not focusing on Cisco. I suppose you would talk yourself up a little bit to students in other labs?",
|
|
821891090411421747 : "Mika\nA student from Animal Care and is not in the Computer Networking and Cybersecurity. Because of that, you can't really be mad at them for not focusing on Cisco. I suppose you would talk yourself up a little bit to students in other labs?",
|
|
1093276870688133171 : "Daniel\nA student from Biotech and is not in the Computer Networking and Cybersecurity. Because of that, you can't really be mad at them for not focusing on Cisco. I suppose you would talk yourself up a little bit to students in other labs?",
|
|
625861445833457694 : "Paul\nIt's PAUL!, and for some reason, you LOVE Paul, and you acknowledge just how talented of an artist he is! For some reason, you randomly walk up to him with 'How we doing Paul!?' You've even given him his own opurtnities ",
|
|
1336780587662446593: "Mr. Jacobs\nYourself."
|
|
}
|
|
|
|
ESSAY_TOPICS = ("why to not throw rocks during a fire drill",
|
|
"how to sit in a chair properly",
|
|
"how to keep your hands to yourself",
|
|
"how to be on time",
|
|
"how to take accountability",
|
|
"why you shouldn't be wrong (be right!!!)",
|
|
"why picking cherries is healthy for mental health",
|
|
"why losing is bad, actually",
|
|
"why you should be responsable when the bell rings and GET OUT because i'm HUNGRY",
|
|
"why you shouldn't hitlerpost in the public discord chat",
|
|
"why having your professionalism packet is essential for your future career",
|
|
"why playing rock-paper-scissors over text is very productive",
|
|
"why steak is the best food for my lunch break",
|
|
)
|
|
|
|
def get_essay_topic() -> str:
|
|
return random_choice(ESSAY_TOPICS)
|
|
|
|
def assign_essay(student_id: int, essay: str = get_essay_topic()) -> str:
|
|
"""Assigns a student an essay
|
|
|
|
Args:
|
|
student_id (int): The Discord ID of the student getting the essay.
|
|
essay (str, optional): The topic of the essay being assigned. Defaults to get_essay_topic().
|
|
|
|
Raises:
|
|
ValueError: If the student ID is not in STUDENT_IDS.
|
|
|
|
Returns:
|
|
str: The topic of the essay assigned.
|
|
"""
|
|
if student_id in STUDENT_IDS:
|
|
ASSIGNED_ESSAY[student_id] = essay
|
|
pickle.dump(ASSIGNED_ESSAY, open("./data/assigned_essay.pkl", "wb"))
|
|
return essay
|
|
else:
|
|
raise ValueError(f"Student ID {student_id} is not a valid student ID.")
|
|
|
|
def clear_essay(student_id):
|
|
"""Clears an assigned essay from a student
|
|
|
|
Args:
|
|
student_id (int): The Discord ID of the student to clear the essay from.
|
|
|
|
Raises:
|
|
ValueError: If the student ID is not in STUDENT_IDS.
|
|
"""
|
|
if student_id in STUDENT_IDS:
|
|
ASSIGNED_ESSAY.pop(student_id)
|
|
pickle.dump(ASSIGNED_ESSAY, open("./data/assigned_essay.pkl", "wb"))
|
|
else:
|
|
raise ValueError(f"Student ID {student_id} is not a valid student ID.") |