# -*- coding: utf-8 -*-
from linepy import *

client = LineClient()
#client = LineClient(authToken='AUTHTOKEN')

client.log("Auth Token : " + str(client.authToken))

# Initialize LineChannel with LineClient
channel = LineChannel(client)
client.log("Channel Access Token : " + str(channel.channelAccessToken))

poll = LinePoll(client)

while True:
    try:
        ops=poll.singleTrace(count=50)
    except Exception as e:
        client.log("[SINGLE_TRACE] ERROR : " + str(e))
    
    for op in ops:
        # Receive messages
        if op.type == OpType.RECEIVE_MESSAGE:
            '''
                This is sample for implement BOT in LINE group
                Invite your BOT to group, then BOT will auto accept your invitation
                Command availabe :
                > hi
                > /author
            '''
            msg = op.message
            
            text = msg.text
            msg_id = msg.id
            receiver = msg.to
            sender = msg._from
            
            try:
                # Check content only text message
                if msg.contentType == 0:
                    # Check only group chat
                    if msg.toType == 2:
                        # Chat checked request
                        client.sendChatChecked(receiver, msg_id)
                        # Get sender contact
                        contact = client.getContact(sender)
                        # Command list
                        if text.lower() == 'hi':
                            client.log('[%s] %s' % (contact.displayName, text))
                            client.sendMessage(receiver, 'Hi too! How are you?')
                        elif text.lower() == '/author':
                            client.log('[%s] %s' % (contact.displayName, text))
                            client.sendMessage(receiver, 'My author is linepy')
            except Exception as e:
                client.log("[RECEIVE_MESSAGE] ERROR : " + str(e))
        # Auto join if BOT invited to group
        elif op.type == OpType.NOTIFIED_INVITE_INTO_GROUP:
            try:
                group_id=op.param1
                # Accept group invitation
                client.acceptGroupInvitation(group_id)
            except Exception as e:
                client.log("[NOTIFIED_INVITE_INTO_GROUP] ERROR : " + str(e))
        else:
            pass

        # Don't remove this line, if you wan't get error soon!
        poll.setRevision(op.revision)
@@ -396,91 +396,17 @@
     
-except Exception as e:%0A        client.log(%22%5BSINGLE_TRACE%5D ERROR : %22 + str(e))
+    
 %0A    
-%0A
     
@@ -428,16 +428,20 @@
         
+    
 # Receiv
@@ -459,16 +459,20 @@
         
+ 
+   
 if op.ty
@@ -505,36 +505,44 @@
 GE:%0A            
-'''%0A
+    '''%0A    
                 
@@ -604,16 +604,20 @@
         
+    
 Invite y
@@ -692,16 +692,20 @@
         
+    
 Command 
@@ -715,16 +715,20 @@
 ilabe :%0A
+    
         
@@ -756,16 +756,20 @@
         
+    
 %3E /autho
@@ -774,32 +774,36 @@
 hor%0A            
+    
 '''%0A            
@@ -802,16 +802,20 @@
         
+   
+ 
 msg = op
@@ -823,29 +823,21 @@
 message%0A
-        
+%0A
     
-%0A
         
@@ -868,16 +868,20 @@
         
+    
 msg_id =
@@ -888,16 +888,20 @@
  msg.id%0A
+    
         
@@ -934,16 +934,20 @@
         
+   
+ 
 sender =
@@ -961,21 +961,13 @@
 rom%0A
-        
+%0A
     
-%0A
     
@@ -987,32 +987,36 @@
                 
+    
 # Check content 
@@ -1045,24 +1045,28 @@
             
+    
 if msg.conte
@@ -1090,32 +1090,36 @@
                 
+   
+ 
 # Check only gro
@@ -1126,16 +1126,20 @@
 up chat%0A
+    
         
@@ -1190,24 +1190,28 @@
             
+    
 # Chat check
@@ -1237,32 +1237,36 @@
                 
+  
+  
 client.sendChatC
@@ -1286,24 +1286,28 @@
 er, msg_id)%0A
+    
             
@@ -1363,16 +1363,20 @@
         
+    
 contact 
@@ -1427,16 +1427,20 @@
         
+ 
+   
 # Comman
@@ -1446,16 +1446,20 @@
 nd list%0A
+    
         
@@ -1499,16 +1499,20 @@
 = 'hi':%0A
+    
         
@@ -1603,32 +1603,36 @@
                 
+ 
+   
 client.sendMessa
@@ -1688,24 +1688,28 @@
             
+    
 elif text.lo
@@ -1728,16 +1728,20 @@
 uthor':%0A
+    
         
@@ -1832,32 +1832,36 @@
                 
+    
 client.sendMessa
@@ -1900,32 +1900,36 @@
 y')%0A            
+    
 except Exception
@@ -1943,32 +1943,36 @@
                 
+   
+ 
 client.log(%22%5BREC
@@ -2013,16 +2013,20 @@
         
+    
 # Auto j
@@ -2057,24 +2057,28 @@
 oup%0A        
+ 
+   
 elif op.type
@@ -2120,37 +2120,45 @@
 UP:%0A            
+  
+  
 try:%0A
+    
                 
@@ -2192,16 +2192,20 @@
         
+    
 # Accept
@@ -2234,24 +2234,28 @@
             
+  
+  
 client.accep
@@ -2277,24 +2277,28 @@
 n(group_id)%0A
+    
             
@@ -2328,32 +2328,36 @@
                 
+    
 client.log(%22%5BNOT
@@ -2413,14 +2413,22 @@
     
+ 
+   
 else:%0A
+    
     
@@ -2441,16 +2441,20 @@
   pass%0A%0A
+    
         
@@ -2516,16 +2516,20 @@
         
+    
 poll.set
@@ -2549,8 +2549,104 @@
 evision)
+%0A            %0A    except Exception as e:%0A        client.log(%22%5BSINGLE_TRACE%5D ERROR : %22 + str(e))%0A

Update singletrace.py