mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-07-27 21:18:30 +00:00
Handle multichat in single-publish
This commit is contained in:
parent
4f3473e8d9
commit
a4ecc790b9
2 changed files with 6 additions and 6 deletions
|
@ -99,7 +99,7 @@ func HBackendPublishRequest(w http.ResponseWriter, r *http.Request) {
|
|||
case MsgTargetTypeChat:
|
||||
count = PublishToChat(channel, cm)
|
||||
case MsgTargetTypeMultichat:
|
||||
// TODO
|
||||
count = PublishToMultiple(strings.Split(channel, ","), cm)
|
||||
case MsgTargetTypeGlobal:
|
||||
count = PublishToAll(cm)
|
||||
case MsgTargetTypeInvalid:
|
||||
|
@ -119,15 +119,15 @@ func (bfe BackendForwardedError) Error() string {
|
|||
|
||||
var AuthorizationNeededError = errors.New("Must authenticate Twitch username to use this command")
|
||||
|
||||
func RequestRemoteDataCached(remoteCommand, data string, auth AuthInfo) (string, error) {
|
||||
func SendRemoteCommandCached(remoteCommand, data string, auth AuthInfo) (string, error) {
|
||||
cached, ok := responseCache.Get(getCacheKey(remoteCommand, data))
|
||||
if ok {
|
||||
return cached.(string), nil
|
||||
}
|
||||
return RequestRemoteData(remoteCommand, data, auth)
|
||||
return SendRemoteCommand(remoteCommand, data, auth)
|
||||
}
|
||||
|
||||
func RequestRemoteData(remoteCommand, data string, auth AuthInfo) (responseStr string, err error) {
|
||||
func SendRemoteCommand(remoteCommand, data string, auth AuthInfo) (responseStr string, err error) {
|
||||
destUrl := fmt.Sprintf("%s/cmd/%s", backendUrl, remoteCommand)
|
||||
var authKey string
|
||||
if auth.UsernameValidated {
|
||||
|
|
|
@ -376,7 +376,7 @@ func HandleBunchedRemoteCommand(conn *websocket.Conn, client *ClientInfo, msg Cl
|
|||
PendingBunchedRequests[br] = &BunchSubscriberList{Members: []BunchSubscriber{{Client: client, MessageID: msg.MessageID}}}
|
||||
|
||||
go func(request BunchedRequest) {
|
||||
resp, err := RequestRemoteDataCached(string(request.Command), request.Param, AuthInfo{})
|
||||
resp, err := SendRemoteCommandCached(string(request.Command), request.Param, AuthInfo{})
|
||||
|
||||
var msg ClientMessage
|
||||
if err == nil {
|
||||
|
@ -417,7 +417,7 @@ func HandleRemoteCommand(conn *websocket.Conn, client *ClientInfo, msg ClientMes
|
|||
const AuthorizationFailedErrorString = "Failed to verify your Twitch username."
|
||||
|
||||
func doRemoteCommand(conn *websocket.Conn, msg ClientMessage, client *ClientInfo) {
|
||||
resp, err := RequestRemoteDataCached(string(msg.Command), msg.origArguments, client.AuthInfo)
|
||||
resp, err := SendRemoteCommandCached(string(msg.Command), msg.origArguments, client.AuthInfo)
|
||||
|
||||
if err == AuthorizationNeededError {
|
||||
client.StartAuthorization(func(_ *ClientInfo, success bool) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue