Java Code Examples for net.dv8tion.jda.api.Permission#BAN_MEMBERS
The following examples show how to use
net.dv8tion.jda.api.Permission#BAN_MEMBERS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UnbanCommand.java From SkyBot with GNU Affero General Public License v3.0 | 6 votes |
public UnbanCommand() { this.requiresArgs = true; this.name = "unban"; this.aliases = new String[]{ "ban't", "pardon", }; this.help = "Removes the ban for a user"; this.usage = "<user> [-r reason]"; this.botPermissions = new Permission[]{ Permission.BAN_MEMBERS, }; this.flags = new Flag[]{ new Flag( 'r', "reason", "Sets the reason for this unban" ), }; }
Example 2
Source File: BanCommand.java From SkyBot with GNU Affero General Public License v3.0 | 6 votes |
public BanCommand() { this.shouldLoadMembers = true; this.requiresArgs = true; this.requiredArgCount = 2; this.name = "ban"; this.aliases = new String[]{ "dabon", "naenae", }; this.help = "Bans a user from the server **(THIS WILL DELETE MESSAGES)**"; this.usage = "<@user> [-r Reason]"; this.botPermissions = new Permission[]{ Permission.BAN_MEMBERS, }; this.flags = new Flag[]{ new Flag( 'r', "reason", "Sets the reason for this ban" ), new Flag( "nodel", "Prevents the deletion of any messages" ), }; }
Example 3
Source File: SoftbanCommand.java From SkyBot with GNU Affero General Public License v3.0 | 6 votes |
public SoftbanCommand() { this.shouldLoadMembers = true; this.requiresArgs = true; this.name = "softban"; this.help = "Kicks a user from the server **(THIS WILL DELETE MESSAGES)**"; this.usage = "<@user> [-r reason]"; this.userPermissions = new Permission[]{ Permission.KICK_MEMBERS, }; this.botPermissions = new Permission[]{ Permission.BAN_MEMBERS, }; this.flags = new Flag[]{ new Flag( 'r', "reason", "Sets the reason for this kick" ), }; }
Example 4
Source File: TempBanCommand.java From SkyBot with GNU Affero General Public License v3.0 | 6 votes |
public TempBanCommand() { this.shouldLoadMembers = true; this.requiresArgs = true; this.requiredArgCount = 2; this.name = "tempban"; this.help = "Temporally bans a user from the server **(THIS WILL DELETE MESSAGES)**"; this.usage = "<@user> <time><w/d/h/m/s> [-r Reason]"; this.botPermissions = new Permission[]{ Permission.BAN_MEMBERS, }; this.flags = new Flag[]{ new Flag( 'r', "reason", "Sets the reason for this ban" ), }; }
Example 5
Source File: GuildImpl.java From JDA with Apache License 2.0 | 6 votes |
@Nonnull @Override public RestActionImpl<List<Ban>> retrieveBanList() { if (!getSelfMember().hasPermission(Permission.BAN_MEMBERS)) throw new InsufficientPermissionException(this, Permission.BAN_MEMBERS); Route.CompiledRoute route = Route.Guilds.GET_BANS.compile(getId()); return new RestActionImpl<>(getJDA(), route, (response, request) -> { EntityBuilder builder = api.getEntityBuilder(); List<Ban> bans = new LinkedList<>(); DataArray bannedArr = response.getArray(); for (int i = 0; i < bannedArr.length(); i++) { final DataObject object = bannedArr.getObject(i); DataObject user = object.getObject("user"); bans.add(new Ban(builder.createFakeUser(user), object.getString("reason", null))); } return Collections.unmodifiableList(bans); }); }
Example 6
Source File: GuildImpl.java From JDA with Apache License 2.0 | 6 votes |
@Nonnull @Override public RestAction<Ban> retrieveBanById(@Nonnull String userId) { if (!getSelfMember().hasPermission(Permission.BAN_MEMBERS)) throw new InsufficientPermissionException(this, Permission.BAN_MEMBERS); Checks.isSnowflake(userId, "User ID"); Route.CompiledRoute route = Route.Guilds.GET_BAN.compile(getId(), userId); return new RestActionImpl<>(getJDA(), route, (response, request) -> { EntityBuilder builder = api.getEntityBuilder(); DataObject bannedObj = response.getObject(); DataObject user = bannedObj.getObject("user"); return new Ban(builder.createFakeUser(user), bannedObj.getString("reason", null)); }); }
Example 7
Source File: HackbanCommand.java From SkyBot with GNU Affero General Public License v3.0 | 5 votes |
public HackbanCommand() { this.requiresArgs = true; this.name = "hackban"; this.help = "Ban a user before they can join your server."; this.usage = "<userId...>"; this.botPermissions = new Permission[]{ Permission.BAN_MEMBERS, }; }
Example 8
Source File: ModBaseCommand.java From SkyBot with GNU Affero General Public License v3.0 | 4 votes |
public ModBaseCommand() { this.category = CommandCategory.MODERATION; this.userPermissions = new Permission[]{Permission.KICK_MEMBERS, Permission.BAN_MEMBERS}; }