commit
This commit is contained in:
34
plugins/ban.go
Normal file
34
plugins/ban.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
"ymgb/database"
|
||||
"ymgb/utils"
|
||||
|
||||
"git.nix13.pw/scuroneko/laniakea"
|
||||
)
|
||||
|
||||
func RegisterProxy() *laniakea.Plugin[database.Context] {
|
||||
p := laniakea.NewPlugin[database.Context]("Proxy")
|
||||
p.AddCommand(laniakea.NewCommand(getH2Link, "h2link"))
|
||||
p.AddCommand(laniakea.NewCommand(getProxy, "proxy"))
|
||||
return p
|
||||
}
|
||||
|
||||
func getH2Link(ctx *laniakea.MsgContext, db *database.Context) {
|
||||
api := utils.NewHysteria2API()
|
||||
url, err := api.GetConnectLink(1, "K1321xt90RUS")
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
return
|
||||
}
|
||||
ctx.Answerf("`%s`", url)
|
||||
}
|
||||
|
||||
func getProxy(ctx *laniakea.MsgContext, _ *database.Context) {
|
||||
ruProxy := "tg://proxy?port=3128&secret=7qaZyfQN-IQ7ZMwrR_zWnHBvem9uLnJ1&server=185.231.245.25"
|
||||
fiProxy := "tg://proxy?port=3128&secret=7vmNtw_233xvIRFvImm2PLtvem9uLnJ1&server=46.243.6.125"
|
||||
kb := laniakea.NewInlineKeyboard(1)
|
||||
kb.AddUrlButtonStyle("🇷🇺Russia", laniakea.ButtonStylePrimary, ruProxy)
|
||||
kb.AddUrlButtonStyle("🇫🇮Finland", laniakea.ButtonStylePrimary, fiProxy)
|
||||
ctx.Keyboard("Доступные прокси", kb)
|
||||
}
|
||||
Reference in New Issue
Block a user