Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to retrieve inline "user" and reminders #41

Open
xzavrel opened this issue Jul 29, 2019 · 1 comment
Open

Is there any way to retrieve inline "user" and reminders #41

xzavrel opened this issue Jul 29, 2019 · 1 comment
Labels
enhancement New feature or request priority

Comments

@xzavrel
Copy link

xzavrel commented Jul 29, 2019

Hi I'm curious whether there is any way to retrieve inline "user" and reminders. I know it's in TODO to get them in mardown format, but what about raw data?

@xzavrel
Copy link
Author

xzavrel commented Aug 30, 2019

I found a way. I'm not Python dev.

First you need to get the block properties. Don't get it with block.title method but which returns String but use block.get().get('properties').get('title') which returns structure.

Than you are able to get Users based on mentions:

                for part in block.get().get('properties').get('title'):
                    if len(part) > 1:
                        if part[0] == '‣':
                            if part[1][0][0] == 'u':  # user mention
                                user_id = part[1][0][1]
                                todoAction = todoAction + ' **@' + client.get_user(user_id).full_name + '**'
                                todoActionList.append(' @' + client.get_user(user_id).full_name)

or you can get dates

                            if part[1][0][0] == 'd':  # date
                                dateRecord = part[1][0][1]
                                date = datetime.date.fromisoformat(dateRecord.get('start_date'))
                                dateFormatted = date.strftime('*%d. %m. %Y*')

@jamalex jamalex added enhancement New feature or request priority labels Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority
Projects
None yet
Development

No branches or pull requests

2 participants