Skip to content

Commit

Permalink
bump up gotgproto
Browse files Browse the repository at this point in the history
  • Loading branch information
celestix committed May 13, 2024
1 parent 5c151da commit 3a0c4b2
Show file tree
Hide file tree
Showing 17 changed files with 267 additions and 188 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a href="https://telegram.me/GIGAsupport"><img src="https://img.shields.io/badge/Support%20Group-blue?logo=telegram"></a>
</p>

GIGA is a powerful telegram userbot written in Go with the help of [gotd](https://github.com/gotd/td) and [gotgproto](https://github.com/anonyindian/gotgproto).
GIGA is a powerful telegram userbot written in Go with the help of [gotd](https://github.com/gotd/td) and [gotgproto](https://github.com/celestix/gotgproto).

## Deployment
The userbot is still under development but you can deploy it through your console by following a few steps:
Expand Down
12 changes: 6 additions & 6 deletions adding_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ All the handlers will be allocated to the main dispatcher stream through this `L
package modules

import (
"github.com/anonyindian/gotgproto/dispatcher"
"github.com/celestix/gotgproto/dispatcher"
)

func (*module) LoadFoo(dp *dispatcher.CustomDispatcher) {
Expand Down Expand Up @@ -73,7 +73,7 @@ In order to add help section for your module, you have to call `SetModuleHelp` f
package modules

import (
"github.com/anonyindian/gotgproto/dispatcher"
"github.com/celestix/gotgproto/dispatcher"
)

func (*module) LoadFoo(dp *dispatcher.CustomDispatcher) {
Expand All @@ -99,10 +99,10 @@ package modules
import (
"fmt"

"github.com/anonyindian/gotgproto/dispatcher"
"github.com/anonyindian/gotgproto/dispatcher/handlers"
"github.com/anonyindian/gotgproto/dispatcher/handlers/filters"
"github.com/anonyindian/gotgproto/ext"
"github.com/celestix/gotgproto/dispatcher"
"github.com/celestix/gotgproto/dispatcher/handlers"
"github.com/celestix/gotgproto/dispatcher/handlers/filters"
"github.com/celestix/gotgproto/ext"
"github.com/anonyindian/logger"
"github.com/gigauserbot/giga/bot/helpmaker"
)
Expand Down
4 changes: 2 additions & 2 deletions bot/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/PaulSonOfLars/gotgbot/v2/ext/handlers"
"github.com/PaulSonOfLars/gotgbot/v2/ext/handlers/filters/callbackquery"
"github.com/PaulSonOfLars/gotgbot/v2/ext/handlers/filters/inlinequery"
"github.com/anonyindian/gotgproto"
"github.com/anonyindian/logger"
"github.com/gigauserbot/giga/bot/helpmaker"
"github.com/gigauserbot/giga/config"
)

func helpInline(b *gotgbot.Bot, ctx *ext.Context) error {
Expand Down Expand Up @@ -41,7 +41,7 @@ func helpInline(b *gotgbot.Bot, ctx *ext.Context) error {

func helpCallback(b *gotgbot.Bot, ctx *ext.Context) error {
query := ctx.CallbackQuery
if query.From.Id != gotgproto.Self.ID {
if query.From.Id != config.Self.ID {
query.Answer(b, &gotgbot.AnswerCallbackQueryOpts{
Url: fmt.Sprintf("t.me/%s?start=deploy_own_via_help", strings.TrimPrefix(b.Username, "@")),
})
Expand Down
17 changes: 11 additions & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"os"
"strings"

"github.com/anonyindian/gotgproto/sessionMaker"
"github.com/anonyindian/logger"
"github.com/celestix/gotgproto/sessionMaker"
"github.com/gotd/td/tg"
)

const DEBUG = false
Expand All @@ -28,6 +29,8 @@ type config struct {
BotToken string `json:"bot_token,omitempty"`
}

var Self *tg.User

func Load(l *logger.Logger) {
l = l.Create("CONFIG")
defer l.ChangeLevel(logger.LevelMain).Println("LOADED")
Expand All @@ -47,20 +50,22 @@ func Load(l *logger.Logger) {
}
}

func GetSessionString() string {
func getSessionString() string {
if ValueOf.TestServer {
return ValueOf.TestSessionString
}
return ValueOf.SessionString
}

func GetSessionType() sessionMaker.SessionType {
func GetSession() sessionMaker.SessionConstructor {
sessionString := getSessionString()
const sessionName = "giga"
switch strings.ToLower(ValueOf.SessionType) {
case "pyrogram", "pyro":
return sessionMaker.PyrogramSession
return sessionMaker.PyrogramSession(sessionString).Name(sessionName)
case "gotgproto", "native":
return sessionMaker.StringSession
return sessionMaker.StringSession(sessionString).Name(sessionName)
default:
return sessionMaker.TelethonSession
return sessionMaker.TelethonSession(sessionString).Name(sessionName)
}
}
58 changes: 36 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,60 +1,74 @@
module github.com/gigauserbot/giga

// +heroku goVersion go1.18
go 1.18
go 1.21

toolchain go1.22.2

require (
github.com/PaulSonOfLars/gotgbot/v2 v2.0.0-rc.11
github.com/anonyindian/gotgproto v1.0.0-beta08.0.20220813082126-f98d0f42e1d5
github.com/anonyindian/logger v1.0.0-alpha.3
github.com/anonyindian/logger v1.0.0-alpha.3.0.20220812175701-2dba945b21ba
github.com/celestix/gotgproto v1.0.0-beta17.0.20240511154527-4b606be36214
github.com/go-git/go-git/v5 v5.4.2
github.com/go-redis/redis v6.15.9+incompatible
github.com/gotd/td v0.68.1
github.com/gotd/td v0.102.0
github.com/joho/godotenv v1.4.0
)

require (
github.com/AnimeKaizoku/cacher v1.0.1 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20220824120805-4b6e5c587895 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/allegro/bigcache v1.2.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cloudflare/circl v1.2.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-faster/errors v0.6.1 // indirect
github.com/go-faster/jx v0.39.0 // indirect
github.com/go-faster/xor v0.3.0 // indirect
github.com/glebarez/go-sqlite v1.22.0 // indirect
github.com/glebarez/sqlite v1.11.0 // indirect
github.com/go-faster/errors v0.7.1 // indirect
github.com/go-faster/jx v1.1.0 // indirect
github.com/go-faster/xor v1.0.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gotd/ige v0.2.2 // indirect
github.com/gotd/neo v0.1.5 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/mattn/go-sqlite3 v1.14.15 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-sqlite3 v1.14.17 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/onsi/ginkgo v1.16.5 // indirect
github.com/onsi/gomega v1.20.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/xanzy/ssh-agent v0.3.2 // indirect
go.opentelemetry.io/otel v1.9.0 // indirect
go.opentelemetry.io/otel/trace v1.9.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
go.opentelemetry.io/otel v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.20.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gorm.io/driver/sqlite v1.3.6 // indirect
gorm.io/gorm v1.23.8 // indirect
nhooyr.io/websocket v1.8.7 // indirect
gorm.io/driver/sqlite v1.5.5 // indirect
gorm.io/gorm v1.25.10 // indirect
modernc.org/libc v1.50.5 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.29.9 // indirect
nhooyr.io/websocket v1.8.11 // indirect
rsc.io/qr v0.2.0 // indirect
)
Loading

0 comments on commit 3a0c4b2

Please sign in to comment.