Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.4.0 update patch #23

Merged
merged 13 commits into from
Jan 8, 2019
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.vsc/*
.vscode/*
private.*
build/*
build/*
*.exe
12 changes: 6 additions & 6 deletions cloc.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

cloc|github.com/AlDanial/cloc v 1.74 T=0.50 s (96.0 files/s, 6690.0 lines/s)
cloc|github.com/AlDanial/cloc v 1.74 T=0.50 s (108.0 files/s, 8484.0 lines/s)
--- | ---

Language|files|blank|comment|code
:-------|-------:|-------:|-------:|-------:
Go|40|414|26|2692
Bourne Shell|4|18|2|50
Go|46|532|25|3461
Bourne Shell|4|18|2|56
Markdown|1|18|0|44
SQL|1|6|0|43
YAML|2|4|0|28
SQL|1|6|0|44
YAML|2|4|0|32
--------|--------|--------|--------|--------
SUM:|48|460|28|2857
SUM:|54|578|27|3637
7 changes: 6 additions & 1 deletion commands/cmdautorole.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
)

type CmdAutorole struct {
PermLvl int
}

func (c *CmdAutorole) GetInvokes() []string {
Expand All @@ -29,7 +30,11 @@ func (c *CmdAutorole) GetGroup() string {
}

func (c *CmdAutorole) GetPermission() int {
return 9
return c.PermLvl
}

func (c *CmdAutorole) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdAutorole) Exec(args *CommandArgs) error {
Expand Down
7 changes: 6 additions & 1 deletion commands/cmdban.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

type CmdBan struct {
PermLvl int
}

func (c *CmdBan) GetInvokes() []string {
Expand All @@ -29,7 +30,11 @@ func (c *CmdBan) GetGroup() string {
}

func (c *CmdBan) GetPermission() int {
return 8
return c.PermLvl
}

func (c *CmdBan) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdBan) Exec(args *CommandArgs) error {
Expand Down
7 changes: 6 additions & 1 deletion commands/cmdclear.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

type CmdClear struct {
PermLvl int
}

func (c *CmdClear) GetInvokes() []string {
Expand All @@ -31,7 +32,11 @@ func (c *CmdClear) GetGroup() string {
}

func (c *CmdClear) GetPermission() int {
return 8
return c.PermLvl
}

func (c *CmdClear) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdClear) Exec(args *CommandArgs) error {
Expand Down
7 changes: 6 additions & 1 deletion commands/cmdgame.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

type CmdGame struct {
PermLvl int
}

func (c *CmdGame) GetInvokes() []string {
Expand All @@ -30,7 +31,11 @@ func (c *CmdGame) GetGroup() string {
}

func (c *CmdGame) GetPermission() int {
return 999
return c.PermLvl
}

func (c *CmdGame) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdGame) Exec(args *CommandArgs) error {
Expand Down
12 changes: 10 additions & 2 deletions commands/cmdhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ func NewCmdHandler(db core.Database, config *core.Config) *CmdHandler {
return &CmdHandler{
registeredCmds: make(map[string]Command),
registeredCmdInstances: make([]Command, 0),
db: db,
config: config,
db: db,
config: config,
}
}

Expand All @@ -35,3 +35,11 @@ func (c *CmdHandler) GetCommand(invoke string) (Command, bool) {
cmd, ok := c.registeredCmds[invoke]
return cmd, ok
}

func (c *CmdHandler) UpdateCommandPermissions(perms map[string]int) {
for k, v := range perms {
if cmd, ok := c.registeredCmds[k]; ok {
cmd.SetPermission(v)
}
}
}
7 changes: 6 additions & 1 deletion commands/cmdhelp.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
)

type CmdHelp struct {
PermLvl int
}

func (c *CmdHelp) GetInvokes() []string {
Expand All @@ -31,7 +32,11 @@ func (c *CmdHelp) GetGroup() string {
}

func (c *CmdHelp) GetPermission() int {
return 0
return c.PermLvl
}

func (c *CmdHelp) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdHelp) Exec(args *CommandArgs) error {
Expand Down
7 changes: 6 additions & 1 deletion commands/cmdid.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

type CmdId struct {
PermLvl int
}

func (c *CmdId) GetInvokes() []string {
Expand All @@ -29,7 +30,11 @@ func (c *CmdId) GetGroup() string {
}

func (c *CmdId) GetPermission() int {
return 0
return c.PermLvl
}

func (c *CmdId) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdId) Exec(args *CommandArgs) error {
Expand Down
7 changes: 6 additions & 1 deletion commands/cmdinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
)

type CmdInfo struct {
PermLvl int
}

func (c *CmdInfo) GetInvokes() []string {
Expand All @@ -27,7 +28,11 @@ func (c *CmdInfo) GetGroup() string {
}

func (c *CmdInfo) GetPermission() int {
return 0
return c.PermLvl
}

func (c *CmdInfo) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdInfo) Exec(args *CommandArgs) error {
Expand Down
7 changes: 6 additions & 1 deletion commands/cmdkick.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

type CmdKick struct {
PermLvl int
}

func (c *CmdKick) GetInvokes() []string {
Expand All @@ -29,7 +30,11 @@ func (c *CmdKick) GetGroup() string {
}

func (c *CmdKick) GetPermission() int {
return 6
return c.PermLvl
}

func (c *CmdKick) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdKick) Exec(args *CommandArgs) error {
Expand Down
7 changes: 6 additions & 1 deletion commands/cmdmodlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
)

type CmdModlog struct {
PermLvl int
}

func (c *CmdModlog) GetInvokes() []string {
Expand All @@ -29,7 +30,11 @@ func (c *CmdModlog) GetGroup() string {
}

func (c *CmdModlog) GetPermission() int {
return 6
return c.PermLvl
}

func (c *CmdModlog) SetPermission(permLvl int) {
c.PermLvl = permLvl
}

func (c *CmdModlog) Exec(args *CommandArgs) error {
Expand Down
Loading