Dispatcher, Commands, Filters, Markdown escaping
This commit is contained in:
23
update.go
23
update.go
@ -13,6 +13,10 @@ type U echotron.Update
|
||||
|
||||
var emptyOpts = echotron.MessageOptions{}
|
||||
|
||||
type Event interface {
|
||||
Update
|
||||
}
|
||||
|
||||
type Update struct {
|
||||
U
|
||||
Bot *bot
|
||||
@ -20,6 +24,11 @@ type Update struct {
|
||||
Ctx context.Context
|
||||
}
|
||||
|
||||
type UpdateCommand struct {
|
||||
Update
|
||||
Param string
|
||||
}
|
||||
|
||||
func (u *Update) Upd() *echotron.Update {
|
||||
return (*echotron.Update)(&u.U)
|
||||
}
|
||||
@ -169,17 +178,11 @@ func (u *Update) Entities() []*echotron.MessageEntity {
|
||||
}
|
||||
|
||||
func (u *Update) IsUserAdmin() bool {
|
||||
ids := []int64{
|
||||
60441930, // v.rud
|
||||
327487258, // vika shet
|
||||
member, err := u.Bot.GetChatMember(u.ChatID(), u.From().ID)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
from := u.From()
|
||||
for i := range ids {
|
||||
if from.ID == ids[i] {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return member.Result.Status == "administrator" || member.Result.Status == "creator"
|
||||
}
|
||||
|
||||
func (u *Update) LogError(text string, e error, send bool) {
|
||||
|
Reference in New Issue
Block a user