itzngga / roxy Goto Github PK
View Code? Open in Web Editor NEWCommand Handler Abstraction for Whatsapp Bot
License: GNU General Public License v3.0
Command Handler Abstraction for Whatsapp Bot
License: GNU General Public License v3.0
Saya coba buat instance whatsapp client dengan konfigurasi seperti ini (full code-nya ada di repo ini):
package main
import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
"github.com/itzngga/goRoxy/core"
"github.com/itzngga/goRoxy/options"
"github.com/joho/godotenv"
_ "botwhatsapp/command"
_ "github.com/lib/pq"
)
func main() {
err := godotenv.Load()
if err != nil {
log.Fatalln("Error loading .env file")
}
options := options.Options{
HostNumber: os.Getenv("HOST_NUMBER"),
StoreMode: "postgres",
PostgresDsn: fmt.Sprintf("user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", os.Getenv("PG_USERNAME"), os.Getenv("PG_PASSWORD"), os.Getenv("PG_DB_NAME"), os.Getenv("PG_PORT")),
WithCommandLog: true,
LogLevel: "DEBUG",
WithHelpCommand: true,
HelpTitle: "Kurisu Bot",
HelpDescription: "Konniciwa minna san~",
HelpFooter: "2023 copyright kurisu bot",
}
fmt.Println(&options)
return
app := core.NewGoRoxyBase(options)
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c
app.Shutdown()
}
dan mendapatkan error seperti berikut pada saat go run main.go
:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0xa714dc]
goroutine 1 [running]:
github.com/itzngga/goRoxy/core.(*App).PrepareClient(0xc00012c780)
/home/reyuki/go/pkg/mod/github.com/itzngga/go![email protected]
15-fe6e79f38262/core/app.go:135 +0x31c
github.com/itzngga/goRoxy/core.NewGoRoxyBase({{0xc0001442ac, 0x11}, {0xbfe641,
0x8}, {0xbfa611, 0x5}, {0xc00010e3c0, 0x59}, {0x0, 0x0}, ...})
/home/reyuki/go/pkg/mod/github.com/itzngga/go![email protected]
15-fe6e79f38262/core/app.go:47 +0x1b0
main.main()
/home/reyuki/Desktop/practice/botwhatsapp/main.go:37 +0x298
exit status 2
apakah ada yang saya lewati? atau ada bug di package goRoxynya?
for postgresql, i use this way:
PostgresDsn: &options.PostgresDSN{
Username: os.Getenv("PG_USERNAME"),
Password: os.Getenv("PG_PASSWORD"),
Database: os.Getenv("PG_DB_NAME"),
Port: os.Getenv("PG_PORT"),
SslMode: "disable",
TimeZone: "Asia/Jakarta",
},
because current example throw an error: multiple-value options.NewPostgresDSN("username", "password", "dbname", "port", "disable", "Asia/Jakarta") (value of type (*"github.com/itzngga/Roxy/options".PostgresDSN, error)) in single-value contextcompiler[TooManyValues](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#TooManyValues)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.