Skip to content

Commit

Permalink
fix(batch): fix html escape error
Browse files Browse the repository at this point in the history
fix(callback): add formatting to texts
  • Loading branch information
Jisin0 committed Jul 17, 2024
1 parent 0071a6c commit 0be543f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var (
<b>Usage</b>
Add the bot to your channel and copy the link of the first and last post(including) from the channel;
<b>Format</b>
<code>/batch <start_post_link> <end_post_link>
<code>/batch start_post_link end_post_link
<b>Example</b>
<code>/batch https://t.me/c/123456789/69 https://t.me/c/123456789/100
</blockquote>`
Expand Down
4 changes: 4 additions & 0 deletions plugins/callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import (
"strings"

"github.com/Jisin0/TGMessageStore/config"
"github.com/Jisin0/TGMessageStore/utils/format"
"github.com/PaulSonOfLars/gotgbot/v2"
"github.com/PaulSonOfLars/gotgbot/v2/ext"
)

// CbCommand handles callback from command buttons.
func CbCommand(bot *gotgbot.Bot, ctx *ext.Context) error {
update := ctx.CallbackQuery
user := ctx.EffectiveUser

split := strings.SplitN(update.Data, "_", 2)
if len(split) < 2 {
Expand All @@ -32,6 +34,8 @@ func CbCommand(bot *gotgbot.Bot, ctx *ext.Context) error {
text = config.CommandNotFound
}

text = format.BasicFormat(text, user)

_, _, err := update.Message.EditText(bot, text, &gotgbot.EditMessageTextOpts{ParseMode: gotgbot.ParseModeHTML, ReplyMarkup: gotgbot.InlineKeyboardMarkup{InlineKeyboard: config.Buttons[cmd]}, LinkPreviewOptions: &gotgbot.LinkPreviewOptions{IsDisabled: true}})
if err != nil {
fmt.Println(err)
Expand Down

0 comments on commit 0be543f

Please sign in to comment.