Formatted source, as well as making a change to prevent the bot from spamming #general
This commit is contained in:
@@ -5,9 +5,7 @@ import pickle
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# Redacted
|
||||
ID_TO_NAME: dict[int, str] = {
|
||||
|
||||
}
|
||||
ID_TO_NAME: dict[int, str] = {}
|
||||
|
||||
# Redacted
|
||||
STUDENT_IDS: set = ()
|
||||
@@ -28,24 +26,27 @@ finally:
|
||||
# Redacted
|
||||
STUDENTS: dict[int, str] = {}
|
||||
|
||||
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",
|
||||
)
|
||||
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
|
||||
|
||||
@@ -66,6 +67,7 @@ def assign_essay(student_id: int, essay: str = get_essay_topic()) -> str:
|
||||
else:
|
||||
raise ValueError(f"Student ID {student_id} is not a valid student ID.")
|
||||
|
||||
|
||||
def get_essay(student_id: int = None) -> str:
|
||||
"""Gets the assigned essay for a student
|
||||
|
||||
@@ -86,7 +88,7 @@ def get_essay(student_id: int = None) -> str:
|
||||
for essay in ASSIGNED_ESSAY:
|
||||
essays += f"<@{essay}>: {ASSIGNED_ESSAY[essay]}\n"
|
||||
return essays if essays else "No essays assigned."
|
||||
|
||||
|
||||
|
||||
def clear_essay(student_id):
|
||||
"""Clears an assigned essay from a student
|
||||
@@ -102,7 +104,8 @@ def clear_essay(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.")
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(get_essay())
|
||||
print(get_essay())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user