added function to detect game
This commit is contained in:
parent
d315b3ca31
commit
9a9869561e
Binary file not shown.
|
@ -4,8 +4,9 @@
|
||||||
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
|
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
|
||||||
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
||||||
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
|
"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",
|
"icon_path": "assets/starter-template-icon.svg",
|
||||||
"version": "0.0.0+0560327",
|
"version": "0.0.1",
|
||||||
"min_server_version": "6.2.1",
|
"min_server_version": "6.2.1",
|
||||||
"server": {
|
"server": {
|
||||||
"executables": {
|
"executables": {
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -18,8 +18,9 @@ const manifestStr = `
|
||||||
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
|
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
|
||||||
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
||||||
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
|
"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",
|
"icon_path": "assets/starter-template-icon.svg",
|
||||||
"version": "0.0.0+0560327",
|
"version": "0.0.1",
|
||||||
"min_server_version": "6.2.1",
|
"min_server_version": "6.2.1",
|
||||||
"server": {
|
"server": {
|
||||||
"executables": {
|
"executables": {
|
||||||
|
|
|
@ -23,20 +23,28 @@ type Plugin struct {
|
||||||
configuration *configuration
|
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) {
|
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")
|
cmd := exec.Command("ps", "-e")
|
||||||
output, err := cmd.Output()
|
output, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process output to find a game-related process (placeholder logic)
|
|
||||||
lines := strings.Split(string(output), "\n")
|
lines := strings.Split(string(output), "\n")
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
if strings.Contains(line, "game") { // Modify this condition as needed
|
for gameName := range knownGames {
|
||||||
return "Detected Game", nil
|
if strings.Contains(line, gameName) {
|
||||||
|
return gameName, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
webapp/dist/main.js
vendored
2
webapp/dist/main.js
vendored
File diff suppressed because one or more lines are too long
|
@ -7,8 +7,9 @@ const manifest = JSON.parse(`
|
||||||
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
|
"description": "This plugin serves as a starting point for writing a Mattermost plugin.",
|
||||||
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
"homepage_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate",
|
||||||
"support_url": "https://gitlab.peanutsmediaserver.com/aaron/gameStatusUpdate/issues",
|
"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",
|
"icon_path": "assets/starter-template-icon.svg",
|
||||||
"version": "0.0.0+0560327",
|
"version": "0.0.1",
|
||||||
"min_server_version": "6.2.1",
|
"min_server_version": "6.2.1",
|
||||||
"server": {
|
"server": {
|
||||||
"executables": {
|
"executables": {
|
||||||
|
|
Loading…
Reference in a new issue