refactor: DisableWebPagePreview
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
dc17cf7288
commit
392621b9a5
@ -364,7 +364,7 @@ func (p Plugin) Exec() (err error) {
|
|||||||
|
|
||||||
msg := tgbotapi.NewMessage(user, txt)
|
msg := tgbotapi.NewMessage(user, txt)
|
||||||
msg.ParseMode = p.Config.Format
|
msg.ParseMode = p.Config.Format
|
||||||
msg.DisableWebPagePreview = !p.Config.DisableWebPagePreview
|
msg.DisableWebPagePreview = p.Config.DisableWebPagePreview
|
||||||
if err := p.Send(bot, msg); err != nil {
|
if err := p.Send(bot, msg); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -140,12 +140,13 @@ func TestDisableWebPagePreviewMessage(t *testing.T) {
|
|||||||
plugin.Config.Format = formatMarkdown
|
plugin.Config.Format = formatMarkdown
|
||||||
plugin.Config.Message = "DisableWebPagePreview https://www.google.com.tw"
|
plugin.Config.Message = "DisableWebPagePreview https://www.google.com.tw"
|
||||||
err = plugin.Exec()
|
err = plugin.Exec()
|
||||||
assert.NotNil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|
||||||
// disable message
|
// disable message
|
||||||
plugin.Config.DisableWebPagePreview = false
|
plugin.Config.DisableWebPagePreview = false
|
||||||
|
plugin.Config.Message = "EnableWebPagePreview https://www.google.com.tw"
|
||||||
err = plugin.Exec()
|
err = plugin.Exec()
|
||||||
assert.NotNil(t, err)
|
assert.Nil(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBotError(t *testing.T) {
|
func TestBotError(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user