Commit 4ce62e47 by Oleksandr Barabash

dependencies fixed. handle_mars_report updated

parent a7b4871b
......@@ -10,16 +10,19 @@ from urllib.parse import urlparse, parse_qsl, urlencode
import aiohttp
from aiohttp.web_app import Application
from azure.core.credentials_async import AsyncTokenCredential
from azure.identity.aio import ClientSecretCredential
from botbuilder.core import (TurnContext, CardFactory, BotFrameworkAdapter,
BotFrameworkAdapterSettings)
from botbuilder.schema import Activity, ActivityTypes, ResourceResponse, \
ChannelAccount
from botbuilder.schema.teams import (TaskModuleContinueResponse,
TaskModuleTaskInfo, TaskModuleResponse,
TaskModuleRequest)
TaskModuleRequest, TeamsChannelData)
from botbuilder.core.teams import TeamsActivityHandler, TeamsInfo
from botframework.connector import Channels
from marshmallow import EXCLUDE, INCLUDE
from msgraph import GraphServiceClient
from bots.exceptions import ConversationNotFound
from config import TaskModuleConfig, AppConfig, CLEANER_CLIENT
......@@ -110,6 +113,29 @@ class TeamsMessagingExtensionsActionPreviewBot(TeamsActivityHandler):
# 2. Add permissions for the recipients
# 3. Send info into the flow
logger.info("handle_mars_report")
reference = await self.cosmos_client.get_conversation(
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!
await turn_context.send_activity(
f"the team aad_object_id: {result}"
)
await self.adapter.continue_conversation(reference, callback,
self.settings.app_id)
def send_message(self, pa_message: PAMessage) -> Future[ResourceResponse]:
""" Send message as a bot """
......
botbuilder-integration-aiohttp>=4.14.0
azure-cosmos==4.3.0
marshmallow==3.15.0
azure-identity==1.5.0
azure-identity==1.12.0
azure-mgmt==4.0.0
aiohttp~=3.7.0
aiohttp==3.8.4
simplejson==3.17.6
marshmallow-dataclass==8.5.8
stringcase==1.2.0
......@@ -12,3 +12,4 @@ azure-keyvault-keys==4.3.1
pycryptodome==3.15.0
python-i18n[YAML]==0.3.9
typeguard==2.13.3
msgraph-sdk==1.0.0a16
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