|
52 | 52 | # get channel_secret and channel_access_token from your environment variable
|
53 | 53 | channel_secret = os.getenv('LINE_CHANNEL_SECRET', None)
|
54 | 54 | channel_access_token = os.getenv('LINE_CHANNEL_ACCESS_TOKEN', None)
|
55 |
| -if channel_secret is None: |
56 |
| - print('Specify LINE_CHANNEL_SECRET as environment variable.') |
57 |
| - sys.exit(1) |
58 |
| -if channel_access_token is None: |
59 |
| - print('Specify LINE_CHANNEL_ACCESS_TOKEN as environment variable.') |
| 55 | +if channel_secret is None or channel_access_token is None: |
| 56 | + print('Specify LINE_CHANNEL_SECRET and LINE_CHANNEL_ACCESS_TOKEN as environment variables.') |
60 | 57 | sys.exit(1)
|
61 | 58 |
|
62 | 59 | line_bot_api = LineBotApi(channel_access_token)
|
@@ -379,7 +376,7 @@ def handle_location_message(event):
|
379 | 376 | line_bot_api.reply_message(
|
380 | 377 | event.reply_token,
|
381 | 378 | LocationSendMessage(
|
382 |
| - title=event.message.title, address=event.message.address, |
| 379 | + title='Location', address=event.message.address, |
383 | 380 | latitude=event.message.latitude, longitude=event.message.longitude
|
384 | 381 | )
|
385 | 382 | )
|
@@ -445,13 +442,14 @@ def handle_file_message(event):
|
445 | 442 |
|
446 | 443 | @handler.add(FollowEvent)
|
447 | 444 | def handle_follow(event):
|
| 445 | + app.logger.info("Got Follow event:" + event.source.user_id) |
448 | 446 | line_bot_api.reply_message(
|
449 | 447 | event.reply_token, TextSendMessage(text='Got follow event'))
|
450 | 448 |
|
451 | 449 |
|
452 | 450 | @handler.add(UnfollowEvent)
|
453 |
| -def handle_unfollow(): |
454 |
| - app.logger.info("Got Unfollow event") |
| 451 | +def handle_unfollow(event): |
| 452 | + app.logger.info("Got Unfollow event:" + event.source.user_id) |
455 | 453 |
|
456 | 454 |
|
457 | 455 | @handler.add(JoinEvent)
|
|
0 commit comments