add delete facebook command action
This commit is contained in:
@@ -81,3 +81,17 @@ func addFacebookPage(info EvtInfo, fbid, tmpl string) string {
|
||||
}
|
||||
return "Success"
|
||||
}
|
||||
|
||||
func delFacebookPage(info EvtInfo, fbid string) string {
|
||||
ch, err := dsmodel.GetChannelByID(info.Channel)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
err = ch.DeleteFacebookPage(fbid)
|
||||
if err != nil {
|
||||
return "delete facebook page fail"
|
||||
}
|
||||
|
||||
return "Success"
|
||||
}
|
||||
|
||||
@@ -149,10 +149,13 @@ func parseTextMessage(msg string) (cmd string, keyword bool, payload string) {
|
||||
return
|
||||
}
|
||||
|
||||
func selectAction(info EvtInfo, key, value, payload string) string {
|
||||
switch key {
|
||||
func selectAction(info EvtInfo, cmdKey, cmdValue, payload string) string {
|
||||
switch cmdKey {
|
||||
case "ds_addserver":
|
||||
return addServer(info, payload)
|
||||
case "ds_addfacebook":
|
||||
strs := strings.Split(payload, " ")
|
||||
return addFacebookPage(info, strs[0], strings.Join(strs[1:], " "))
|
||||
}
|
||||
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user