Restrict some commands to human accounts only .
Partially solves
MODIFY
commands/commandimpls/friends.go
commands/commandimpls/friends.go
@@ -47,6 +47,12 @@ func (f *Friends) Execute(writer io.Writer, parameters []string) {
return
}
+ if f.session.State.User.Bot {
+ fmt.Fprintln(writer,"[red]This command can't be used by bots due to Discord API restrictions.")
+ return
+ }
+
+
switch parameters[0] {
case "list", "show", "which":
fmt.Fprintln(writer, "Friends:")

MODIFY
commands/commandimpls/server.go
commands/commandimpls/server.go
@@ -114,6 +114,11 @@ func (cmd *ServerJoinCmd) Execute(writer io.Writer, parameters []string) {
return
}
+ if cmd.session.State.User.Bot {
+ fmt.Fprintln(writer,"[red]This command can't be used by bots due to Discord API restrictions.")
+ return
+ }
+
input := parameters[0]
lastSlash := strings.LastIndex(input, "/")
var inviteID string

MODIFY
commands/commandimpls/status.go
commands/commandimpls/status.go
@@ -141,6 +141,11 @@ func (cmd *StatusGetCmd) Execute(writer io.Writer, parameters []string) {
}
func (cmd *StatusSetCmd) Execute(writer io.Writer, parameters []string) {
+ if cmd.session.State.User.Bot {
+ fmt.Fprintln(writer,"[red]This command can't be used by bots due to Discord API restrictions.")
+ return
+ }
+
if len(parameters) == 0 || len(parameters) > 1 {
fmt.Fprintln(writer, "["+tviewutil.ColorToHex(config.GetTheme().ErrorColor)+"]Invalid parameters")
cmd.PrintHelp(writer)

MODIFY
commands/commandimpls/user.go
commands/commandimpls/user.go
@@ -165,6 +165,11 @@ func (cmd *UserGetCmd) Execute(writer io.Writer, parameters []string) {
}
func (cmd *UserSetCmd) Execute(writer io.Writer, parameters []string) {
+ if cmd.session.State.User.Bot {
+ fmt.Fprintln(writer,"[red]This command can't be used by bots due to Discord API restrictions.")
+ return
+ }
+
var newName, newEmail string
newAvatar := cmd.session.State.User.Avatar
var askForNewPassword bool

Restrict some commands to human accounts only .

Partially solves #148