List of usage examples for java.lang Long toUnsignedString
public static String toUnsignedString(long i)
From source file:net.dv8tion.jda.core.entities.MessageChannel.java
/** * Used to pin a message. Pinned messages are retrievable via {@link #getPinnedMessages()}. * * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible: * <ul>//from ww w. j av a2s . c o m * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} * <br>The request was attempted after the account lost access to the * {@link net.dv8tion.jda.core.entities.Guild Guild} or {@link net.dv8tion.jda.client.entities.Group Group} * typically due to being kicked or removed, or after {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} * was revoked in the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} * <br>The request was attempted after the account lost * {@link net.dv8tion.jda.core.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} in the * {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}.</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} * <br>The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or * the message it referred to has already been deleted.</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} * <br>The request was attempted after the channel was deleted.</li> * </ul> * * @param messageId * The message to pin. * * @throws IllegalArgumentException * if the provided messageId is not positive. * @throws net.dv8tion.jda.core.exceptions.PermissionException * If this is a {@link net.dv8tion.jda.core.entities.TextChannel TextChannel} and the logged in account does not have * <ul> * <li>{@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ}</li> * <li>{@link net.dv8tion.jda.core.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE}</li> * </ul> * * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} */ @CheckReturnValue default RestAction<Void> pinMessageById(long messageId) { return pinMessageById(Long.toUnsignedString(messageId)); }
From source file:net.dv8tion.jda.core.entities.MessageChannel.java
/** * Used to unpin a message. Pinned messages are retrievable via {@link #getPinnedMessages()}. * * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible: * <ul>/*w w w.j a v a 2s .c om*/ * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} * <br>The request was attempted after the account lost access to the * {@link net.dv8tion.jda.core.entities.Guild Guild} or {@link net.dv8tion.jda.client.entities.Group Group} * typically due to being kicked or removed, or after {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} * was revoked in the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} * <br>The request was attempted after the account lost * {@link net.dv8tion.jda.core.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE} in the * {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}.</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} * <br>The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or * the message it referred to has already been deleted.</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} * <br>The request was attempted after the channel was deleted.</li> * </ul> * * @param messageId * The message to unpin. * * @throws IllegalArgumentException * if the provided messageId is not positive. * @throws net.dv8tion.jda.core.exceptions.PermissionException * If this is a {@link net.dv8tion.jda.core.entities.TextChannel TextChannel} and the logged in account does not have * <ul> * <li>{@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ}</li> * <li>{@link net.dv8tion.jda.core.Permission#MESSAGE_MANAGE Permission.MESSAGE_MANAGE}</li> * </ul> * * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} */ @CheckReturnValue default RestAction<Void> unpinMessageById(long messageId) { return unpinMessageById(Long.toUnsignedString(messageId)); }
From source file:net.dv8tion.jda.core.entities.MessageChannel.java
/** * Attempts to edit a message by its id in this MessageChannel. * * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible: * <ul>//from w w w . j a va 2 s. com * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#INVALID_AUTHOR_EDIT INVALID_AUTHOR_EDIT} * <br>Attempted to edit a message that was not sent by the currently logged in account. * Discord does not allow editing of other users' Messages!</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} * <br>The request was attempted after the account lost access to the * {@link net.dv8tion.jda.core.entities.Guild Guild} or {@link net.dv8tion.jda.client.entities.Group Group} * typically due to being kicked or removed, or after {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} * was revoked in the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} * <br>The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or * the message it referred to has already been deleted.</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} * <br>The request was attempted after the channel was deleted.</li> * </ul> * * @param messageId * The id referencing the Message that should be edited * @param newContent * The new content for the edited message * * @throws IllegalArgumentException * <ul> * <li>If provided {@code messageId} is not positive.</li> * <li>If provided {@code newContent} is {@code null}.</li> * <li>If provided {@link net.dv8tion.jda.core.entities.Message Message} * contains a {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbed} which * is not {@link net.dv8tion.jda.core.entities.MessageEmbed#isSendable(net.dv8tion.jda.core.AccountType) sendable}</li> * </ul> * @throws net.dv8tion.jda.core.exceptions.PermissionException * If this is a TextChannel and this account does not have * {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} * * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: {@link net.dv8tion.jda.core.entities.Message} * <br>The modified Message */ @CheckReturnValue default RestAction<Message> editMessageById(long messageId, Message newContent) { return editMessageById(Long.toUnsignedString(messageId), newContent); }
From source file:org.hyperledger.fabric.sdk.Channel.java
/** * query a peer in this channel for a Block by the blockNumber * * @param peers the peers to try and send the request to * @param blockNumber index of the Block in the chain * @param userContext the user context to use. * @return the {@link BlockInfo} with the given blockNumber * @throws InvalidArgumentException// w ww .j a v a 2 s.c o m * @throws ProposalException */ public BlockInfo queryBlockByNumber(Collection<Peer> peers, long blockNumber, User userContext) throws InvalidArgumentException, ProposalException { checkChannelState(); checkPeers(peers); userContextCheck(userContext); try { logger.debug("queryBlockByNumber with blockNumber " + blockNumber + " on channel " + name); QuerySCCRequest querySCCRequest = new QuerySCCRequest(userContext); querySCCRequest.setFcn(QuerySCCRequest.GETBLOCKBYNUMBER); querySCCRequest.setArgs(name, Long.toUnsignedString(blockNumber)); ProposalResponse proposalResponse = sendProposalSerially(querySCCRequest, peers); return new BlockInfo( Block.parseFrom(proposalResponse.getProposalResponse().getResponse().getPayload())); } catch (InvalidProtocolBufferException e) { logger.error(e); throw new ProposalException(e); } }
From source file:net.dv8tion.jda.core.entities.MessageChannel.java
/** * Attempts to edit a message by its id in this MessageChannel. * * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible: * <ul>//from w w w. j ava2 s .c om * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#INVALID_AUTHOR_EDIT INVALID_AUTHOR_EDIT} * <br>Attempted to edit a message that was not sent by the currently logged in account. * Discord does not allow editing of other users' Messages!</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} * <br>The request was attempted after the account lost access to the * {@link net.dv8tion.jda.core.entities.Guild Guild} or {@link net.dv8tion.jda.client.entities.Group Group} * typically due to being kicked or removed, or after {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} * was revoked in the {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE} * <br>The provided {@code messageId} is unknown in this MessageChannel, either due to the id being invalid, or * the message it referred to has already been deleted.</li> * * <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} * <br>The request was attempted after the channel was deleted.</li> * </ul> * * @param messageId * The id referencing the Message that should be edited * @param newEmbed * The new {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbed} for the edited message * * @throws IllegalArgumentException * <ul> * <li>If provided {@code messageId} is not positive.</li> * <li>If provided {@link net.dv8tion.jda.core.entities.MessageEmbed MessageEmbed} * is not {@link net.dv8tion.jda.core.entities.MessageEmbed#isSendable(net.dv8tion.jda.core.AccountType) sendable}</li> * </ul> * @throws IllegalStateException * If the provided MessageEmbed is {@code null} * @throws net.dv8tion.jda.core.exceptions.PermissionException * If this is a TextChannel and this account does not have * {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ} * or {@link net.dv8tion.jda.core.Permission#MESSAGE_WRITE Permission.MESSAGE_WRITE} * * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: {@link net.dv8tion.jda.core.entities.Message} * <br>The modified Message */ @CheckReturnValue default RestAction<Message> editMessageById(long messageId, MessageEmbed newEmbed) { return editMessageById(Long.toUnsignedString(messageId), newEmbed); }