Commit d00fc2a3 by Oleksandr Barabash

bot.handle_mars_report updated

parent 0c18917c
......@@ -3,6 +3,7 @@ import asyncio
import logging
import sys
import time
import traceback
import uuid
from asyncio import Future
from typing import Optional
......@@ -113,23 +114,34 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
# 2. Add permissions for the recipients
# 3. Send info into the flow
logger.info("handle_mars_report")
# todo(s1z): Make this secure and not such ugly
stripped_channel_id = channel_id.split(";")[0]
reference = await self.cosmos_client.get_conversation(
channel_id, AppConfig.TENANT_ID
stripped_channel_id, AppConfig.TENANT_ID
)
async def callback(turn_context: TurnContext) -> None:
""" Turn Context callback. Kinda awful syntax, I know """
team_details = await TeamsInfo.get_team_details(turn_context)
group_id = team_details.aad_group_id
credential = ClientSecretCredential(AppConfig.TENANT_ID,
AppConfig.APP_ID,
AppConfig.APP_PASSWORD)
scopes = ['https://graph.microsoft.com/.default']
client = GraphServiceClient(credentials=credential, scopes=scopes)
result = await client.groups.by_group_id(group_id).members.get()
# send mail notifications!
# noinspection PyBroadException
try:
team_details = await TeamsInfo.get_team_details(turn_context)
group_id = team_details.aad_group_id
credential = ClientSecretCredential(AppConfig.TENANT_ID,
AppConfig.APP_ID,
AppConfig.APP_PASSWORD)
scopes = ['https://graph.microsoft.com/.default']
client = GraphServiceClient(credentials=credential,
scopes=scopes)
result = await client.groups.by_group_id(
group_id
).members.get()
except Exception:
result = traceback.format_exc()
# send mail notifications!
await turn_context.send_activity(
f"the team aad_object_id: {result}"
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment