Added updatesChannel type with Clear() method

This commit is contained in:
lupoDharkael 2016-12-15 22:51:58 +01:00
parent e2916e08ad
commit 66446d51ff
2 changed files with 22 additions and 9 deletions

View file

@ -37,6 +37,16 @@ type Update struct {
CallbackQuery *CallbackQuery `json:"callback_query"`
}
//updatesChannel is the channel for getting updates.
type updatesChannel <-chan Update
//Clear discards all the actual incoming updates
func (ch updatesChannel) Clear() {
for len(ch) != 0 {
<-ch
}
}
// User is a user on Telegram.
type User struct {
ID int `json:"id"`