commit 35b303f796c4ed30d8526d0ce7dd4467b1c32a41
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2022-09-25T11:09:03Z |
| subject | Use negative chat id to detect group |
commit 35b303f796c4ed30d8526d0ce7dd4467b1c32a41
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2022-09-25T11:09:03Z
Use negative chat id to detect group
---
main.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/main.go b/main.go
index 58f9d1b..09fd0fa 100644
--- a/main.go
+++ b/main.go
@@ -33,7 +33,9 @@ func main() {
mesg, err := mtrbus.Query( "zh-Hant", update.Message.Text ).Message()
- if update.Message.Chat.IsGroup() {
+ isGroup := ( update.Message.Chat.ID < 0 )
+
+ if isGroup {
if err == nil {
msg := tgbotapi.NewMessage( update.Message.Chat.ID, mesg )
msg.ParseMode = "MarkdownV2"
@@ -63,7 +65,7 @@ func main() {
}
err = err2
- if update.Message.Chat.IsGroup() {
+ if isGroup {
if err == nil {
msg := tgbotapi.NewMessage( update.Message.Chat.ID, mesg )
msg.ParseMode = "MarkdownV2"