mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: notify by telegram while new memo create by HTTP (#2215)
* Inject telegram bot into API service * Add support for send telegram message * Send notification by telegram while new memo post
This commit is contained in:
@ -46,6 +46,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
|
||||
e.HideBanner = true
|
||||
e.HidePort = true
|
||||
|
||||
telegramBot := telegram.NewBotWithHandler(newTelegramHandler(store))
|
||||
s := &Server{
|
||||
e: e,
|
||||
Store: store,
|
||||
@ -53,7 +54,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
|
||||
|
||||
// Asynchronous runners.
|
||||
backupRunner: service.NewBackupRunner(store),
|
||||
telegramBot: telegram.NewBotWithHandler(newTelegramHandler(store)),
|
||||
telegramBot: telegramBot,
|
||||
}
|
||||
|
||||
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
|
||||
@ -103,7 +104,7 @@ func NewServer(ctx context.Context, profile *profile.Profile, store *store.Store
|
||||
s.Secret = secret
|
||||
|
||||
rootGroup := e.Group("")
|
||||
apiV1Service := apiv1.NewAPIV1Service(s.Secret, profile, store)
|
||||
apiV1Service := apiv1.NewAPIV1Service(s.Secret, profile, store, telegramBot)
|
||||
apiV1Service.Register(rootGroup)
|
||||
|
||||
s.apiV2Service = apiv2.NewAPIV2Service(s.Secret, profile, store, s.Profile.Port+1)
|
||||
|
Reference in New Issue
Block a user