c# - long polling api program doesn't make multi threads to make difference between users -
i have telegram bot api program using long polling run bot put function (that enable telegram bot) in global.asax , call in application_start() when start project telegram bot works until has 1 user, when 2nd user start work bot user 2nd user update doesn't make thread , works in following of 1st user progress!
for example: user #1 send message (update) "answerform" bot pass first condition , wait user enter form id in long polling cycle, in time when user start bot , send message him bot receive user 1 form id! guessed make thread him don't know doesn't happen. how can solve this?
static async void testapiasync() { try { var bot = new telegram.bot.telegrambotclient("my_token"); var me = await bot.getmeasync(); int offset = 0; while (true) { var updates = await bot.getupdatesasync(offset); foreach (var update in updates) { offset = update.id + 1; //new offset id if (update.message != null) { if (update.message.text == "answerform") { string askformid = "send form id"; await bot.sendtextmessageasync(update.message.chat.id, askformid); while (true) { //here code //wait user enter form id } } } } } } catch { } }
i found problem! deep , big! in api user not submit thing , in server don't receive continuously thread authenticate each user with!
so solve problem should track each user using save session in db , time send new message follow did before , let them following...
Comments
Post a Comment