import { Session } from "botbuilder" ; import { User } from "../Models" ; import { ArgumentNullException } from "../Errors" ; export class SessionUtils { static extractTeamId ( session ) { if ( ! session ) { throw new ArgumentNullException ( "session" ) ; } let teamId = null ; if ( session && session . message ) { if ( session . message . user ) { teamId = session . message . user . id ; } if ( session . message . sourceEvent && session . message . sourceEvent . team ) { teamId = session . message . sourceEvent . team . id ; } } return teamId ; } static extractSender ( session ) { if ( ! session ) { throw new ArgumentNullException ( "session" ) ; } return new User ( session . message . address . user . id , session . message . address . user . name || "" ) ; } } export default SessionUtils ;