Skip to content

Commit

Permalink
add support for groups
Browse files Browse the repository at this point in the history
react only for mention in group or for all messages directly in private chats
  • Loading branch information
yangchuansheng committed Dec 6, 2022
1 parent 30cd60d commit e6c1022
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func main() {
}

bot.Request(tgbotapi.NewChatAction(update.Message.Chat.ID, "typing"))
if !update.Message.IsCommand() {
if !update.Message.IsCommand() && (update.Message.Chat.IsPrivate() || (update.Message.Chat.Type == "group" || update.Message.Chat.Type == "supergroup") && strings.HasPrefix(update.Message.Text, "@" + bot.Self.UserName)) {
feed, err := chatGPT.SendMessage(update.Message.Text, userConversations[update.Message.Chat.ID].ConversationID, userConversations[update.Message.Chat.ID].LastMessageID)
if err != nil {
msg.Text = fmt.Sprintf("Error: %v", err)
Expand Down

0 comments on commit e6c1022

Please sign in to comment.