Skip to content

Commit

Permalink
plugins: (sys-stat) Fix bug causing command to hang after one run
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT2 committed May 26, 2024
1 parent 696c1d4 commit d2d691b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions plugins/sys-stats/sys-stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ package main

import (
"fmt"
"log"
"os"
"os/exec"
"strings"
"time"

"github.com/5HT2/taro-bot/bot"
"github.com/5HT2/taro-bot/cmd"
"github.com/5HT2/taro-bot/plugins"
cu "github.com/5HT2/taro-bot/util/cpu"
"github.com/mackerelio/go-osstat/cpu"
"github.com/mackerelio/go-osstat/memory"
"github.com/mackerelio/go-osstat/uptime"
"log"
"os"
"os/exec"
"strings"
"time"
)

var (
Expand Down Expand Up @@ -43,11 +44,11 @@ func SysStatsCommand(c bot.Command) error {
// If we have a running fetch command in this guild, cancel it
if quit, ok := runningFetches[c.E.GuildID.String()]; ok {
quit <- true
} else {
// Start a new quit channel
runningFetches[c.E.GuildID.String()] = make(chan bool)
}

// Start a new quit channel
runningFetches[c.E.GuildID.String()] = make(chan bool)

// Determine displayed shell based on
shell := "$"
if err := cmd.HasPermission(c, cmd.PermOperator); err == nil {
Expand Down

0 comments on commit d2d691b

Please sign in to comment.