Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for groups #25

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

yangchuansheng
Copy link

react only for mention in group or for all messages directly in private chats

react only for mention in group or for all messages directly in private chats
@JohnnySun
Copy link

image

@JohnnySun
Copy link

need import strings

Signed-off-by: Administrator <[email protected]>
@realies
Copy link

realies commented Dec 7, 2022

You can use the native IsGroup and IsSuperGroup methods.

PS: Does this work in groups when the bot's privacy mode is enabled?

@stebansaa
Copy link

I'm still getting a message "You are not authorized to use this bot." , when using the bot in a group.

@herman925
Copy link

I'm still getting a message "You are not authorized to use this bot." , when using the bot in a group.

Same here

@yangchuansheng
Copy link
Author

I'm still getting a message "You are not authorized to use this bot." , when using the bot in a group.

Same here

Leave TELEGRAM_ID empty

@Pylogmon
Copy link

When receiving a group message, should you delete the prefix before sending it?
like this:

feed, err := chatGPT.SendMessage(strings.TrimPrefix(updateText,"@" + bot.Username), updateChatID)

@waltcow
Copy link

waltcow commented Dec 11, 2022

IMO, we should support both
strings.HasPrefix(update.Message.Text, "@"+bot.Username) OR strings.HasSuffix(update.Message.Text, "@"+bot.Username)

isChatBotInGroup := update.Message.Chat.Type == "group" || update.Message.Chat.Type == "supergroup"
isAtChatBot := strings.HasPrefix(update.Message.Text, "@"+bot.Username) || strings.HasSuffix(update.Message.Text, "@"+bot.Username)
isPrivateChat := update.Message.Chat.IsPrivate()

if !update.Message.IsCommand() && (isChatBotInGroup && isAtChatBot || isPrivateChat) {


}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants