Skip to content

Commit

Permalink
None: just improve texts
Browse files Browse the repository at this point in the history
  • Loading branch information
AshokShau committed Jul 28, 2024
1 parent d26ecb4 commit 054a9d2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
7 changes: 6 additions & 1 deletion FallenSub/modules/fSub.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ func handleCommand(ctx *ext.Context, b *gotgbot.Bot) error {
}
var text string
if len(ctx.Args()) == 1 {
if fSub.ForceSubChannel == 0 {
text = fmt.Sprintf("Force Sub is %s in %s. \nNo channel set.", onOff(fSub.ForceSub), ctx.EffectiveChat.Title)
}

text = fmt.Sprintf("Force Sub is %s in %s. \nChannelID: %d", onOff(fSub.ForceSub), ctx.EffectiveChat.Title, fSub.ForceSubChannel)

} else {
switch ctx.Args()[1] {
case "enable", "on", "true", "y", "yes":
Expand All @@ -72,7 +77,7 @@ func handleCommand(ctx *ext.Context, b *gotgbot.Bot) error {
text = "Force Sub is already enabled."
case "disable", "off", "false", "n", "no":
if fSub.ForceSub {
if err := db.SetFSub(ctx.EffectiveChat.Id, false); err != nil {
if err = db.SetFSub(ctx.EffectiveChat.Id, false); err != nil {
return logError("Error disabling Force Sub", err)
}
text = "Force Sub disabled."
Expand Down
20 changes: 16 additions & 4 deletions FallenSub/modules/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,22 @@ import (
func start(b *gotgbot.Bot, ctx *ext.Context) error {
text := fmt.Sprintf("Hello, %s!\n\nI am a bot that can help you manage your group by forcing users to join a channel before they can send messages in the group.\n\nTo get started, add me to your group and make me an admin with ban users permission. Then, set the channel that you want users to join using /fsub command.\n\nFor more information, click the button below.", ctx.EffectiveMessage.From.FirstName)
button := gotgbot.InlineKeyboardMarkup{
InlineKeyboard: [][]gotgbot.InlineKeyboardButton{{{
Text: "Help",
Url: "https://abishnoi69.github.io/Force-Sub-Bot/",
}}},
InlineKeyboard: [][]gotgbot.InlineKeyboardButton{
{{
Text: "Add Me To Your Group",
Url: fmt.Sprintf("https://t.me/%s?startgroup=true", b.Username),
}},
{
{
Text: "Update Channel",
Url: "https://t.me/FallenProjects",
},
{
Text: "Help",
Url: "https://abishnoi69.github.io/Force-Sub-Bot/#commands",
},
},
},
}

if _, err := ctx.EffectiveMessage.Reply(b, text, &gotgbot.SendMessageOpts{ReplyMarkup: button}); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions FallenSub/modules/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func isUserExempt(ctx *ext.Context, fSub db.FSub) bool {

func handleGetChatMemberError(b *gotgbot.Bot, chat *gotgbot.Chat, fSub db.FSub, err error) error {
_ = db.SetFSub(chat.Id, false)
text := "Force Sub disabled because I can't get your chat member status. Please add me as an admin."
text := "Force Sub disabled because I can't get your chat member status. Please add me as an admin in your channel and enable force sub again."
_, _ = b.SendMessage(chat.Id, text, nil)
return logError(fmt.Sprintf("[fSubWatcher]Error getting chat member: %s [chatId: %d]", err, fSub.ForceSubChannel), err)
}
Expand All @@ -40,7 +40,7 @@ func restrictUser(b *gotgbot.Bot, chat *gotgbot.Chat, user *gotgbot.User) error
}

func sendJoinChannelMessage(b *gotgbot.Bot, msg *gotgbot.Message, chat *gotgbot.Chat, user *gotgbot.User, inviteLink string) error {
text := "You must join the channel to continue using this group."
text := fmt.Sprintf("🚫 Dear %s,\n\nTo send messages in this group, you must join our channel first. Please click the 'Join Channel' button below to join the channel. After joining, click the 'Unmute Me' button to regain your messaging privileges.\n\nThank you for your cooperation!", user.FirstName)
button := gotgbot.InlineKeyboardMarkup{
InlineKeyboard: [][]gotgbot.InlineKeyboardButton{{
{
Expand Down

0 comments on commit 054a9d2

Please sign in to comment.