refactor: remove unnecessary output
This commit is contained in:
14
main.go
14
main.go
@@ -17,20 +17,10 @@ import (
|
|||||||
"go.mau.fi/whatsmeow/proto/waE2E"
|
"go.mau.fi/whatsmeow/proto/waE2E"
|
||||||
"go.mau.fi/whatsmeow/store/sqlstore"
|
"go.mau.fi/whatsmeow/store/sqlstore"
|
||||||
"go.mau.fi/whatsmeow/types"
|
"go.mau.fi/whatsmeow/types"
|
||||||
"go.mau.fi/whatsmeow/types/events"
|
|
||||||
waLog "go.mau.fi/whatsmeow/util/log"
|
waLog "go.mau.fi/whatsmeow/util/log"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
func eventHandler(evt interface{}) {
|
|
||||||
switch v := evt.(type) {
|
|
||||||
case *events.Message:
|
|
||||||
fmt.Println("Received a message from !", v.Info.Sender)
|
|
||||||
|
|
||||||
fmt.Println("Received a message!", v.Message.GetConversation())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func initClient() (*whatsmeow.Client, *sqlstore.Container, waLog.Logger) {
|
func initClient() (*whatsmeow.Client, *sqlstore.Container, waLog.Logger) {
|
||||||
dbLog := waLog.Stdout("Database", "DEBUG", true)
|
dbLog := waLog.Stdout("Database", "DEBUG", true)
|
||||||
// Make sure you add appropriate DB connector imports, e.g. github.com/mattn/go-sqlite3 for SQLite
|
// Make sure you add appropriate DB connector imports, e.g. github.com/mattn/go-sqlite3 for SQLite
|
||||||
@@ -44,9 +34,7 @@ func initClient() (*whatsmeow.Client, *sqlstore.Container, waLog.Logger) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
clientLog := waLog.Stdout("Client", "DEBUG", true)
|
client := whatsmeow.NewClient(deviceStore, nil)
|
||||||
client := whatsmeow.NewClient(deviceStore, clientLog)
|
|
||||||
client.AddEventHandler(eventHandler)
|
|
||||||
|
|
||||||
// handle login via QR
|
// handle login via QR
|
||||||
if client.Store.ID == nil {
|
if client.Store.ID == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user