Misc. updates.
This commit is contained in:
parent
e813a5d72d
commit
e3321000cb
|
|
@ -0,0 +1,9 @@
|
||||||
|
FROM python:3.8-slim
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN pip3 install --user -r dependencies.txt
|
||||||
|
|
||||||
|
CMD python3 -u main.py
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
slackclient
|
slackclient==1.3.2
|
||||||
python-Levenshtein
|
python-Levenshtein
|
||||||
fuzzywuzzy
|
fuzzywuzzy
|
||||||
httplib2
|
httplib2
|
||||||
|
aiohttp
|
||||||
|
google-api-python-client
|
||||||
|
oauth2client
|
||||||
|
|
|
||||||
4
main.py
4
main.py
|
|
@ -35,6 +35,7 @@ def main() -> None:
|
||||||
|
|
||||||
# Add job management
|
# Add job management
|
||||||
wrap.add_hook(job_commands.signoff_hook)
|
wrap.add_hook(job_commands.signoff_hook)
|
||||||
|
wrap.add_hook(job_commands.undo_hook)
|
||||||
wrap.add_hook(job_commands.late_hook)
|
wrap.add_hook(job_commands.late_hook)
|
||||||
wrap.add_hook(job_commands.reset_hook)
|
wrap.add_hook(job_commands.reset_hook)
|
||||||
wrap.add_hook(job_commands.nag_hook)
|
wrap.add_hook(job_commands.nag_hook)
|
||||||
|
|
@ -81,7 +82,6 @@ async def help_callback(event: slack_util.Event, match: Match) -> None:
|
||||||
"marklate John Doe" : Same as above, but to mark a job as being completed but having been done late.
|
"marklate John Doe" : Same as above, but to mark a job as being completed but having been done late.
|
||||||
"reassign John Doe -> James Deer" : Reassign a house job.
|
"reassign John Doe -> James Deer" : Reassign a house job.
|
||||||
"undo signoff John Doe" : Marks a brother's house job as incomplete. Useful if you fucked up.
|
"undo signoff John Doe" : Marks a brother's house job as incomplete. Useful if you fucked up.
|
||||||
"nagjobs day" : Notify in general the house jobs for the week.
|
|
||||||
"reset signoffs" : Clear points for the week, and undo all signoffs. Not frequently useful, admin only.
|
"reset signoffs" : Clear points for the week, and undo all signoffs. Not frequently useful, admin only.
|
||||||
"refresh points" : Updates house job / signoff points for the week, after manual edits to the sheet. Admin only.
|
"refresh points" : Updates house job / signoff points for the week, after manual edits to the sheet. Admin only.
|
||||||
"help" : You're reading it. This is all it does. What do you want from me?
|
"help" : You're reading it. This is all it does. What do you want from me?
|
||||||
|
|
@ -93,6 +93,8 @@ async def help_callback(event: slack_util.Event, match: Match) -> None:
|
||||||
|
|
||||||
Github is https://github.com/TheVillageIdiot2/waitonbot
|
Github is https://github.com/TheVillageIdiot2/waitonbot
|
||||||
Man in charge is Jacob Henry, but nothing lasts forever.
|
Man in charge is Jacob Henry, but nothing lasts forever.
|
||||||
|
|
||||||
|
Edit January 2023: Patched by Andrew Kerekon, 1126. Contact arkerekon@wpi.edu if anything breaks and I'll do my best to fix it!
|
||||||
"""))
|
"""))
|
||||||
# Do not let my efforts fall to waste. Its a pitious legacy but its something, at least, to maybe tide the
|
# Do not let my efforts fall to waste. Its a pitious legacy but its something, at least, to maybe tide the
|
||||||
# unending flow of work for poor Niko.
|
# unending flow of work for poor Niko.
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ async def export_assignments(assigns: List[Optional[JobAssignment]]) -> None:
|
||||||
google_api.set_sheet_range(SHEET_ID, job_range, rows)
|
google_api.set_sheet_range(SHEET_ID, job_range, rows)
|
||||||
|
|
||||||
|
|
||||||
async def import_points() -> (List[str], List[PointStatus]):
|
async def import_points():
|
||||||
# Figure out how many things there are in a point status
|
# Figure out how many things there are in a point status
|
||||||
field_count = len(dataclasses.fields(PointStatus))
|
field_count = len(dataclasses.fields(PointStatus))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ from plugins import identifier, house_management, scroll_util
|
||||||
import client
|
import client
|
||||||
import slack_util
|
import slack_util
|
||||||
|
|
||||||
SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM"
|
SHEET_ID = "1f9p4H7TWPm8rAM4v_qr2Vc6lBiFNEmR-quTY9UtxEBI"
|
||||||
|
|
||||||
MIN_RATIO = 80.0
|
MIN_RATIO = 80.0
|
||||||
|
|
||||||
|
|
@ -153,6 +153,7 @@ async def _mod_jobs(event: slack_util.Event,
|
||||||
async def signoff_callback(event: slack_util.Event, match: Match) -> None:
|
async def signoff_callback(event: slack_util.Event, match: Match) -> None:
|
||||||
verb = slack_util.VerboseWrapper(event)
|
verb = slack_util.VerboseWrapper(event)
|
||||||
|
|
||||||
|
print("Receving a signoff request!!!")
|
||||||
# Find out who we are trying to sign off is
|
# Find out who we are trying to sign off is
|
||||||
signee_name = match.group(1)
|
signee_name = match.group(1)
|
||||||
signee = await verb(scroll_util.find_by_name(signee_name, MIN_RATIO))
|
signee = await verb(scroll_util.find_by_name(signee_name, MIN_RATIO))
|
||||||
|
|
@ -181,6 +182,7 @@ async def signoff_callback(event: slack_util.Event, match: Match) -> None:
|
||||||
async def undo_callback(event: slack_util.Event, match: Match) -> None:
|
async def undo_callback(event: slack_util.Event, match: Match) -> None:
|
||||||
verb = slack_util.VerboseWrapper(event)
|
verb = slack_util.VerboseWrapper(event)
|
||||||
|
|
||||||
|
print("Receving an unsignoff request!!!")
|
||||||
# Find out who we are trying to sign off is
|
# Find out who we are trying to sign off is
|
||||||
signee_name = match.group(1)
|
signee_name = match.group(1)
|
||||||
signee = await verb(scroll_util.find_by_name(signee_name, MIN_RATIO))
|
signee = await verb(scroll_util.find_by_name(signee_name, MIN_RATIO))
|
||||||
|
|
@ -199,9 +201,7 @@ async def undo_callback(event: slack_util.Event, match: Match) -> None:
|
||||||
# Say we did it wooo!
|
# Say we did it wooo!
|
||||||
client.get_slack().reply(event, "Undid signoff of {} for {}".format(context.assign.assignee.name,
|
client.get_slack().reply(event, "Undid signoff of {} for {}".format(context.assign.assignee.name,
|
||||||
context.assign.job.name))
|
context.assign.job.name))
|
||||||
await alert_user(context.assign.assignee, "{} undid your signoff off for {}.\n"
|
await alert_user(context.assign.assignee, "{} undid your signoff off for {}.\n")
|
||||||
"Must have been a mistake".format(context.assign.signer.name,
|
|
||||||
context.assign.job.pretty_fmt()))
|
|
||||||
|
|
||||||
# Fire it off
|
# Fire it off
|
||||||
await _mod_jobs(event, scorer, modifier)
|
await _mod_jobs(event, scorer, modifier)
|
||||||
|
|
@ -302,9 +302,13 @@ async def reset_callback(event: slack_util.Event, match: Match) -> None:
|
||||||
|
|
||||||
# noinspection PyUnusedLocal
|
# noinspection PyUnusedLocal
|
||||||
async def refresh_callback(event: slack_util.Event, match: Match) -> None:
|
async def refresh_callback(event: slack_util.Event, match: Match) -> None:
|
||||||
|
print("Received request to reset points")
|
||||||
headers, points = await house_management.import_points()
|
headers, points = await house_management.import_points()
|
||||||
|
print("Received request to reset points 1")
|
||||||
house_management.apply_house_points(points, await house_management.import_assignments())
|
house_management.apply_house_points(points, await house_management.import_assignments())
|
||||||
|
print("Received request to reset points 2")
|
||||||
house_management.export_points(headers, points)
|
house_management.export_points(headers, points)
|
||||||
|
print("Received request to reset points 3")
|
||||||
client.get_slack().reply(event, "Force updated point values")
|
client.get_slack().reply(event, "Force updated point values")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,7 @@ class TestPassive(hooks.Passive):
|
||||||
Stupid shit
|
Stupid shit
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
async def run(self) -> None:
|
async def run(self) -> None:
|
||||||
lifespan = 60
|
lifespan = 60
|
||||||
post_interval = 60
|
post_interval = 60
|
||||||
|
|
@ -226,5 +227,6 @@ class TestPassive(hooks.Passive):
|
||||||
make_interactive_msg()
|
make_interactive_msg()
|
||||||
await asyncio.sleep(post_interval)
|
await asyncio.sleep(post_interval)
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -824,3 +824,55 @@ scroll~name
|
||||||
1120~Sam Bello
|
1120~Sam Bello
|
||||||
1121~Chris Lee
|
1121~Chris Lee
|
||||||
1122~Marko Vila
|
1122~Marko Vila
|
||||||
|
1126~Andrew Kerekon
|
||||||
|
1127~Mitchell Decelles
|
||||||
|
1128~Roman Bolshakov
|
||||||
|
1129~Michael Zeolla
|
||||||
|
1140~Matthew Folenta
|
||||||
|
1141~Jonathan Coco
|
||||||
|
1142~Cameron Shelley
|
||||||
|
1144~Sean Foody
|
||||||
|
1145~Conor Dolan
|
||||||
|
1146~Ryan Saklad
|
||||||
|
1147~Richard Curtis
|
||||||
|
1148~Tim Ryan
|
||||||
|
1149~John Robinson
|
||||||
|
1150~Shawn Finnigan
|
||||||
|
1151~Yasar Idikut
|
||||||
|
1152~Drew Silvernail
|
||||||
|
1154~Matthew Lund
|
||||||
|
1155~Sam David
|
||||||
|
1156~Dimitry Blazy
|
||||||
|
1157~Gabe Ward
|
||||||
|
1158~Zev Lieberman
|
||||||
|
1159~Matt Adam
|
||||||
|
1160~Jacob Reiss
|
||||||
|
1161~Edward Stump
|
||||||
|
1162~Christian Davis
|
||||||
|
1164~Connor Wirsing
|
||||||
|
1165~Ezra Yohay
|
||||||
|
1166~Jack Weinstein
|
||||||
|
1167~Stephen Fanning
|
||||||
|
1168~Spencer Harding
|
||||||
|
9999~Christopher Warneck
|
||||||
|
9999~Gavin Burkhardt
|
||||||
|
9999~Ryan Mulcahy
|
||||||
|
9999~Jace Howhannesian
|
||||||
|
9999~Robi Gyurcsan
|
||||||
|
9999~Colin McGinty
|
||||||
|
9999~Rhys Forster
|
||||||
|
9999~Charles Logman
|
||||||
|
9999~Daniel Baranov
|
||||||
|
9999~Alexander Demirs
|
||||||
|
9999~Noah Newton
|
||||||
|
9999~Skyler Wiernick
|
||||||
|
9999~Michael Monda
|
||||||
|
9999~Nate Ewell
|
||||||
|
9999~Spencer Smith
|
||||||
|
9999~Aaron Olsen
|
||||||
|
9999~Lorcan Doull
|
||||||
|
9999~Mark Caleca
|
||||||
|
9999~Thor Hammer
|
||||||
|
9999~Samuel Jasmin
|
||||||
|
9999~Ethan Koch
|
||||||
|
9999~Istan Slamet
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue