Files
owobot/internal/systems/roles/init.go
Elara6331 a1257cd9e7
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Restructure the code to standardize file structure
2023-12-31 14:41:08 -08:00

128 lines
4.0 KiB
Go

/*
* owobot - Your server's guardian and entertainer
* Copyright (C) 2023 owobot Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package roles
import (
"github.com/bwmarrin/discordgo"
"go.elara.ws/owobot/internal/systems/commands"
"go.elara.ws/owobot/internal/util"
)
func Init(s *discordgo.Session) error {
s.AddHandler(util.InteractionErrorHandler("on-role-btn", onRoleButton))
commands.Register(s, reactionRolesCmd, &discordgo.ApplicationCommand{
Name: "reaction_roles",
Description: "Manage reaction roles",
DefaultMemberPermissions: util.Pointer[int64](discordgo.PermissionManageServer),
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "new_category",
Description: "Create a new reaction role category",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "name",
Description: "The name of the category",
Required: true,
},
{
Type: discordgo.ApplicationCommandOptionString,
Name: "description",
Description: "The description of the reaction role category",
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "remove_category",
Description: "Remove a reaction role category",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "name",
Description: "The category which should be removed",
Required: true,
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "add",
Description: "Create a new reaction role",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "category",
Description: "The category to which the reaction role will be added",
Required: true,
},
{
Type: discordgo.ApplicationCommandOptionRole,
Name: "role",
Description: "The role to add",
Required: true,
},
{
Type: discordgo.ApplicationCommandOptionString,
Name: "emoji",
Description: "The emoji to use for the role",
Required: true,
},
},
},
{
Type: discordgo.ApplicationCommandOptionSubCommand,
Name: "remove",
Description: "Remove a reaction role",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "category",
Description: "The category from which to remove the reaction role",
Required: true,
},
{
Type: discordgo.ApplicationCommandOptionRole,
Name: "role",
Description: "The role to remove",
Required: true,
},
},
},
},
})
commands.Register(s, neopronounCmd, &discordgo.ApplicationCommand{
Name: "neopronoun",
Description: "Assign a neopronoun role to yourself",
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "neopronoun",
Description: "The neopronouns to assign to you",
Required: true,
},
},
})
return nil
}