Skip to content

Commit

Permalink
Examples: updated
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondburned committed Jan 26, 2020
1 parent 1c25ccb commit 7e602a4
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions _example/advanced_bot/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,22 @@ func (d *Debug) Setup(sub *bot.Subcommand) {
}

// ~go goroutines
func (d *Debug) Goroutines(m *gateway.MessageCreateEvent) error {
_, err := d.Context.SendMessage(m.ChannelID, fmt.Sprintf(
func (d *Debug) Goroutines(m *gateway.MessageCreateEvent) (string, error) {
return fmt.Sprintf(
"goroutines: %d",
runtime.NumGoroutine(),
), nil)
return err
), nil
}

// ~go GOOS
func (d *Debug) RーGOOS(m *gateway.MessageCreateEvent) error {
_, err := d.Context.SendMessage(
m.ChannelID, strings.Title(runtime.GOOS), nil)
return err
func (d *Debug) RーGOOS(m *gateway.MessageCreateEvent) (string, error) {
return strings.Title(runtime.GOOS), nil
}

// ~go GC
func (d *Debug) RーGC(m *gateway.MessageCreateEvent) error {
func (d *Debug) RーGC(m *gateway.MessageCreateEvent) (string, error) {
runtime.GC()

_, err := d.Context.SendMessage(m.ChannelID, "Done.", nil)
return err
return "Done.", nil
}

// ~go die
Expand Down

0 comments on commit 7e602a4

Please sign in to comment.