Code:
@slackbot.command('hi')
def idk():
user = slackbot.slack_client.api_call(
"users.info",
user=command.user,
)
print(user)
When the user types of command in slack as "!hi", that users information is taken into the command.
This is what I have so far, but how do I now extract purely the users first name?
print(user) at the moment prints everything I need to see, including the 'first_name:"name", but how do I now single this out?
Please help!
api_call returns a dictionary of the user including many variables, which you are setting to user. The general version to get one value is dictionary[<key>], or in your case user["first_name"].