feat: bot status (#30)
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #30
This commit is contained in:
parent
a1bf5f94fa
commit
3fcf38f5c7
|
@ -43,6 +43,8 @@ func NewBot(token string, groupSvc GroupService, monitorSvc MonitorService, clie
|
|||
return nil, fmt.Errorf("discordgo.New: %w", err)
|
||||
}
|
||||
|
||||
s.Identify.Intents = discordgo.IntentsNone
|
||||
|
||||
b := &Bot{
|
||||
s: s,
|
||||
c: cron.New(
|
||||
|
@ -56,6 +58,8 @@ func NewBot(token string, groupSvc GroupService, monitorSvc MonitorService, clie
|
|||
choiceSvc: client,
|
||||
}
|
||||
|
||||
b.s.AddHandler(b.handleSessionReady)
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
|
@ -113,6 +117,10 @@ func (b *Bot) initCron() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (b *Bot) handleSessionReady(s *discordgo.Session, _ *discordgo.Ready) {
|
||||
_ = s.UpdateGameStatus(0, "Tribal Wars")
|
||||
}
|
||||
|
||||
func (b *Bot) Close() error {
|
||||
<-b.c.Stop().Done()
|
||||
return b.s.Close()
|
||||
|
|
|
@ -35,11 +35,13 @@ func (c *groupCommand) create(s *discordgo.Session) error {
|
|||
}
|
||||
|
||||
var perm int64 = discordgo.PermissionAdministrator
|
||||
dm := false
|
||||
|
||||
_, err = s.ApplicationCommandCreate(s.State.User.ID, "", &discordgo.ApplicationCommand{
|
||||
Name: c.name(),
|
||||
Description: "Manages groups on this server",
|
||||
DefaultMemberPermissions: &perm,
|
||||
DMPermission: &dm,
|
||||
Options: []*discordgo.ApplicationCommandOption{
|
||||
{
|
||||
Name: "create",
|
||||
|
|
|
@ -33,11 +33,13 @@ func (c *monitorCommand) register(s *discordgo.Session) error {
|
|||
|
||||
func (c *monitorCommand) create(s *discordgo.Session) error {
|
||||
var perm int64 = discordgo.PermissionAdministrator
|
||||
dm := false
|
||||
|
||||
_, err := s.ApplicationCommandCreate(s.State.User.ID, "", &discordgo.ApplicationCommand{
|
||||
Name: c.name(),
|
||||
Description: "Manages monitors",
|
||||
DefaultMemberPermissions: &perm,
|
||||
DMPermission: &dm,
|
||||
Options: []*discordgo.ApplicationCommandOption{
|
||||
{
|
||||
Name: "create",
|
||||
|
|
Loading…
Reference in New Issue
Block a user