Java Code Examples for net.dv8tion.jda.api.Permission#MESSAGE_HISTORY
The following examples show how to use
net.dv8tion.jda.api.Permission#MESSAGE_HISTORY .
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: CleanupCommand.java From SkyBot with GNU Affero General Public License v3.0 | 5 votes |
public CleanupCommand() { this.name = "cleanup"; this.aliases = new String[]{ "clear", "purge", "wipe", }; this.help = "Performs a purge in the channel where the command is run.\n" + "To clear an entire channel it's better to use `{prefix}purgechannel`"; this.usage = "[amount/cancel] [--keep-pinned] [--bots-only]"; this.userPermissions = new Permission[]{ Permission.MESSAGE_MANAGE, Permission.MESSAGE_HISTORY, }; this.botPermissions = new Permission[]{ Permission.MESSAGE_MANAGE, Permission.MESSAGE_HISTORY, }; this.flags = new Flag[]{ new Flag( "keep-pinned", "If this flag is set the messages that are pinned in the channel will be skipped" ), new Flag( "bots-only", "If this flag is set only messages that are from bots will be deleted" ), }; }
Example 2
Source File: PurgeChannelCommand.java From SkyBot with GNU Affero General Public License v3.0 | 5 votes |
public PurgeChannelCommand() { this.requiresArgs = true; this.name = "purgechannel"; this.help = "Purges an entire text channel"; this.usage = "<#channel>"; this.userPermissions = new Permission[]{ Permission.MESSAGE_MANAGE, Permission.MESSAGE_HISTORY, }; this.botPermissions = new Permission[]{ Permission.MANAGE_CHANNEL, Permission.MANAGE_SERVER, }; }
Example 3
Source File: PurgeUserCommand.java From SkyBot with GNU Affero General Public License v3.0 | 5 votes |
public PurgeUserCommand() { this.shouldLoadMembers = true; this.requiresArgs = true; this.name = "purgeuser"; this.help = "Purges the last " + DEL_COUNT + " messages of a user"; this.usage = "<@user>"; this.userPermissions = new Permission[]{ Permission.MESSAGE_MANAGE, Permission.MESSAGE_HISTORY, }; this.botPermissions = new Permission[]{ Permission.MESSAGE_MANAGE, Permission.MESSAGE_HISTORY, }; }
Example 4
Source File: MessageHistory.java From JDA with Apache License 2.0 | 5 votes |
/** * Creates a new MessageHistory object. * * @param channel * The {@link net.dv8tion.jda.api.entities.MessageChannel MessageChannel} to retrieval history from. */ public MessageHistory(@Nonnull MessageChannel channel) { Checks.notNull(channel, "Channel"); this.channel = channel; if (channel instanceof TextChannel) { TextChannel tc = (TextChannel) channel; if (!tc.getGuild().getSelfMember().hasPermission(tc, Permission.MESSAGE_HISTORY)) throw new InsufficientPermissionException(tc, Permission.MESSAGE_HISTORY); } }
Example 5
Source File: MessageHistory.java From JDA with Apache License 2.0 | 5 votes |
private static void checkArguments(MessageChannel channel, String messageId) { Checks.isSnowflake(messageId, "Message ID"); Checks.notNull(channel, "Channel"); if (channel.getType() == ChannelType.TEXT) { TextChannel t = (TextChannel) channel; if (!t.getGuild().getSelfMember().hasPermission(t, Permission.MESSAGE_HISTORY)) throw new InsufficientPermissionException(t, Permission.MESSAGE_HISTORY); } }
Example 6
Source File: MessagePaginationActionImpl.java From JDA with Apache License 2.0 | 5 votes |
public MessagePaginationActionImpl(MessageChannel channel) { super(channel.getJDA(), Route.Messages.GET_MESSAGE_HISTORY.compile(channel.getId()), 1, 100, 100); if (channel.getType() == ChannelType.TEXT) { TextChannel textChannel = (TextChannel) channel; if (!textChannel.getGuild().getSelfMember().hasPermission(textChannel, Permission.MESSAGE_HISTORY)) throw new InsufficientPermissionException(textChannel, Permission.MESSAGE_HISTORY); } this.channel = channel; }