rename: dev commands
This commit is contained in:
parent
18a373f083
commit
1b9e4714f7
6 changed files with 33 additions and 30 deletions
|
@ -1,10 +1,11 @@
|
||||||
package commands
|
package dev
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"git.wh64.net/muffin/goMuffin/commands"
|
||||||
"git.wh64.net/muffin/goMuffin/configs"
|
"git.wh64.net/muffin/goMuffin/configs"
|
||||||
"git.wh64.net/muffin/goMuffin/databases"
|
"git.wh64.net/muffin/goMuffin/databases"
|
||||||
"git.wh64.net/muffin/goMuffin/utils"
|
"git.wh64.net/muffin/goMuffin/utils"
|
||||||
|
@ -12,19 +13,19 @@ import (
|
||||||
"go.mongodb.org/mongo-driver/v2/bson"
|
"go.mongodb.org/mongo-driver/v2/bson"
|
||||||
)
|
)
|
||||||
|
|
||||||
var BlockCommand *Command = &Command{
|
var BlockCommand *commands.Command = &commands.Command{
|
||||||
ApplicationCommand: &discordgo.ApplicationCommand{
|
ApplicationCommand: &discordgo.ApplicationCommand{
|
||||||
Name: "차단",
|
Name: "차단",
|
||||||
Description: "유저를 차단해요.",
|
Description: "유저를 차단해요.",
|
||||||
},
|
},
|
||||||
DetailedDescription: &DetailedDescription{
|
DetailedDescription: &commands.DetailedDescription{
|
||||||
Usage: fmt.Sprintf("%s차단 (유저의 ID) [사유]", configs.Config.Bot.Prefix),
|
Usage: fmt.Sprintf("%s차단 (유저의 ID) [사유]", configs.Config.Bot.Prefix),
|
||||||
},
|
},
|
||||||
Category: DeveloperOnly,
|
Category: commands.DeveloperOnly,
|
||||||
RegisterApplicationCommand: false,
|
RegisterApplicationCommand: false,
|
||||||
RegisterMessageCommand: true,
|
RegisterMessageCommand: true,
|
||||||
Flags: CommandFlagsIsDeveloper,
|
Flags: commands.CommandFlagsIsDeveloper,
|
||||||
MessageRun: func(ctx *MsgContext) error {
|
MessageRun: func(ctx *commands.MsgContext) error {
|
||||||
var reason string
|
var reason string
|
||||||
if len(*ctx.Args) < 1 {
|
if len(*ctx.Args) < 1 {
|
||||||
utils.NewMessageSender(ctx.Msg).
|
utils.NewMessageSender(ctx.Msg).
|
|
@ -1,27 +1,28 @@
|
||||||
package commands
|
package dev
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.wh64.net/muffin/goMuffin/chatbot"
|
"git.wh64.net/muffin/goMuffin/chatbot"
|
||||||
|
"git.wh64.net/muffin/goMuffin/commands"
|
||||||
"git.wh64.net/muffin/goMuffin/configs"
|
"git.wh64.net/muffin/goMuffin/configs"
|
||||||
"git.wh64.net/muffin/goMuffin/utils"
|
"git.wh64.net/muffin/goMuffin/utils"
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ReloadPromptCommand *Command = &Command{
|
var ReloadPromptCommand *commands.Command = &commands.Command{
|
||||||
ApplicationCommand: &discordgo.ApplicationCommand{
|
ApplicationCommand: &discordgo.ApplicationCommand{
|
||||||
Name: "프롬프트재설정",
|
Name: "프롬프트재설정",
|
||||||
Description: "프롬프트를 다시 불러와요.",
|
Description: "프롬프트를 다시 불러와요.",
|
||||||
},
|
},
|
||||||
DetailedDescription: &DetailedDescription{
|
DetailedDescription: &commands.DetailedDescription{
|
||||||
Usage: fmt.Sprintf("%s프롬프트재설정", configs.Config.Bot.Prefix),
|
Usage: fmt.Sprintf("%s프롬프트재설정", configs.Config.Bot.Prefix),
|
||||||
},
|
},
|
||||||
Category: DeveloperOnly,
|
Category: commands.DeveloperOnly,
|
||||||
RegisterApplicationCommand: false,
|
RegisterApplicationCommand: false,
|
||||||
RegisterMessageCommand: true,
|
RegisterMessageCommand: true,
|
||||||
Flags: CommandFlagsIsDeveloper,
|
Flags: commands.CommandFlagsIsDeveloper,
|
||||||
MessageRun: func(ctx *MsgContext) error {
|
MessageRun: func(ctx *commands.MsgContext) error {
|
||||||
err := chatbot.ChatBot.ReloadPrompt()
|
err := chatbot.ChatBot.ReloadPrompt()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
|
@ -1,27 +1,28 @@
|
||||||
package commands
|
package dev
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"git.wh64.net/muffin/goMuffin/chatbot"
|
"git.wh64.net/muffin/goMuffin/chatbot"
|
||||||
|
"git.wh64.net/muffin/goMuffin/commands"
|
||||||
"git.wh64.net/muffin/goMuffin/configs"
|
"git.wh64.net/muffin/goMuffin/configs"
|
||||||
"git.wh64.net/muffin/goMuffin/utils"
|
"git.wh64.net/muffin/goMuffin/utils"
|
||||||
"github.com/bwmarrin/discordgo"
|
"github.com/bwmarrin/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var SwitchModeCommand *Command = &Command{
|
var SwitchModeCommand *commands.Command = &commands.Command{
|
||||||
ApplicationCommand: &discordgo.ApplicationCommand{
|
ApplicationCommand: &discordgo.ApplicationCommand{
|
||||||
Name: "모드전환",
|
Name: "모드전환",
|
||||||
Description: "머핀봇의 대답을 변경합니다.",
|
Description: "머핀봇의 대답을 변경합니다.",
|
||||||
},
|
},
|
||||||
DetailedDescription: &DetailedDescription{
|
DetailedDescription: &commands.DetailedDescription{
|
||||||
Usage: fmt.Sprintf("%s모드전환", configs.Config.Bot.Prefix),
|
Usage: fmt.Sprintf("%s모드전환", configs.Config.Bot.Prefix),
|
||||||
},
|
},
|
||||||
Category: DeveloperOnly,
|
Category: commands.DeveloperOnly,
|
||||||
RegisterApplicationCommand: false,
|
RegisterApplicationCommand: false,
|
||||||
RegisterMessageCommand: true,
|
RegisterMessageCommand: true,
|
||||||
Flags: CommandFlagsIsDeveloper,
|
Flags: commands.CommandFlagsIsDeveloper,
|
||||||
MessageRun: func(ctx *MsgContext) error {
|
MessageRun: func(ctx *commands.MsgContext) error {
|
||||||
chatbot.ChatBot.SwitchMode()
|
chatbot.ChatBot.SwitchMode()
|
||||||
|
|
||||||
return utils.NewMessageSender(ctx.Msg).
|
return utils.NewMessageSender(ctx.Msg).
|
|
@ -1,9 +1,10 @@
|
||||||
package commands
|
package dev
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"git.wh64.net/muffin/goMuffin/commands"
|
||||||
"git.wh64.net/muffin/goMuffin/configs"
|
"git.wh64.net/muffin/goMuffin/configs"
|
||||||
"git.wh64.net/muffin/goMuffin/databases"
|
"git.wh64.net/muffin/goMuffin/databases"
|
||||||
"git.wh64.net/muffin/goMuffin/utils"
|
"git.wh64.net/muffin/goMuffin/utils"
|
||||||
|
@ -11,19 +12,19 @@ import (
|
||||||
"go.mongodb.org/mongo-driver/v2/bson"
|
"go.mongodb.org/mongo-driver/v2/bson"
|
||||||
)
|
)
|
||||||
|
|
||||||
var UnblockCommand *Command = &Command{
|
var UnblockCommand *commands.Command = &commands.Command{
|
||||||
ApplicationCommand: &discordgo.ApplicationCommand{
|
ApplicationCommand: &discordgo.ApplicationCommand{
|
||||||
Name: "차단해제",
|
Name: "차단해제",
|
||||||
Description: "유저의 차단을 해제해요.",
|
Description: "유저의 차단을 해제해요.",
|
||||||
},
|
},
|
||||||
DetailedDescription: &DetailedDescription{
|
DetailedDescription: &commands.DetailedDescription{
|
||||||
Usage: fmt.Sprintf("%s차단해제 (유저의 ID)", configs.Config.Bot.Prefix),
|
Usage: fmt.Sprintf("%s차단해제 (유저의 ID)", configs.Config.Bot.Prefix),
|
||||||
},
|
},
|
||||||
Category: DeveloperOnly,
|
Category: commands.DeveloperOnly,
|
||||||
RegisterApplicationCommand: false,
|
RegisterApplicationCommand: false,
|
||||||
RegisterMessageCommand: true,
|
RegisterMessageCommand: true,
|
||||||
Flags: CommandFlagsIsDeveloper,
|
Flags: commands.CommandFlagsIsDeveloper,
|
||||||
MessageRun: func(ctx *MsgContext) error {
|
MessageRun: func(ctx *commands.MsgContext) error {
|
||||||
if len(*ctx.Args) < 1 {
|
if len(*ctx.Args) < 1 {
|
||||||
utils.NewMessageSender(ctx.Msg).
|
utils.NewMessageSender(ctx.Msg).
|
||||||
AddComponents(utils.GetErrorContainer(discordgo.TextDisplay{Content: "유저 ID는 필수에요."})).
|
AddComponents(utils.GetErrorContainer(discordgo.TextDisplay{Content: "유저 ID는 필수에요."})).
|
|
@ -2,7 +2,6 @@ package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
|
|
||||||
"git.wh64.net/muffin/goMuffin/commands"
|
"git.wh64.net/muffin/goMuffin/commands"
|
||||||
"git.wh64.net/muffin/goMuffin/configs"
|
"git.wh64.net/muffin/goMuffin/configs"
|
||||||
|
@ -32,7 +31,6 @@ func InteractionCreate(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
|
|
||||||
// 아 몰라 goto 쓸래
|
// 아 몰라 goto 쓸래
|
||||||
ErrMsg:
|
ErrMsg:
|
||||||
log.Println(err)
|
|
||||||
owner, _ := s.User(configs.Config.Bot.OwnerId)
|
owner, _ := s.User(configs.Config.Bot.OwnerId)
|
||||||
utils.NewMessageSender(&utils.InteractionCreate{
|
utils.NewMessageSender(&utils.InteractionCreate{
|
||||||
InteractionCreate: i,
|
InteractionCreate: i,
|
||||||
|
|
9
main.go
9
main.go
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
"git.wh64.net/muffin/goMuffin/chatbot"
|
"git.wh64.net/muffin/goMuffin/chatbot"
|
||||||
"git.wh64.net/muffin/goMuffin/commands"
|
"git.wh64.net/muffin/goMuffin/commands"
|
||||||
|
"git.wh64.net/muffin/goMuffin/commands/dev"
|
||||||
"git.wh64.net/muffin/goMuffin/components"
|
"git.wh64.net/muffin/goMuffin/components"
|
||||||
"git.wh64.net/muffin/goMuffin/configs"
|
"git.wh64.net/muffin/goMuffin/configs"
|
||||||
"git.wh64.net/muffin/goMuffin/databases"
|
"git.wh64.net/muffin/goMuffin/databases"
|
||||||
|
@ -29,13 +30,13 @@ func init() {
|
||||||
go commands.Discommand.LoadCommand(commands.LearnedDataListCommand)
|
go commands.Discommand.LoadCommand(commands.LearnedDataListCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.InformationCommand)
|
go commands.Discommand.LoadCommand(commands.InformationCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.DeleteLearnedDataCommand)
|
go commands.Discommand.LoadCommand(commands.DeleteLearnedDataCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.ReloadPromptCommand)
|
go commands.Discommand.LoadCommand(dev.ReloadPromptCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.SwitchModeCommand)
|
go commands.Discommand.LoadCommand(dev.SwitchModeCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.ChatCommand)
|
go commands.Discommand.LoadCommand(commands.ChatCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.RegisterCommand)
|
go commands.Discommand.LoadCommand(commands.RegisterCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.DeregisterCommand)
|
go commands.Discommand.LoadCommand(commands.DeregisterCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.BlockCommand)
|
go commands.Discommand.LoadCommand(dev.BlockCommand)
|
||||||
go commands.Discommand.LoadCommand(commands.UnblockCommand)
|
go commands.Discommand.LoadCommand(dev.UnblockCommand)
|
||||||
|
|
||||||
go commands.Discommand.LoadComponent(components.DeleteLearnedDataComponent)
|
go commands.Discommand.LoadComponent(components.DeleteLearnedDataComponent)
|
||||||
go commands.Discommand.LoadComponent(components.PaginationEmbedComponent)
|
go commands.Discommand.LoadComponent(components.PaginationEmbedComponent)
|
||||||
|
|
Loading…
Reference in a new issue