Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions raven/ai/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
)





def handle_bot_dm(message, bot):
"""
Function to handle direct messages to the bot.
Expand All @@ -28,6 +31,20 @@ def handle_bot_dm(message, bot):
return handle_bot_dm_with_assistants(message, bot)


def push_message_to_channel(channel_id, text, is_bot_message=False, bot_user=None):
message = frappe.get_doc({
"doctype": "Raven Message",
"channel_id": channel_id,
"text": text,
"message_type": "Text",
"is_bot_message": is_bot_message,
"bot": bot_user if is_bot_message else None,
})
message.insert(ignore_permissions=True)
message.save()



def handle_bot_dm_with_agents(message, bot):
"""
Handle direct messages using Agents SDK.
Expand Down
5 changes: 5 additions & 0 deletions raven/api/raven_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ def get_channels(hide_archived=False):
return channels


# def get_



def get_peer_user(channel_id: str, is_direct_message: int, is_self_message: bool = False) -> dict:
"""
For a given channel, fetches the peer's member object
Expand All @@ -122,6 +126,7 @@ def get_peer_user(channel_id: str, is_direct_message: int, is_self_message: bool

for member in members:
if member != frappe.session.user:
# print(members[member] , "membersss")
return members[member]

return None
Expand Down
8 changes: 5 additions & 3 deletions raven/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
"on_trash": "raven.raven_integrations.controllers.department.on_trash",
},
"Employee": {
"after_insert": "raven.raven_integrations.controllers.employee.after_insert",
"after_insert": "rav"
"en.raven_integrations.controllers.employee.after_insert",
"on_update": "raven.raven_integrations.controllers.employee.on_update",
"on_trash": "raven.raven_integrations.controllers.employee.on_trash",
},
Expand All @@ -158,8 +159,9 @@

scheduler_events = {
"cron": {
# run every 5 minutes
"*/5 * * * *": ["raven.scheduler.close_expired_polls.close_expired_polls"]
"*/5 * * * *": ["raven.scheduler.close_expired_polls.close_expired_polls"],
"0 10 * * *": ["raven.scheduler.work_update_reminder.post_work_plan"],
"0 19 * * *":["raven.scheduler.work_update_reminder.post_work_update"]
}
}

Expand Down
Loading