mirror of
https://github.com/kemko/memes-telegram-integration.git
synced 2026-01-01 15:55:41 +03:00
chore: add server start logs
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
SERVER_ADDR=demo.usememos.com
|
SERVER_ADDR=dns:localhost:5230
|
||||||
BOT_TOKEN=your_bot_token
|
BOT_TOKEN=your_bot_token
|
||||||
@@ -16,10 +16,13 @@ Download the binary files for your operating system from the [Releases](https://
|
|||||||
Create a `.env` file in the project's root directory and add the following configuration:
|
Create a `.env` file in the project's root directory and add the following configuration:
|
||||||
|
|
||||||
```env
|
```env
|
||||||
SERVER_ADDR=your_memos_server_address (e.g., https://demo.usememos.com)
|
SERVER_ADDR=dns:localhost:5230
|
||||||
BOT_TOKEN=your_telegram_bot_token
|
BOT_TOKEN=your_telegram_bot_token
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `SERVER_ADDR` should be a gRPC server address that the Memos is running on. It follows the [gRPC Name Resolution
|
||||||
|
](https://github.com/grpc/grpc/blob/master/doc/naming.md).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Starting the Service
|
### Starting the Service
|
||||||
|
|||||||
18
client.go
18
client.go
@@ -6,17 +6,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type MemosClient struct {
|
type MemosClient struct {
|
||||||
AuthService v1pb.AuthServiceClient
|
WorkspaceService v1pb.WorkspaceServiceClient
|
||||||
UserService v1pb.UserServiceClient
|
AuthService v1pb.AuthServiceClient
|
||||||
MemoService v1pb.MemoServiceClient
|
UserService v1pb.UserServiceClient
|
||||||
ResourceService v1pb.ResourceServiceClient
|
MemoService v1pb.MemoServiceClient
|
||||||
|
ResourceService v1pb.ResourceServiceClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMemosClient(conn *grpc.ClientConn) *MemosClient {
|
func NewMemosClient(conn *grpc.ClientConn) *MemosClient {
|
||||||
return &MemosClient{
|
return &MemosClient{
|
||||||
AuthService: v1pb.NewAuthServiceClient(conn),
|
WorkspaceService: v1pb.NewWorkspaceServiceClient(conn),
|
||||||
UserService: v1pb.NewUserServiceClient(conn),
|
AuthService: v1pb.NewAuthServiceClient(conn),
|
||||||
MemoService: v1pb.NewMemoServiceClient(conn),
|
UserService: v1pb.NewUserServiceClient(conn),
|
||||||
ResourceService: v1pb.NewResourceServiceClient(conn),
|
MemoService: v1pb.NewMemoServiceClient(conn),
|
||||||
|
ResourceService: v1pb.NewResourceServiceClient(conn),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,13 @@ func NewService() (*Service, error) {
|
|||||||
|
|
||||||
func (s *Service) Start(ctx context.Context) {
|
func (s *Service) Start(ctx context.Context) {
|
||||||
slog.Info("Memogram started")
|
slog.Info("Memogram started")
|
||||||
|
// Try to get workspace profile.
|
||||||
|
workspaceProfile, err := s.client.WorkspaceService.GetWorkspaceProfile(ctx, &v1pb.GetWorkspaceProfileRequest{})
|
||||||
|
if err != nil {
|
||||||
|
slog.Error("failed to get workspace profile", slog.Any("err", err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
slog.Info("workspace profile", slog.Any("profile", workspaceProfile))
|
||||||
s.bot.Start(ctx)
|
s.bot.Start(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user