Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
fix(bot): source title error when unsub by button
Browse files Browse the repository at this point in the history
  • Loading branch information
indes committed Jun 14, 2019
1 parent 0ca7ccd commit 4b8e3c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,11 @@ func makeHandle() {
switch UserState[m.Chat.ID] {
case fsm.UnSub:
{
url, _ := GetUrlAndMentionFromMessage(m)
source, _ := model.GetSourceByUrl(url)

str := strings.Split(m.Text, " ")
url := str[len(str)-1]

if len(str) != 2 && !CheckUrl(url) {
_, _ = B.Send(m.Chat, "请选择正确的指令!")
} else {
Expand All @@ -497,7 +500,7 @@ func makeHandle() {
} else {
_, _ = B.Send(
m.Chat,
fmt.Sprintf("[%s](%s) 退订成功", str[0], url),
fmt.Sprintf("[%s](%s) 退订成功", source.Title, source.Link),
&tb.SendOptions{
ParseMode: tb.ModeMarkdown,
}, &tb.ReplyMarkup{
Expand All @@ -523,6 +526,7 @@ func makeHandle() {

case fsm.Set:
{

str := strings.Split(m.Text, " ")
url := str[len(str)-1]
if len(str) != 2 && !CheckUrl(url) {
Expand Down

0 comments on commit 4b8e3c0

Please sign in to comment.