Skip to content

Commit

Permalink
attempting to fix google colab issue. no result yet
Browse files Browse the repository at this point in the history
  • Loading branch information
doy committed Apr 16, 2024
1 parent 00823dd commit f388b45
Show file tree
Hide file tree
Showing 16 changed files with 572 additions and 626 deletions.
Empty file added ,
Empty file.
17 changes: 16 additions & 1 deletion examples/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
basic usages
"""

whatsapp = WhatsApp()

response = whatsapp.send_messages(phone="6283139750000", message= "Hello World!")
def my_event_callback(event_data):
''' this is an example to listen to incoming messages. '''
print("Received event data:", event_data)

whatsapp = WhatsApp(event_callback=my_event_callback)

phone = "6283139750000" # make sure to attach country code + phone number
message = "Hello World!"

print(f"send message : {send_msg}")
response = whatsapp.send_message(phone=phone, message=message)

# listening to incoming messages
while True:
my_event_callback()
4 changes: 3 additions & 1 deletion whatsfly/dependencies/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ Simply take a look to the `build.sh` file for how each code compiled for each ma

3. Supposed you using an ubuntu machine and want to compile for all machines:
```
sudo apt-get install gcc-multilib gcc-aarch64-linux-gnu gcc-mingw-w64-x86-64 libc6-dev linux-libc-dev:i386 gcc-aarch64-linux-gnu
sudo apt-get install gcc-multilib linux-libc-dev gcc-mingw-w64-x86-64 libc6-dev
```
*when gcc-multilib is installed, compiling for linux ARM need to do a separated install: gcc-aarch64-linux-gnu*
*consider to install linux-libc-dev:i386 for compiling 32bit machine*

4. Once the build tools are installed, navigate to the repository directory and execute the `./build.sh all` script.

Expand Down
26 changes: 13 additions & 13 deletions whatsfly/dependencies/build.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
#!/bin/sh

# This build.sh file was borrowed from https://github.com/bogdanfinn/tls-client/blob/master/cffi_whatsmeow/build.sh
# make sure you have installed all build tools on your machine. ie in ubuntu: sudo apt-get install gcc-aarch64-linux-gnu gcc-mingw-w64-x86-64 libc6-dev


# echo 'Build OSX'
# GOOS=darwin GOARCH=arm64 go build -o ./whatsmeow/whatsmeow-darwin-arm64.dylib -buildmode=c-shared main.go
# GOOS=darwin GOARCH=amd64 go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-darwin-amd64.dylib main.go
# make sure you have installed all build tools on your machine. ie in ubuntu:
# sudo apt-get install gcc-aarch64-linux-gnu gcc-mingw-w64-x86-64 libc6-dev sudo apt-get install gcc-aarch64-linux-gnu sudo apt-get install gcc-multilib

echo 'Build for Linux Ubuntu'
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -buildmode=c-shared -ldflags=-s -o ./whatsmeow/whatsmeow-linux-amd64.so main.go

if [ "$1" = "all" ]; then

echo 'Build Linux ARM64'
GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ go build -buildmode=c-shared -ldflags=-s -o ./whatsmeow/whatsmeow-linux-arm64.so main.go

echo 'Build for Linux 686'
GOOS=linux GOARCH=386 CGO_ENABLED=1 go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-linux-686.so main.go

echo 'Build for Linux 386'
GOOS=linux GOARCH=386 CGO_ENABLED=1 go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-linux-386.so main.go
echo 'Build for Windows amd64 Bit'
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-windows-64.dll main.go

# echo 'Build Linux ARM64'
# GOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ go build -buildmode=c-shared -ldflags=-s -o ./whatsmeow/whatsmeow-linux-arm64.so main.go

# echo 'Build for Linux 386'
# GOOS=linux GOARCH=386 CGO_ENABLED=1 go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-linux-386.so main.go

##echo 'Build for Windows 32 Bit'
##GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-windows-32.dll main.go

echo 'Build for Windows amd64 Bit'
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-windows-64.dll main.go
# echo 'Build OSX'
# GOOS=darwin GOARCH=arm64 go build -o ./whatsmeow/whatsmeow-darwin-arm64.dylib -buildmode=c-shared main.go
# GOOS=darwin GOARCH=amd64 go build -buildmode=c-shared -o ./whatsmeow/whatsmeow-darwin-amd64.dylib main.go

fi
22 changes: 7 additions & 15 deletions whatsfly/dependencies/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ toolchain go1.22.0

require (
github.com/enriquebris/goconcurrentqueue v0.7.0
github.com/mattn/go-sqlite3 v1.14.22
github.com/mdp/qrterminal/v3 v3.2.0
go.mau.fi/whatsmeow v0.0.0-20240227155050-c5e8575efc35
google.golang.org/protobuf v1.32.0
go.mau.fi/whatsmeow v0.0.0-20240327124018-350073db195c
google.golang.org/protobuf v1.33.0
modernc.org/sqlite v1.29.2
)

Expand All @@ -20,29 +19,22 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rs/zerolog v1.32.0 // indirect
go.mau.fi/libsignal v0.1.0 // indirect
go.mau.fi/util v0.4.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
go.mau.fi/util v0.4.2 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/tools v0.19.0 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
lukechampine.com/uint128 v1.3.0 // indirect
modernc.org/cc/v3 v3.41.0 // indirect
modernc.org/ccgo/v3 v3.17.0 // indirect
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect
modernc.org/libc v1.41.0 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.7.2 // indirect
modernc.org/opt v0.1.3 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
rsc.io/qr v0.2.0 // indirect
Expand Down
Loading

0 comments on commit f388b45

Please sign in to comment.