#How to ban every user from server

1 messages · Page 1 of 1 (latest)

graceful egret
#

A feature to use as a protection

vapid pelican
#

This sounds vaguely ostentatious.

#

It's also bound to get your bot flagged for abusive behavior.

graceful egret
#

But is there a way to do that?

#

or no ban but kick

stable beacon
#

¯_(ツ)_/¯

graceful egret
#

ok

graceful egret
#

I think there is a problem with users who have space in their names

#

it dont ban them only the ones without space

stable beacon
#

Your bot doesn't use nicknames to ban. Bot need only id for this. So the problem can't be in nicknames.

#

Can you send your code or error stack trace?

graceful egret
graceful egret
#

it just leave users with space

stable beacon
graceful egret
#

lmao i havent noticed

#

but still not banning them

#

Thats his nickname

#

everyother friend got banned but this one not

stable beacon
#

I still need an error stack trace

#

Probably bot just don't have permissions to do smth with him

graceful egret
#

strange cus he has no rang

#

and there is no error

vapid pelican
#

Does your bot have permission

#

Furthermore,

#

@carmine skiff CommandErrored

graceful egret
#

yes administrator

carmine skiffBOT
stable beacon
vapid pelican
#

Ensure it has proper hierarchy as well.

stable beacon
#

This guy can be a server creator TY_smail_12

graceful egret
#

i am server creator

stable beacon
#

Use try catch or (give me a minute)

vapid pelican
#

I said ensure your bot has proper hierarchy.

#

You cannot ban someone who has the same or higher role than you

#

Keep in mind <@&379378609942560770> counts as a role, too.

graceful egret
vapid pelican
#

Well, see if command errored fires.

#

I suspect becuase you're trying to ban everyone, you're trying to ban yourself (the bot) and the exception is taking you out of the loop.

stable beacon
#

Hans tag command error

dire vectorBOT
# stable beacon Hans tag command error

If your command is unresponsive, try checking the following:
* Hook your CommandErrored event on your CommandsNext instance and print the exception to the console, like as follows:

// somewhere in your code: var commands = client.UseCommandsNext();

commands.CommandErrored += (cnext, e) =>
{
    Console.WriteLine($"Ze command went kaput: {e.Exception}");
    return Task.CompletedTask;
};

Now, if your command is throwing an exception, it'll be revealed to the console.
* If you're in an event handler, try making your handler non-blocking. By default, the WebSocket handler dispatches events on the same branch that it uses to receive network data. This means that even though your event handler is asynchronous, its completion is always waited before any further socket messages are processed. If your event handler performs complex tasks, this can cause brief unresponsiveness or, in the worst case, deadlocks. Usually, wrapping your event handler in a Task.Run block should be enough to remedy this issue.
* If neither of the above solutions work, this could mean that there is an issue elsewhere in your code, or, very rarely, a bug in the library. In such case, post as much of the offending code as possible and, if possible, provide steps to reproduce the issue.

graceful egret
vapid pelican
#

Point stands.

#

See if the command errored (which is most likely is.)

graceful egret
#

hmm another user is not banned and he has no spaces

#

Unauthorized

#

strange cus bot has admin

graceful egret
#

but then why it banned some guys and some just cant

vapid pelican
#

Read the message.

vapid pelican
graceful egret
#

so when it try to ban me and fails then it stops banning others?

#

If yes then is there a way to pass it?

#

ok fixed

#

i added if(users.IsOwner == false)

#

and it works now