mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 08:53:41 -05:00
remove commented out code and extra print statements
This commit is contained in:
parent
77a2bd103e
commit
6cc3829c63
1 changed files with 231 additions and 270 deletions
|
|
@ -36,7 +36,6 @@ async def update_active():
|
||||||
for stream in streams:
|
for stream in streams:
|
||||||
if stream["ready"] and stream not in active_streams:
|
if stream["ready"] and stream not in active_streams:
|
||||||
active_streams.append(stream)
|
active_streams.append(stream)
|
||||||
print(active_streams)
|
|
||||||
if len(active_streams) == 0:
|
if len(active_streams) == 0:
|
||||||
print("No active streams")
|
print("No active streams")
|
||||||
return
|
return
|
||||||
|
|
@ -61,7 +60,6 @@ async def update_active():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
print(f"trying to find user associated with stream {active_stream['name']}")
|
print(f"trying to find user associated with stream {active_stream['name']}")
|
||||||
print(await db.stream.find_many())
|
|
||||||
old_active_stream_user = await db.user.find_first(where={"id": (await db.stream.find_first(where={"key": str(active_stream["name"])})).user_id}) # type: ignore
|
old_active_stream_user = await db.user.find_first(where={"id": (await db.stream.find_first(where={"key": str(active_stream["name"])})).user_id}) # type: ignore
|
||||||
await bolt.client.chat_postMessage(channel="C07ERCGG989", text=f"Hey <@{old_active_stream_user.slack_id}>, you're no longer in focus!") # type: ignore
|
await bolt.client.chat_postMessage(channel="C07ERCGG989", text=f"Hey <@{old_active_stream_user.slack_id}>, you're no longer in focus!") # type: ignore
|
||||||
active_stream = new_stream
|
active_stream = new_stream
|
||||||
|
|
@ -95,25 +93,6 @@ async def check_for_new():
|
||||||
for stream in streams_simple:
|
for stream in streams_simple:
|
||||||
if stream not in active_streams_simple:
|
if stream not in active_streams_simple:
|
||||||
active_streams.append({"name": stream, "ready": True})
|
active_streams.append({"name": stream, "ready": True})
|
||||||
# for stream in streams:
|
|
||||||
# for i in active_streams:
|
|
||||||
# if stream["name"] == i["name"] and not i["ready"]:
|
|
||||||
# print(f"removing stream that is no longer ready: {i["name"]}")
|
|
||||||
# active_streams.remove(i)
|
|
||||||
# active_stream = choice(active_streams)
|
|
||||||
# for i in active_streams:
|
|
||||||
# if stream["name"] == i["name"] and not stream["ready"]:
|
|
||||||
# active_streams.remove(i)
|
|
||||||
# if active_stream == stream["name"]:
|
|
||||||
# active_stream = choice(active_streams)
|
|
||||||
# active_streams_simple = []
|
|
||||||
# for i in active_streams:
|
|
||||||
# active_streams_simple.append(i["name"])
|
|
||||||
# if stream["ready"] and stream["name"] not in active_streams_simple:
|
|
||||||
# active_streams.append(stream)
|
|
||||||
# new_active_streams = []
|
|
||||||
# [new_active_streams.append(x) for x in active_streams if x not in new_active_streams]
|
|
||||||
# active_streams = new_active_streams
|
|
||||||
if len(active_streams) == 0:
|
if len(active_streams) == 0:
|
||||||
print("No active streams")
|
print("No active streams")
|
||||||
active_stream = {}
|
active_stream = {}
|
||||||
|
|
@ -278,9 +257,6 @@ async def approve(ack, body):
|
||||||
async def handle_application_submission(ack, body):
|
async def handle_application_submission(ack, body):
|
||||||
await ack()
|
await ack()
|
||||||
user = body["user"]["id"]
|
user = body["user"]["id"]
|
||||||
print(user + "has applied")
|
|
||||||
with open("applicants.txt", "a") as f:
|
|
||||||
f.write(user + "\n")
|
|
||||||
sumbitter_convo = await bolt.client.conversations_open(users=user, return_im=True)
|
sumbitter_convo = await bolt.client.conversations_open(users=user, return_im=True)
|
||||||
user_real_name = (await bolt.client.users_info(user=user))["user"]["real_name"]
|
user_real_name = (await bolt.client.users_info(user=user))["user"]["real_name"]
|
||||||
user_verified = ""
|
user_verified = ""
|
||||||
|
|
@ -303,11 +279,9 @@ async def handle_application_submission(ack, body):
|
||||||
users=os.environ["ADMIN_SLACK_ID"], return_im=True
|
users=os.environ["ADMIN_SLACK_ID"], return_im=True
|
||||||
)
|
)
|
||||||
will_behave = True
|
will_behave = True
|
||||||
print(body["view"]["state"]["values"])
|
|
||||||
# boxes = body["view"]["state"]["values"]["kAgeY"]["checkboxes"]["selected_options"]
|
# boxes = body["view"]["state"]["values"]["kAgeY"]["checkboxes"]["selected_options"]
|
||||||
# if len(boxes) == 1 and boxes[0]["value"] == "value-1":
|
# if len(boxes) == 1 and boxes[0]["value"] == "value-1":
|
||||||
# will_behave = True
|
# will_behave = True
|
||||||
print(
|
|
||||||
await bolt.client.chat_postMessage(
|
await bolt.client.chat_postMessage(
|
||||||
channel=os.environ["ADMIN_SLACK_ID"],
|
channel=os.environ["ADMIN_SLACK_ID"],
|
||||||
text="New OnBoard Live application!",
|
text="New OnBoard Live application!",
|
||||||
|
|
@ -388,14 +362,12 @@ async def handle_application_submission(ack, body):
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@bolt.command("/onboard-live-apply")
|
@bolt.command("/onboard-live-apply")
|
||||||
async def apply(ack: AsyncAck, command):
|
async def apply(ack: AsyncAck, command):
|
||||||
await ack()
|
await ack()
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
print(
|
|
||||||
(
|
(
|
||||||
await client.post(
|
await client.post(
|
||||||
"https://slack.com/api/views.open",
|
"https://slack.com/api/views.open",
|
||||||
|
|
@ -570,7 +542,6 @@ async def apply(ack: AsyncAck, command):
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
).text
|
).text
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@bolt.action("checkboxes")
|
@bolt.action("checkboxes")
|
||||||
|
|
@ -581,13 +552,3 @@ async def handle_some_action(ack):
|
||||||
@api.post("/slack/events")
|
@api.post("/slack/events")
|
||||||
async def slack_event_endpoint(req: Request):
|
async def slack_event_endpoint(req: Request):
|
||||||
return await bolt_handler.handle(req)
|
return await bolt_handler.handle(req)
|
||||||
|
|
||||||
|
|
||||||
# @api.on_event("startup")
|
|
||||||
# @repeat_every(seconds=5, wait_first=False,raise_exceptions=True)
|
|
||||||
# async def change_active_stream() -> None:
|
|
||||||
# print('e')
|
|
||||||
# global active_stream
|
|
||||||
# with httpx.AsyncClient as client:
|
|
||||||
# streams = (await client.get("http://localhost:9997/v3/paths/list")).json["items"]
|
|
||||||
# active_stream = choice(streams)["name"]
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue