File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " telegram-bot"
3- version = " 0.1.1 "
3+ version = " 0.1.2 "
44authors = [" Lukas Kalbertodt <lukas.kalbertodt@gmail.com>" ]
55
66description = " A library for creating Telegram bots."
Original file line number Diff line number Diff line change @@ -169,14 +169,19 @@ impl Bot {
169169 /// the same update twice.
170170 /// The `timeout` parameter influences how long (in seconds) each poll may
171171 /// last. Defaults to 30.
172+ /// The handler gets a mutable reference to the bot since borrowing it
173+ /// from the outer scope won't work. When the handler returns an `Err`
174+ /// value the bot will stop listening for updates and `long_poll` will
175+ /// return the Error. If you want to stop listening you can just return
176+ /// `Error::UserInterrupt`.
172177 ///
173178 /// **Note:**
174179 /// If the bot is restarted, but the last received updates are not yet
175180 /// confirmed (the last poll was not empty), there will be some duplicate
176181 /// updates.
177- pub fn long_poll < H > ( & mut self , timeout : Option < Integer > , handler : H )
182+ pub fn long_poll < H > ( & mut self , timeout : Option < Integer > , mut handler : H )
178183 -> Result < ( ) >
179- where H : Fn ( & mut Bot , Update ) -> Result < ( ) > {
184+ where H : FnMut ( & mut Bot , Update ) -> Result < ( ) > {
180185 // Calculate final timeout: Given or default (30s)
181186 let timeout = timeout. or ( Some ( 30 ) ) ;
182187
You can’t perform that action at this time.
0 commit comments