poshbotio / PoshBot

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

Slack username changes #139

Closed RamblingCookieMonster closed 4 years ago

RamblingCookieMonster commented 5 years ago

Back in 2017, Slack changed the way names were handled, making PSSlack's name somewhat useless. It might be worth moving to displayname.

In a number of functions, I map a Slack @ name (discoverable by users by simply typing) to another identity system via some sort of map. It would be helpful to keep the names exposed by poshbot consistent with the names you can @ mention.

I could see two potential solutions:

The latter seems less disruptive. In both cases, exposing this via $global:PoshBotContext would be useful.

Cheers!

devblackops commented 5 years ago

@RamblingCookieMonster I'm gonna have to read up on this a bit. All the different names is making my head hurt 🤕

1DontEx1st commented 5 years ago

Is this what's causing my freshly-installed bot to throw "User [xxxxxx] not found", "Could not resolve user [xxxxx]", and "Unable to resolve ID for admin [xxxxxx]"?

devblackops commented 5 years ago

Could be @1DontEx1st. Right now, PoshBot uses the nickname to map users to their IDs.

RamblingCookieMonster commented 5 years ago

You can validate it @1DontEx1st - get your token, and run something like this:

Get-SlackUser -Token $Token |
    select name, displayname |
    where {$_.name -notlike $_.displayname -and $_.displayname} |
    sort name

Anyone coming up there will be mismatched. PoshBot uses the name, Slack is now oriented around displayname which occasionally differs from name (I don't know the specific details in what causes the divergence when someone signs up for or is provisioned an account). So you @ the displayname, but if name doesn't match, PoshBot doesn't know who you're talking about.

In the interim, you could have folks on your team change their name, or just use the name you find with that PSSlack output.

Cheers!

1DontEx1st commented 5 years ago

Thanks for the quick response! I had tried the display name, the full name, and the 9-character encoded (?) name, obviously with zero luck. It turns out the name is the same as our AD name, so it's simple for me to deal with, but that wasn't exposed anywhere on Slack's site (at least nowhere I looked). Thanks again, Get-SlackUser worked perfectly!

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

dcvlehr commented 4 years ago

I found the actual user name...rather than running commands, you can go to https://*YourSlackSpace*.slack.com/account/settings#username

The name poshbot needs is in the username field