Dispatcher, Commands, Filters, Markdown escaping

This commit is contained in:
2023-01-22 23:54:54 +03:00
parent 677f28182a
commit e2ba9565d5
8 changed files with 133 additions and 20 deletions

View File

@ -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) {