@@ -34,18 +34,18 @@ class customThread (threading.Thread):
34
34
def __init__ (self , name ):
35
35
threading .Thread .__init__ (self )
36
36
self .name = name
37
- def setTelegram (self , bot , chatid ):
37
+ def setTelegram (self , bot , chat_id ):
38
38
self .bot = bot
39
- self .chatid = chatid
39
+ self .chat_id = chat_id
40
40
def run (self ):
41
41
start = datetime .datetime .now ().replace (microsecond = 0 )
42
- self .bot .send_message (self .chatid , text = 'InstaPy Bot start at {}' .format (time .strftime ("%X" )))
42
+ self .bot .send_message (self .chat_id , text = 'InstaPy Bot start at {}' .format (time .strftime ("%X" )))
43
43
44
44
threadRun ()
45
45
46
46
endTime = time .strftime ("%X" )
47
47
end = datetime .datetime .now ().replace (microsecond = 0 )
48
- self .bot .send_message (self .chatid , text = 'InstaPy Bot end at {}\n Execution time {}' .format (time .strftime ("%X" ), end - start ))
48
+ self .bot .send_message (self .chat_id , text = 'InstaPy Bot end at {}\n Execution time {}' .format (time .strftime ("%X" ), end - start ))
49
49
50
50
# Read the last 9 line to get ended status of InstaPy.
51
51
with open ('logs/general.log' , "r" ) as f :
@@ -56,7 +56,7 @@ def run(self):
56
56
57
57
lines = lines [- 9 :] # Get last 10 lines
58
58
message = '' .join (str (x .replace ("INFO - " , "" )) for x in lines )
59
- self .bot .send_message (self .chatid , text = message )
59
+ self .bot .send_message (self .chat_id , text = message )
60
60
61
61
62
62
def help (bot , update ):
@@ -116,15 +116,15 @@ def threadRun():
116
116
import traceback
117
117
print (traceback .format_exc ())
118
118
119
- def _execThread (bot , id ):
119
+ def _execThread (bot , chat_id ):
120
120
# If thread is not alive or not create start it.
121
121
global thread_instaPy
122
122
if not thread_instaPy or not thread_instaPy .isAlive ():
123
123
thread_instaPy = customThread ("Thread-InstaPy" )
124
- thread_instaPy .setTelegram (bot , id )
124
+ thread_instaPy .setTelegram (bot , chat_id )
125
125
thread_instaPy .start ()
126
126
else :
127
- bot .send_message (job . context , text = 'Bot already executing!' )
127
+ bot .send_message (chat_id , text = 'Bot already executing!' )
128
128
129
129
def execThread (bot , job ):
130
130
_execThread (bot , job .context )
0 commit comments