mirror of
https://github.com/tiennm99/export-telegram-group-members.git
synced 2026-10-11 03:13:26 +00:00
feat(core): add reply function
This commit is contained in:
1 parent
88e425081b
commit
382e4f7fbf
2 files changed
+18
-1
No files matched your search
@@ -1,3 +1,7 @@
|
||||
*.sqlite3
|
||||
|
||||
|
||||
|
||||
# If you prefer the allow list template instead of the deny list, see community template:
|
||||
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
|
||||
#
|
||||
|
||||
@@ -7,6 +7,9 @@ import (
|
||||
"strconv"
|
||||
|
||||
"github.com/celestix/gotgproto"
|
||||
"github.com/celestix/gotgproto/dispatcher/handlers"
|
||||
"github.com/celestix/gotgproto/dispatcher/handlers/filters"
|
||||
"github.com/celestix/gotgproto/ext"
|
||||
"github.com/celestix/gotgproto/sessionMaker"
|
||||
"github.com/joho/godotenv"
|
||||
"gorm.io/driver/sqlite"
|
||||
@@ -45,7 +48,7 @@ func main() {
|
||||
gotgproto.ClientTypePhone(phoneNumber),
|
||||
// Optional parameters of client
|
||||
&gotgproto.ClientOpts{
|
||||
Session: sessionMaker.SqlSession(sqlite.Open("echobot")),
|
||||
Session: sessionMaker.SqlSession(sqlite.Open("echobot.sqlite3")),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -54,5 +57,15 @@ func main() {
|
||||
|
||||
fmt.Printf("client (@%s) has been started...\n", client.Self.Username)
|
||||
|
||||
clientDispatcher := client.Dispatcher
|
||||
|
||||
clientDispatcher.AddHandlerToGroup(handlers.NewMessage(filters.Message.Text, echo), 1)
|
||||
|
||||
client.Idle()
|
||||
}
|
||||
|
||||
func echo(ctx *ext.Context, update *ext.Update) error {
|
||||
msg := update.EffectiveMessage
|
||||
_, err := ctx.Reply(update, ext.ReplyTextString(msg.Text), nil)
|
||||
return err
|
||||
}
|
||||
Reference in new issue
Block a user