messages 리스트로 오는데 그 중 하나 추출 예제
{ 'bot_id': 'B02MC36L1PU', 'type': 'message', 'text': '', 'user': 'U02LXDBJZRV', 'ts': '1637159014.020800', 'team': 'T02M3GHM1L6', 'bot_profile': { 'id': 'B02MC36L1PU', 'deleted': False, 'name': 'GitHub', 'updated': 1636984097, 'app_id': 'A01BP7R4KNY', 'icons': { 'image_36': 'https://avatars.slack-edge.com/2020-11-25/1527503386626_319578f21381f9641cd8_36.png', 'image_48': 'https://avatars.slack-edge.com/2020-11-25/1527503386626_319578f21381f9641cd8_48.png', 'image_72': 'https://avatars.slack-edge.com/2020-11-25/1527503386626_319578f21381f9641cd8_72.png' }, 'team_id': 'T02M3GHM1L6' }, 'attachments': [{ 'fallback': '[junho85/TIL] 1 new commit pushed to _master_ by junho85', 'text': '`<https://github.com/junho85/TIL/commit/a706a7a012ae4cd568fb0b225c826bb0fc1ef725|a706a7a0>` - 정원사들 시즌7 설치 문서 정리 중\n', 'pretext': '<https://github.com/junho85/TIL/compare/5ae9faa91fc4...a706a7a012ae|1 new commit> pushed to `<https://github.com/junho85/TIL/tree/master|master>` by <https://github.com/junho85|junho85>', 'footer': '<https://github.com/junho85/TIL|junho85/TIL>', 'id': 1, 'footer_icon': 'https://slack.github.com/static/img/favicon-neutral.png', 'color': '24292f', 'mrkdwn_in': ['text'] }] }
-
save all slack messages from #commit channel
{ts, attachments, bot_id, bot_profile, team, text, ts, type, user}
slack_messages 에 저장된 데이터 예. mongodb 에 넣으면서 _id 가 자동 추가 됩니다. 날짜 range 로 검색을 편리하게 하기위해 ts 는 ts_for_db 라는 timestamp type 으로 변경해서 넣습니다.
{
'_id': ObjectId('5db5a705f7cf4f12ad0d8c1b'),
'bot_id': 'BNGD110UR',
'type': 'message',
'text': '',
'user': 'UNR1ZN80N',
'ts': '1572770390.091000',
'ts_for_db': datetime.datetime(2019, 10, 2, 20, 57, 55, 26000),
'team': 'TNMAF3TT2',
'bot_profile': {
'id': 'BNGD110UR',
'deleted': False,
'name': 'GitHub',
'updated': 1569307567,
'app_id': 'A8GBNUWU8',
'icons': {
'image_36': 'https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2017-12-19/288981919427_f45f04edd92902a96859_36.png',
'image_48': 'https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2017-12-19/288981919427_f45f04edd92902a96859_48.png',
'image_72': 'https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2017-12-19/288981919427_f45f04edd92902a96859_72.png'
},
'team_id': 'TNMAF3TT2'
},
'attachments': [{
'author_name': 'junho85',
'fallback': '[junho85/TIL] <https://github.com/junho85/TIL/compare/33da42459485...a29a33f31b08|2 new commits> pushed to <https://github.com/junho85/TIL/tree/master|`master`>',
'text': '*<https://github.com/junho85/TIL/compare/33da42459485...a29a33f31b08|2 new commits> pushed to <https://github.com/junho85/TIL/tree/master|`master`>*\n<https://github.com/junho85/TIL/commit/027dfe626170f09e8c1deb5e75b4fc4e9565ffce|`027dfe62`> - javascript - date - moment\n<https://github.com/junho85/TIL/commit/a29a33f31b08767a228701a4737c131d75902ab9|`a29a33f3`> - postgresql',
'footer': '<https://github.com/junho85/TIL|junho85/TIL>',
'id': 1,
'author_link': 'https://github.com/junho85',
'author_icon': 'https://avatars3.githubusercontent.com/u/1219373?v=4',
'footer_icon': 'https://github.githubassets.com/favicon.ico',
'color': '24292f',
'mrkdwn_in': ['text']
}]
}
ts_for_db