added function to detect game

This commit is contained in:
root 2024-09-18 08:43:24 -07:00
parent d315b3ca31
commit 9a9869561e
12 changed files with 21 additions and 10 deletions

View file

@ -4,8 +4,9 @@
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.0.1",
"icon_path": "assets/starter-template-icon.svg",
"version": "0.0.0+0560327",
"version": "0.0.1",
"min_server_version": "6.2.1",
"server": {
"executables": {

File diff suppressed because one or more lines are too long

View file

@ -18,8 +18,9 @@ const manifestStr = `
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.0.1",
"icon_path": "assets/starter-template-icon.svg",
"version": "0.0.0+0560327",
"version": "0.0.1",
"min_server_version": "6.2.1",
"server": {
"executables": {

View file

@ -23,20 +23,28 @@ type Plugin struct {
configuration *configuration
}
// GetActiveGame simulates scanning processes to determine the active game
// Known game processes
var knownGames = map[string]bool{
"game.exe": true,
"gameprocess": true,
// Add more known game processes here
}
// GetActiveGame scans processes to determine the active game based on known game names
func (p *Plugin) GetActiveGame() (string, error) {
// This example uses the ps command to list processes (for Unix-like systems)
// Use appropriate command for your OS
cmd := exec.Command("ps", "-e")
output, err := cmd.Output()
if err != nil {
return "", err
}
// Process output to find a game-related process (placeholder logic)
lines := strings.Split(string(output), "\n")
for _, line := range lines {
if strings.Contains(line, "game") { // Modify this condition as needed
return "Detected Game", nil
for gameName := range knownGames {
if strings.Contains(line, gameName) {
return gameName, nil
}
}
}

2
webapp/dist/main.js vendored

File diff suppressed because one or more lines are too long

View file

@ -7,8 +7,9 @@ const manifest = JSON.parse(`
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
"release_notes_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdatereleases/tag/v0.0.1",
"icon_path": "assets/starter-template-icon.svg",
"version": "0.0.0+0560327",
"version": "0.0.1",
"min_server_version": "6.2.1",
"server": {
"executables": {