fix: Renaming mutex name
This commit is contained in:
parent
9b32aaf581
commit
a35ba84efc
1 changed files with 14 additions and 18 deletions
|
@ -63,8 +63,8 @@ const (
|
|||
Generals Category = "일반"
|
||||
)
|
||||
|
||||
var mutex1 *sync.Mutex = &sync.Mutex{}
|
||||
var mutex2 *sync.Mutex = &sync.Mutex{}
|
||||
var commandMutex *sync.Mutex = &sync.Mutex{}
|
||||
var componentMutex *sync.Mutex = &sync.Mutex{}
|
||||
|
||||
func new() *DiscommandStruct {
|
||||
discommand := DiscommandStruct{
|
||||
|
@ -76,40 +76,36 @@ func new() *DiscommandStruct {
|
|||
}
|
||||
|
||||
func (d *DiscommandStruct) LoadCommand(c *Command) {
|
||||
mutex1.Lock()
|
||||
commandMutex.Lock()
|
||||
d.Commands[c.Name] = c
|
||||
d.Aliases[c.Name] = c.Name
|
||||
|
||||
for _, alias := range c.Aliases {
|
||||
d.Aliases[alias] = c.Name
|
||||
}
|
||||
mutex1.Unlock()
|
||||
commandMutex.Unlock()
|
||||
}
|
||||
|
||||
func (d *DiscommandStruct) LoadComponent(c *Component) {
|
||||
mutex2.Lock()
|
||||
componentMutex.Lock()
|
||||
d.Components = append(d.Components, c)
|
||||
mutex2.Unlock()
|
||||
componentMutex.Unlock()
|
||||
}
|
||||
|
||||
func (d *DiscommandStruct) MessageRun(name string, s *discordgo.Session, m *discordgo.MessageCreate, args []string) {
|
||||
command := d.Commands[name]
|
||||
if command == nil {
|
||||
return
|
||||
if command, ok := d.Commands[name]; ok {
|
||||
command.MessageRun(&MsgContext{s, m, args, command})
|
||||
}
|
||||
command.MessageRun(&MsgContext{s, m, args, command})
|
||||
}
|
||||
|
||||
func (d *DiscommandStruct) ChatInputRun(name string, s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
command := d.Commands[name]
|
||||
if command == nil {
|
||||
return
|
||||
if command, ok := d.Commands[name]; ok {
|
||||
command.ChatInputRun(&ChatInputContext{s, &utils.InteractionCreate{
|
||||
InteractionCreate: i,
|
||||
Session: s,
|
||||
Options: utils.GetInteractionOptions(i),
|
||||
}, command})
|
||||
}
|
||||
command.ChatInputRun(&ChatInputContext{s, &utils.InteractionCreate{
|
||||
InteractionCreate: i,
|
||||
Session: s,
|
||||
Options: utils.GetInteractionOptions(i),
|
||||
}, command})
|
||||
}
|
||||
|
||||
func (d *DiscommandStruct) ComponentRun(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
|
|
Loading…
Reference in a new issue