fuck chatgpt
This commit is contained in:
parent
4bc38ffb7b
commit
304923a482
BIN
dist/com.mattermost.gameStatusUpdate-0.2.11.tar.gz
vendored
BIN
dist/com.mattermost.gameStatusUpdate-0.2.11.tar.gz
vendored
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
server/dist/plugin-darwin-amd64
vendored
BIN
server/dist/plugin-darwin-amd64
vendored
Binary file not shown.
BIN
server/dist/plugin-darwin-arm64
vendored
BIN
server/dist/plugin-darwin-arm64
vendored
Binary file not shown.
BIN
server/dist/plugin-linux-amd64
vendored
BIN
server/dist/plugin-linux-amd64
vendored
Binary file not shown.
BIN
server/dist/plugin-linux-arm64
vendored
BIN
server/dist/plugin-linux-arm64
vendored
Binary file not shown.
BIN
server/dist/plugin-windows-amd64.exe
vendored
BIN
server/dist/plugin-windows-amd64.exe
vendored
Binary file not shown.
|
@ -1,42 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// HandleProcessList handles the incoming process list from the desktop app.
|
||||
func (p *Plugin) HandleProcessList(ctx context.Context, requestData []byte) error {
|
||||
var request struct {
|
||||
ProcessList string `json:"processList"`
|
||||
UserID string `json:"userID"`
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(requestData, &request); err != nil {
|
||||
return errors.New("invalid request payload")
|
||||
}
|
||||
|
||||
game := ""
|
||||
for knownGame := range knownGames {
|
||||
if strings.Contains(request.ProcessList, knownGame) {
|
||||
game = knownGame
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if game != "" {
|
||||
if err := p.SetUserGameStatus(request.UserID, game); err != nil {
|
||||
return errors.New("failed to update user status: " + err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// InitRoutes initializes any needed routes or commands for the plugin.
|
||||
func InitRoutes(p *Plugin) {
|
||||
// Register the command that the user will call to set their game.
|
||||
|
|
Loading…
Reference in a new issue