mirror of
https://github.com/kemko/memes-telegram-integration.git
synced 2026-01-01 15:55:41 +03:00
fix: url in bot message (#50)
* fix: url in bot message * Update .env.example Co-authored-by: boojack <24653555+boojack@users.noreply.github.com> * feat: rename MEMOS_ADDR to INSTANCE_URL * feat: rename MEMOS_ADDR to INSTANCE_URL * feat: rename MEMOS_ADDR to INSTANCE_URL * fix: formatting --------- Co-authored-by: boojack <24653555+boojack@users.noreply.github.com>
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
SERVER_ADDR=dns:localhost:5230
|
||||
BOT_TOKEN=your_bot_token
|
||||
INSTANCE_URL=https://memos.example.com
|
||||
|
||||
@@ -18,6 +18,7 @@ Create a `.env` file in the project's root directory and add the following confi
|
||||
```env
|
||||
SERVER_ADDR=dns:localhost:5230
|
||||
BOT_TOKEN=your_telegram_bot_token
|
||||
INSTANCE_URL=https://memos.example.com
|
||||
```
|
||||
|
||||
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).
|
||||
@@ -64,6 +65,7 @@ Or you can start the service with Docker Compose. This can be combined with the
|
||||
```sh
|
||||
SERVER_ADDR=dns:yourMemosUrl.com:5230
|
||||
BOT_TOKEN=your_telegram_bot_token
|
||||
INSTANCE_URL=https://memos.example.com
|
||||
```
|
||||
4. Create Docker Compose `docker-compose.yml` file:
|
||||
```yaml
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
type Config struct {
|
||||
ServerAddr string `env:"SERVER_ADDR,required"`
|
||||
BotToken string `env:"BOT_TOKEN,required"`
|
||||
InstanceUrl string `env:"INSTANCE_URL"`
|
||||
Data string `env:"DATA"`
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ func (s *Service) handler(ctx context.Context, b *bot.Bot, m *models.Update) {
|
||||
|
||||
b.SendMessage(ctx, &bot.SendMessageParams{
|
||||
ChatID: m.Message.Chat.ID,
|
||||
Text: fmt.Sprintf("Content saved as %s with [%s](%s/m/%s)", v1pb.Visibility_name[int32(memo.Visibility)], memo.Name, s.config.ServerAddr, memo.Uid),
|
||||
Text: fmt.Sprintf("Content saved as %s with [%s](%s/m/%s)", v1pb.Visibility_name[int32(memo.Visibility)], memo.Name, s.config.InstanceUrl, memo.Uid),
|
||||
ParseMode: models.ParseModeMarkdown,
|
||||
DisableNotification: true,
|
||||
ReplyParameters: &models.ReplyParameters{
|
||||
|
||||
Reference in New Issue
Block a user