Код: Выделить всё
client = TelegramClient('123445.session', '#####', '#####',flood_sleep_threshold=0)
@client.on(events.NewMessage(chats=[x[0] for x in idList.items()]))
async def my_event_handler(event):
nowDate = datetime.now()
verified, groupVerified,logBookList,queueList, ticker,dateOfMessage,signalled,endOfSignalled,stopReload,priceVerify, includesImage, nonTrade,notVerified,pumpVerified,tickerNotFound,username,newMessage,includesImageTag,startOfTickerFinder,endOfTickerFinder = 0,1,[],[],0,event.message.date,"Message Time: "+str(event.message.date),"Signalled: "+str(datetime.now()),1,0,False,0,0,0,0,event.chat.username,(event.message.message.encode("utf-8")).decode("utf-8"),"","Ticker Finder not used", "Ticker Finder not used"
global previousMessage,accountsList,offSwitch,previousTickers,switchSelector,groupDict,idList
if event.photo != None: includesImage,includesImageTag = True,"{INCLUDES IMAGE}"
userDict = {'username':str(username),
'switchSelectorNumber':str(groupDict[username][0]),
'sellLimit':float(groupDict[username][1]),
'stopLoss':float(groupDict[username][2]),
'group':str(username),
'logBookNumber':str(groupDict[username][4]),
'timeLimit':float(groupDict[username][5]),
'amountPercentage':float(groupDict[username][6]),
'timeout': float(groupDict[username][10])
}
if nowDate.timestamp() - dateOfMessage.timestamp() > 120:
#try:
startOfTickerFinder = "Start of ticker finder: "+str(datetime.now())
nonTradeTicker = tickerfinder.findticker(newMessage,userDict['username'],previousMessage[userDict['username']],includesImage)
endOfTickerFinder = "End of ticker finder: "+str(datetime.now())
#except:
#nonTradeTicker = (0,0)
timeFrameList = getTradeInfo(str(userDict['username']))
stopList = getStopInfo(str(userDict['username']))
Подробнее здесь: https://stackoverflow.com/questions/786 ... te-handler