~mendelmaleh/tg_whoisbot

5581bdb057dcd23334a5c44211e35aa2ca9f58d9 — Mendel E 4 months ago ad45a56 master
Formatting
1 files changed, 6 insertions(+), 11 deletions(-)

M main.go
M main.go => main.go +6 -11
@@ 42,22 42,18 @@ func main() {
		log.Fatal(err)
	}

	updater := ext.NewUpdater(&ext.UpdaterOpts{
		DispatcherOpts: ext.DispatcherOpts{
			Error: func(bot *gotgbot.Bot, ctx *ext.Context, err error) ext.DispatcherAction {
				log.Println("error handling update:", err)
				return ext.DispatcherActionNoop
			},
	updater := ext.NewUpdater(&ext.UpdaterOpts{DispatcherOpts: ext.DispatcherOpts{
		Error: func(bot *gotgbot.Bot, ctx *ext.Context, err error) ext.DispatcherAction {
			log.Println("error handling update:", err)
			return ext.DispatcherActionNoop
		},
	})
	}})

	dispatcher := updater.Dispatcher
	dispatcher.AddHandler(handlers.NewInlineQuery(inlinequery.All, handler))

	if err := updater.StartPolling(bot, &ext.PollingOpts{
		GetUpdatesOpts: gotgbot.GetUpdatesOpts{
			AllowedUpdates: []string{},
		},
		GetUpdatesOpts: gotgbot.GetUpdatesOpts{AllowedUpdates: []string{}},
	}); err != nil {
		log.Fatal("failed to start polling:", err)
	}


@@ 110,6 106,5 @@ func handler(bot *gotgbot.Bot, ctx *ext.Context) error {
	}}, nil)

	log.Printf("query from [%d]: %q, domain: %q, whois success", q.From.Id, q.Query, domain)

	return err
}