-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
package control | ||
|
||
import "github.com/yqchilde/wxbot/engine/robot" | ||
|
||
type controlApi struct{} | ||
|
||
// GetMenus 获取菜单 | ||
func (c *controlApi) GetMenus(wxId string) (menus []map[string]interface{}) { | ||
for _, v := range managers.LookupAll() { | ||
if v.Options.HideMenu { | ||
continue | ||
// 检查wxId是否存在 | ||
users := robot.GetBot().Users() | ||
for _, v := range users { | ||
if v.WxId == wxId { | ||
for _, v := range managers.LookupAll() { | ||
if v.Options.HideMenu { | ||
continue | ||
} | ||
menus = append(menus, map[string]interface{}{ | ||
"name": v.Service, | ||
"alias": v.Options.Alias, | ||
"priority": v.Options.Priority, | ||
"describe": v.Options.Help, | ||
"defStatus": !v.Options.DisableOnDefault, | ||
"curStatus": v.IsEnabledIn(wxId), | ||
}) | ||
} | ||
break | ||
} | ||
menus = append(menus, map[string]interface{}{ | ||
"name": v.Service, | ||
"alias": v.Options.Alias, | ||
"priority": v.Options.Priority, | ||
"describe": v.Options.Help, | ||
"defStatus": !v.Options.DisableOnDefault, | ||
"curStatus": v.IsEnabledIn(wxId), | ||
}) | ||
} | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule web
updated
from 888d40 to 9d942a