diff options
author | Alex Auvolat <alex@adnab.me> | 2020-10-04 21:20:22 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2020-10-04 21:20:22 +0200 |
commit | 07f9f640f0f18541760adb8746cd563a504d6609 (patch) | |
tree | 5e8bc029ace33b826d63546677096a65fc570732 /connector/external/external.go | |
parent | 7130c7b7d6d0c4f49229df33825e2861eb463457 (diff) | |
download | easybridge-07f9f640f0f18541760adb8746cd563a504d6609.tar.gz easybridge-07f9f640f0f18541760adb8746cd563a504d6609.zip |
Looks like 2FA works in facebook messenger :o
Diffstat (limited to 'connector/external/external.go')
-rw-r--r-- | connector/external/external.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/connector/external/external.go b/connector/external/external.go index 9aae0f1..92339b9 100644 --- a/connector/external/external.go +++ b/connector/external/external.go @@ -51,10 +51,12 @@ const ( LEAVE = "leave" SEARCH = "search" SEND = "send" + USER_COMMAND = "user_command" CLOSE = "close" // external -> ezbr SAVE_CONFIG = "save_config" + SYSTEM_MESSAGE = "system_message" JOINED = "joined" LEFT = "left" USER_INFO_UPDATED = "user_info_updated" @@ -249,7 +251,7 @@ func (m *extMessageWithData) UnmarshalJSON(jj []byte) error { } m.Data = sr.Data return nil - case JOINED, LEFT, CACHE_PUT, CACHE_GET, REP_OK, REP_ERROR: + case SYSTEM_MESSAGE, JOINED, LEFT, CACHE_PUT, CACHE_GET, REP_OK, REP_ERROR: return nil default: return fmt.Errorf("Invalid message type for message from external program: '%s'", c.MsgType) @@ -377,6 +379,8 @@ func (ext *External) handleCmd(msg *extMessageWithData) { switch msg.MsgType { case SAVE_CONFIG: ext.handler.SaveConfig(msg.Data.(Configuration)) + case SYSTEM_MESSAGE: + ext.handler.SystemMessage(msg.Value) case JOINED: ext.handler.Joined(msg.Room) case LEFT: @@ -475,3 +479,10 @@ func (ext *External) Send(event *Event) (string, error) { } return rep.EventId, nil } + +func (ext *External) UserCommand(cm string) { + ext.cmd(extMessage{ + MsgType: USER_COMMAND, + Value: cm, + }, nil) +} |