优化ip查询

This commit is contained in:
liyp 2024-04-14 21:44:57 +08:00
parent 9259178be2
commit de965134fa

View file

@ -15,7 +15,7 @@ type Ip struct {
func (a *Ip) GetMsg() string { func (a *Ip) GetMsg() string {
if len(a.Parms) < 2 { if len(a.Parms) < 2 {
return "您可以使用 /ip ip地址 进行查找" return "您可以使用 /ip ip地址 进行查找支持ipv4/ipv6"
} }
// 去除换行符 // 去除换行符
raw_msg := strings.TrimRight(a.RawMsg, "\n") raw_msg := strings.TrimRight(a.RawMsg, "\n")
@ -62,6 +62,10 @@ func (a *Ip) GetMsg() string {
if _, ok := data["organization"].(string); ok { if _, ok := data["organization"].(string); ok {
msgs = append(msgs, "组织:"+data["organization"].(string)) msgs = append(msgs, "组织:"+data["organization"].(string))
} }
if _, ok := data["city"].(string); ok {
msgs = append(msgs, "城市:"+data["city"].(string))
}
if _, ok := data["isp"].(string); ok { if _, ok := data["isp"].(string); ok {
msgs = append(msgs, "ISP"+data["isp"].(string)) msgs = append(msgs, "ISP"+data["isp"].(string))
} }