This commit is contained in:
EEKIM10 2022-10-10 18:11:10 +01:00
parent e6f8332a4b
commit 34fd911e63
3 changed files with 935 additions and 922 deletions

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,10 @@ from discord.ext import commands, tasks
import config import config
from utils import Assignments, Tutors, simple_embed_paginator, get_or_none, Student, hyperlink from utils import Assignments, Tutors, simple_embed_paginator, get_or_none, Student, hyperlink
BOOL_EMOJI = {
True: "\N{white heavy check mark}",
False: "\N{cross mark}"
}
TUTOR_OPTION = discord.Option( TUTOR_OPTION = discord.Option(
str, str,
@ -15,10 +19,18 @@ TUTOR_OPTION = discord.Option(
default=None, default=None,
choices=[x.title() for x in dir(Tutors) if not x.startswith("__") and x not in ("name", "value")] choices=[x.title() for x in dir(Tutors) if not x.startswith("__") and x not in ("name", "value")]
) )
BOOL_EMOJI = { __MARK_AS_OPTION_OPTIONS = ("unfinished", "finished", "unsubmitted", "submitted")
True: "\N{white heavy check mark}", MARK_AS_OPTION = discord.Option(
False: "\N{cross mark}" int,
} name="status",
choices=[
discord.OptionChoice(
name="{}{}".format(BOOL_EMOJI[not x.startswith("un")], x),
value=__MARK_AS_OPTION_OPTIONS.index(x),
)
for x in __MARK_AS_OPTION_OPTIONS
]
)
class TutorSelector(discord.ui.View): class TutorSelector(discord.ui.View):
@ -103,7 +115,7 @@ class AssignmentsCog(commands.Cog):
await assignment.update(reminders=assignment.reminders + [reminder_name]) await assignment.update(reminders=assignment.reminders + [reminder_name])
else: else:
if isinstance(reminder_time, datetime.time): if isinstance(reminder_time, datetime.time):
if now.date() == due.date: if now.date() == due.date():
if now.time().hour == reminder_time.hour: if now.time().hour == reminder_time.hour:
try: try:
await general.send( await general.send(

View file

@ -62,7 +62,8 @@ class Events(commands.Cog):
await message.pin(reason="Automatic pinboard pinning") await message.pin(reason="Automatic pinboard pinning")
except discord.HTTPException as e: except discord.HTTPException as e:
return await message.reply(f"Failed to auto-pin: {e}", delete_after=10) return await message.reply(f"Failed to auto-pin: {e}", delete_after=10)
elif message.type == discord.MessageType.pins_add:
if message.type == discord.MessageType.pins_add:
await message.delete(delay=0.01) await message.delete(delay=0.01)