mirror of
https://github.com/awfufu/go-hurobot.git
synced 2026-03-01 13:39:42 +08:00
refactor: migrate command handling from function pointers to object-oriented interface feat: replace run.sh with YAML-based configuration file
35 lines
609 B
Go
35 lines
609 B
Go
package cmds
|
|
|
|
import (
|
|
"go-hurobot/qbot"
|
|
)
|
|
|
|
const rpsHelpMsg string = `Play rock-paper-scissors.
|
|
Usage: /rps`
|
|
|
|
type RpsCommand struct {
|
|
cmdBase
|
|
}
|
|
|
|
func NewRpsCommand() *RpsCommand {
|
|
return &RpsCommand{
|
|
cmdBase: cmdBase{
|
|
Name: "rps",
|
|
HelpMsg: rpsHelpMsg,
|
|
Permission: getCmdPermLevel("rps"),
|
|
AllowPrefix: false,
|
|
NeedRawMsg: false,
|
|
MaxArgs: 1,
|
|
MinArgs: 1,
|
|
},
|
|
}
|
|
}
|
|
|
|
func (cmd *RpsCommand) Self() *cmdBase {
|
|
return &cmd.cmdBase
|
|
}
|
|
|
|
func (cmd *RpsCommand) Exec(c *qbot.Client, args []string, src *srcMsg, _ int) {
|
|
c.SendMsg(src.GroupID, src.UserID, qbot.CQRps())
|
|
}
|