poshbotio / PoshBot

Powershell-based bot framework
MIT License
537 stars 108 forks source link

How would you get the users email address? #103

Closed delrio1110 closed 6 years ago

delrio1110 commented 6 years ago

I created a function to send email but Im not sure how to get the users slack email address who submitted the request. Also how do I submit these as a question and not as issue?

devblackops commented 6 years ago

@delrio1110 When PoshBot runs a command, it does so in a separate PowerShell job. I insert a global variable in that session called $global:PoshBotContext which has a bunch of useful info you can use in your command, including the calling user info. See this issue for more info.

In short, you should be able to reference $global:PoshBotContext.CallingUserInfo.Email to get the user's email address from inside your command.

I'll work on getting this feature documented so it's clear.

delrio1110 commented 6 years ago

Thank you, that did it!!!1