Skip to content

Commit 7af48c5

Browse files
committed
Fix a sendMessage id
1 parent 7423204 commit 7af48c5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

telegram-instapy.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@ class customThread (threading.Thread):
3434
def __init__(self, name):
3535
threading.Thread.__init__(self)
3636
self.name = name
37-
def setTelegram(self, bot, chatid):
37+
def setTelegram(self, bot, chat_id):
3838
self.bot = bot
39-
self.chatid = chatid
39+
self.chat_id = chat_id
4040
def run(self):
4141
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")))
4343

4444
threadRun()
4545

4646
endTime = time.strftime("%X")
4747
end = datetime.datetime.now().replace(microsecond=0)
48-
self.bot.send_message(self.chatid, text='InstaPy Bot end at {}\nExecution time {}'.format(time.strftime("%X"), end-start))
48+
self.bot.send_message(self.chat_id, text='InstaPy Bot end at {}\nExecution time {}'.format(time.strftime("%X"), end-start))
4949

5050
# Read the last 9 line to get ended status of InstaPy.
5151
with open('logs/general.log', "r") as f:
@@ -56,7 +56,7 @@ def run(self):
5656

5757
lines = lines[-9:] # Get last 10 lines
5858
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)
6060

6161

6262
def help(bot, update):
@@ -116,15 +116,15 @@ def threadRun():
116116
import traceback
117117
print(traceback.format_exc())
118118

119-
def _execThread(bot, id):
119+
def _execThread(bot, chat_id):
120120
# If thread is not alive or not create start it.
121121
global thread_instaPy
122122
if not thread_instaPy or not thread_instaPy.isAlive():
123123
thread_instaPy = customThread("Thread-InstaPy")
124-
thread_instaPy.setTelegram(bot, id)
124+
thread_instaPy.setTelegram(bot, chat_id)
125125
thread_instaPy.start()
126126
else:
127-
bot.send_message(job.context, text='Bot already executing!')
127+
bot.send_message(chat_id, text='Bot already executing!')
128128

129129
def execThread(bot, job):
130130
_execThread(bot, job.context)

0 commit comments

Comments
 (0)