Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Sep 19, 2023
1 parent 80cc326 commit 9aa8889
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions api/telegram/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ import (

var ErrChatType = errors.New("unsupported chat type (supported options: \"group\", \"private\")")

var btnSubNew = telebot.Btn{
Text: "Setup New Subscription",
WebApp: &telebot.WebApp{
URL: "https://awakari.app/web/sub-new-tg.html",
},
}

func Start(ctx telebot.Context) (err error) {
chat := ctx.Chat()
switch chat.Type {
Expand All @@ -28,16 +35,7 @@ func startGroup(ctx telebot.Context, chatId int64) (err error) {

func startPrivate(ctx telebot.Context, chatId int64) (err error) {
m := &telebot.ReplyMarkup{}
m.Inline(
m.Row(
m.WebApp(
"Setup new subscription",
&telebot.WebApp{
URL: "https://awakari.app/web/sub-new.html",
},
),
),
)
err = ctx.Send("Set up new subscription", m)
m.Reply(m.Row(btnSubNew))
err = ctx.Send("", m)
return
}

0 comments on commit 9aa8889

Please sign in to comment.