Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ SERVER_ADDR=dns:localhost:5230
BOT_TOKEN=your_telegram_bot_token
BOT_PROXY_ADDR=https://api.your_proxy_addr.com
ALLOWED_USERNAMES=user1,user2,user3
# APPEND_TEXT=#unchecked_content
```

### Configuration Options
Expand All @@ -28,6 +29,7 @@ ALLOWED_USERNAMES=user1,user2,user3
- `BOT_TOKEN`: Your Telegram bot token
- `BOT_PROXY_ADDR`: Optional proxy address for Telegram API (leave empty if not needed)
- `ALLOWED_USERNAMES`: Optional comma-separated list of allowed usernames (without @ symbol)
- `APPEND_TEXT`: If set, a text to be appended to the user input text (like #unchecked)

### Username Restrictions

Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Config struct {
BotProxyAddr string `env:"BOT_PROXY_ADDR"`
Data string `env:"DATA"`
AllowedUsernames string `env:"ALLOWED_USERNAMES"`
AppendText string `env:"APPEND_TEXT"`
}

func getConfigFromEnv() (*Config, error) {
Expand Down
4 changes: 4 additions & 0 deletions memogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ func (s *Service) Start(ctx context.Context) {
}

func (s *Service) createMemo(ctx context.Context, content string) (*v1pb.Memo, error) {
if s.config.AppendText != "" {
content += "\n" + s.config.AppendText
}

memo, err := s.client.MemoService.CreateMemo(ctx, &v1pb.CreateMemoRequest{
Memo: &v1pb.Memo{
Content: content,
Expand Down