feat: support other api endpoint
This commit is contained in:
parent
e516a51ebe
commit
730aea3e3b
@ -14,6 +14,7 @@ type botSettings struct {
|
||||
MCServer string
|
||||
MCBotName string
|
||||
GroupID int64
|
||||
TGBotApi string
|
||||
}
|
||||
|
||||
var (
|
||||
@ -27,8 +28,9 @@ func init() {
|
||||
mc_server := os.Getenv("MC_SERVER")
|
||||
mc_bot_name := os.Getenv("MC_BOT_NAME")
|
||||
group_id_str := os.Getenv("GROUP_ID")
|
||||
tg_bot_api := os.Getenv("TG_BOT_API")
|
||||
|
||||
if http_proxy == "" || bot_token == "" || mc_server == "" || mc_bot_name == "" || group_id_str == "" {
|
||||
if http_proxy == "" || bot_token == "" || mc_server == "" || mc_bot_name == "" || group_id_str == "" || tg_bot_api == "" {
|
||||
logrus.Panic("请检查环境变量是否设置正确")
|
||||
}
|
||||
|
||||
@ -43,6 +45,7 @@ func init() {
|
||||
MCServer: mc_server,
|
||||
MCBotName: mc_bot_name,
|
||||
GroupID: group_id,
|
||||
TGBotApi: tg_bot_api,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,8 @@ func Run(sendFunc func(string) error) {
|
||||
client := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl)}}
|
||||
conf.Bot, err = tgbotapi.NewBotAPIWithClient(
|
||||
conf.GetBotSettings().BotToken,
|
||||
tgbotapi.APIEndpoint,
|
||||
// tgbotapi.APIEndpoint,
|
||||
conf.GetBotSettings().TGBotApi,
|
||||
client)
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user