Example usage for java.lang Long toUnsignedString

List of usage examples for java.lang Long toUnsignedString

Introduction

In this page you can find the example usage for java.lang Long toUnsignedString.

Prototype

public static String toUnsignedString(long i) 

Source Link

Document

Returns a string representation of the argument as an unsigned decimal value.

Usage

From source file:sx.blah.discord.handle.impl.obj.Channel.java

@Override
public IMessage fetchMessage(long messageID) {
    return messages.getOrElseGet(messageID, () -> {
        PermissionUtils.requirePermissions(this, client.getOurUser(), Permissions.READ_MESSAGES,
                Permissions.READ_MESSAGE_HISTORY);
        return RequestBuffer
                .request(/*from w ww.  j  a  v  a  2  s. c  o  m*/
                        () -> (IMessage) DiscordUtils
                                .getMessageFromJSON(this,
                                        client.REQUESTS.GET.makeRequest(
                                                DiscordEndpoints.CHANNELS + this.getStringID() + "/messages/"
                                                        + Long.toUnsignedString(messageID),
                                                MessageObject.class)))
                .get();
    });
}

From source file:sx.blah.discord.handle.impl.obj.Guild.java

@Override
public void banUser(long userID, String reason, int deleteMessagesForDays) {
    IUser user = getUserByID(userID);/*  w w  w .ja  v  a2s. c  o  m*/
    if (getUserByID(userID) == null) {
        PermissionUtils.requirePermissions(this, client.getOurUser(), Permissions.BAN);
    } else {
        PermissionUtils.requireHierarchicalPermissions(this, client.getOurUser(), getRolesForUser(user),
                Permissions.BAN);
    }
    if (reason != null && reason.length() > Ban.MAX_REASON_LENGTH) {
        throw new IllegalArgumentException("Reason length cannot be more than " + Ban.MAX_REASON_LENGTH);
    }
    try {
        ((DiscordClientImpl) client).REQUESTS.PUT.makeRequest(DiscordEndpoints.GUILDS + getStringID() + "/bans/"
                + Long.toUnsignedString(userID) + "?delete-message-days=" + deleteMessagesForDays
                + (reason == null ? "" : ("&reason=" + URLEncoder.encode(reason, "UTF-8"))));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
}

From source file:sx.blah.discord.handle.impl.obj.Guild.java

@Override
public void pardonUser(long userID) {
    PermissionUtils.requirePermissions(this, client.getOurUser(), Permissions.BAN);
    ((DiscordClientImpl) client).REQUESTS.DELETE
            .makeRequest(DiscordEndpoints.GUILDS + getStringID() + "/bans/" + Long.toUnsignedString(userID));
}

From source file:com.ibm.streamsx.topology.test.splpy.PythonFunctionalOperatorsTest.java

/**
 * Test that specific values in Python//from   w w w.  j a v a  2  s  . com
 * make their way into SPL correctly
 * when returning as a tuple.
 * @throws Exception
 */
@Test
public void testValues() throws Exception {
    Topology topology = new Topology("testValues");

    addTestToolkit(topology);

    SPLStream pysrc = SPL.invokeSource(topology, "com.ibm.streamsx.topology.pytest.pysource::SpecificValues",
            null, ALL_PYTHON_TYPES_SCHEMA);

    StreamSchema sparseSchema = Type.Factory
            .getStreamSchema("tuple<int32 a, int32 b, int32 c, int32 d, int32 e>");

    Tester tester = topology.getTester();
    Condition<Long> expectedCount = tester.tupleCount(pysrc, 1);
    Condition<List<Tuple>> outTuples = tester.tupleContents(pysrc);

    SPLStream pysparse = SPL.invokeSource(topology, "com.ibm.streamsx.topology.pytest.pysource::SparseTuple",
            null, sparseSchema);
    SPLStream pysparsemap = SPL.invokeOperator("com.ibm.streamsx.topology.pytest.pymap::SparseTupleMap",
            pysparse, sparseSchema.extend("int32", "f"), null);

    Condition<Long> expectedCountSparse = tester.tupleCount(pysparse, 1);
    Condition<List<Tuple>> sparseTupleOut = tester.tupleContents(pysparse);

    Condition<Long> expectedCountSparseMap = tester.tupleCount(pysparsemap, 1);
    Condition<List<Tuple>> sparseTupleMapOut = tester.tupleContents(pysparsemap);

    // getConfig().put(ContextProperties.TRACING_LEVEL, TraceLevel.DEBUG);

    complete(tester, expectedCount.and(expectedCountSparse, expectedCountSparseMap), 20, TimeUnit.SECONDS);

    assertTrue(expectedCount.valid());
    assertTrue(expectedCountSparse.valid());
    assertTrue(expectedCountSparseMap.valid());

    Tuple r1 = outTuples.getResult().get(0);

    assertTrue(r1.getBoolean("b"));

    // signed integers
    // 23, -2525, 3252352, -2624565653,
    assertEquals(r1.getByte("i8"), 23);
    assertEquals(r1.getShort("i16"), -2525);
    assertEquals(r1.getInt("i32"), 3252352);
    assertEquals(r1.getLong("i64"), -2624565653L);

    // unsigned int
    // 72, 6873, 43665588, 357568872
    assertEquals(r1.getString("u8"), "72");
    assertEquals(r1.getString("u16"), "6873");
    assertEquals(r1.getString("u32"), "43665588");
    assertEquals(r1.getString("u64"), "357568872");

    // floats
    // 4367.34, -87657525334.22
    assertEquals(r1.getFloat("f32"), 4367.34f, 0.1);
    assertEquals(r1.getDouble("f64"), -87657525334.22d, 0.1);

    // rstring, Unicode data
    assertEquals(
            "?  ? ???  ? ?  ?  ?",
            r1.getString("r"));

    // complex(-23.0, 325.38), complex(-35346.234, 952524.93)
    assertEquals(((Complex) r1.getObject("c32")).getReal(), -23.0, 0.1);
    assertEquals(((Complex) r1.getObject("c32")).getImaginary(), 325.38, 0.1);

    assertEquals(((Complex) r1.getObject("c64")).getReal(), -35346.234, 0.1);
    assertEquals(((Complex) r1.getObject("c64")).getImaginary(), 952524.93, 0.1);

    // Timestamp Timestamp(781959759, 9320, 76)
    assertEquals(781959759L, r1.getTimestamp("ts").getSeconds());
    assertEquals(9320, r1.getTimestamp("ts").getNanoseconds());
    assertEquals(76, r1.getTimestamp("ts").getMachineId());

    // ["a", "Streams!", "2H + O  2HO, R = 4.7 k,  200 mm"]
    {
        @SuppressWarnings("unchecked")
        List<RString> lr = (List<RString>) r1.getObject("lr");
        assertEquals(3, lr.size());
        assertEquals("a", lr.get(0).getString());
        assertEquals("Streams!", lr.get(1).getString());
        assertEquals("2H + O  2HO, R = 4.7 k,  200 mm", lr.get(2).getString());
    }

    //  [345,-4578],
    {
        int[] li32 = (int[]) r1.getObject("li32");
        assertEquals(2, li32.length);
        assertEquals(345, li32[0]);
        assertEquals(-4578, li32[1]);
    }

    // [9983, -4647787587, 0]
    {
        long[] li64 = (long[]) r1.getObject("li64");
        assertEquals(3, li64.length);
        assertEquals(9983L, li64[0]);
        assertEquals(-4647787587L, li64[1]);
        assertEquals(0L, li64[2]);
    }

    {
        @SuppressWarnings("unchecked")
        List<Integer> lui32 = (List<Integer>) r1.getObject("lui32");
        assertEquals(1, lui32.size());
        assertEquals("87346", Integer.toUnsignedString(lui32.get(0)));
    }

    {
        @SuppressWarnings("unchecked")
        List<Long> lui64 = (List<Long>) r1.getObject("lui64");
        assertEquals(2, lui64.size());
        assertEquals("45433674", Long.toUnsignedString(lui64.get(0)));
        assertEquals("41876984848", Long.toUnsignedString(lui64.get(1)));
    }

    // 4.269986E+05, -8.072285E+02 -6.917091E-08 7.735085E8
    {
        float[] li32 = (float[]) r1.getObject("lf32");
        assertEquals(4, li32.length);
        assertEquals(4.269986E+05f, li32[0], 0.1);
        assertEquals(-8.072285E+02f, li32[1], 0.1);
        assertEquals(-6.917091E-08f, li32[2], 0.1);
        assertEquals(7.735085E8f, li32[3], 0.1);
    }

    {
        double[] lf64 = (double[]) r1.getObject("lf64");
        assertEquals(1, lf64.length);
        assertEquals(765.46477e19, lf64[0], 0.1);
    }

    {
        boolean[] lb = (boolean[]) r1.getObject("lb");
        assertEquals(3, lb.length);
        assertTrue(lb[0]);
        assertFalse(lb[1]);
        assertTrue(lb[2]);
    }

    assertTrue(r1.getMap("mi32r").isEmpty());
    assertTrue(r1.getMap("mru32").isEmpty());

    {
        Map<?, ?> mri32 = r1.getMap("mri32");
        assertEquals(2, mri32.size());
        System.out.println("mri32:" + mri32);
        assertTrue(mri32.containsKey(new RString("abc")));
        assertTrue(mri32.containsKey(new RString("?")));

        assertEquals(35320, mri32.get(new RString("abc")));
        assertEquals(-236325, mri32.get(new RString("?")));
    }

    assertTrue(r1.getMap("mu32r").isEmpty());
    assertTrue(r1.getMap("mi32i32").isEmpty());
    assertTrue(r1.getMap("mu32u32").isEmpty());
    assertTrue(r1.getMap("mrr").isEmpty());
    assertTrue(r1.getMap("mf64f64").isEmpty());
    assertTrue(r1.getMap("mf64i32").isEmpty());
    assertTrue(r1.getMap("mf64u32").isEmpty());
    assertTrue(r1.getMap("mf64r").isEmpty());
    assertTrue(r1.getMap("mrf64").isEmpty());

    // Sparse tuple handling - source
    assertEquals(1, sparseTupleOut.getResult().size());
    Tuple st = sparseTupleOut.getResult().get(0);
    assertEquals(37, st.getInt("a")); // set by op
    assertEquals(0, st.getInt("b")); // default as None in tuple
    assertEquals(0, st.getInt("c")); // default as None in tuple
    assertEquals(-46, st.getInt("d")); // set by op
    assertEquals(0, st.getInt("e")); // default as no value (short tuple)

    // Sparse tuple handling - map
    assertEquals(1, sparseTupleMapOut.getResult().size());
    Tuple stm = sparseTupleMapOut.getResult().get(0);
    assertEquals(37 + 81, stm.getInt("a")); // set by op
    assertEquals(23, stm.getInt("b")); // set by op
    assertEquals(0, stm.getInt("c")); // default as None in tuple
    assertEquals(-46, stm.getInt("d")); // default to matching input
    assertEquals(34, stm.getInt("e")); // set by op
    assertEquals(0, stm.getInt("f")); // default as no value (short tuple)
}

From source file:org.ScripterRon.TokenExchange.TokenAPI.java

/**
 * Format a Bitcoin account/*from w  w  w .  j  a v a 2 s.  c om*/
 *
 * @param   account         Bitcoin account
 * @param   response        Response object
 * @return                  Response object
 */
@SuppressWarnings("unchecked")
private static JSONObject formatAccount(BitcoinAccount account, JSONObject response) {
    response.put("address", account.getBitcoinAddress());
    response.put("account", Long.toUnsignedString(account.getAccountId()));
    response.put("accountRS", account.getAccountIdRS());
    response.put("timestamp", account.getTimestamp());
    return response;
}

From source file:net.dv8tion.jda.core.entities.MessageChannel.java

/**
 * Attempts to get a {@link net.dv8tion.jda.core.entities.Message Message} from the Discord's servers that has
 * the same id as the id provided.//from   w  w w.  ja  v a  2s .c om
 * <br>Note: when retrieving a Message, you must retrieve it from the channel it was sent in!
 *
 * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible:
 * <ul>
 *     <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_HISTORY Permission.MESSAGE_HISTORY}
 *         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 id} does not refer to a message sent in this channel or the message 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 of the sought after Message
 *
 * @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_HISTORY Permission.MESSAGE_HISTORY}</li>
 *         </ul>
 *
 * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: Message
 *         <br>The Message defined by the provided id.
 */
@CheckReturnValue
default RestAction<Message> getMessageById(long messageId) {
    return getMessageById(Long.toUnsignedString(messageId));
}

From source file:net.dv8tion.jda.core.entities.MessageChannel.java

/**
 * Attempts to delete a {@link net.dv8tion.jda.core.entities.Message Message} from the Discord servers that has
 * the same id as the id provided.//from w  w  w .  jav  a 2  s . c o m
 *
 * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible:
 * <ul>
 *     <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 attempted to delete a Message in a {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}
 *         that was not sent by the currently logged in account.</li>
 *
 *     <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#INVALID_DM_ACTION INVALID_DM_ACTION}
 *     <br>Attempted to delete a Message in a {@link net.dv8tion.jda.core.entities.PrivateChannel PrivateChannel} or
 *         {@link net.dv8tion.jda.client.entities.Group Group} that was not sent by the currently logged in account.</li>
 *
 *     <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_MESSAGE UNKNOWN_MESSAGE}
 *     <br>The provided {@code id} does not refer to a message sent in this channel or the message 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 of the Message that should be deleted
 *
 * @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
 *         {@link net.dv8tion.jda.core.Permission#MESSAGE_READ Permission.MESSAGE_READ}.
 *
 * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: Void
 */
@CheckReturnValue
default AuditableRestAction<Void> deleteMessageById(long messageId) {
    return deleteMessageById(Long.toUnsignedString(messageId));
}

From source file:net.dv8tion.jda.core.entities.MessageChannel.java

/**
 * Uses the provided {@code id} of a message as a marker and retrieves messages around
 * the marker. The {@code limit} determines the amount of message retrieved near the marker. Discord will
 * attempt to evenly split the limit between before and after the marker, however in the case that the marker is set
 * near the beginning or near the end of the channel's history the amount of messages on each side of the marker may
 * be different, and their total count may not equal the provided {@code limit}.
 *
 * <p><b>Examples:</b>
 * <br>Retrieve 100 messages from the middle of history. {@literal >}100 message exist in history and the marker is {@literal >}50 messages
 * from the edge of history./*from w w w  . j  av  a  2 s . c o m*/
 * <br>{@code getHistoryAround(messageId, 100)} - This will retrieve 100 messages from history, 50 before the marker
 * and 50 after the marker.
 *
 * <p>Retrieve 10 messages near the end of history. Provided id is for a message that is the 3rd most recent message.
 * <br>{@code getHistoryAround(messageId, 10)} - This will retrieve 10 messages from history, 8 before the marker
 * and 2 after the marker.
 *
 * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible:
 * <ul>
 *     <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_HISTORY Permission.MESSAGE_HISTORY} 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, thus could not be used as a marker.</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 of the message that will act as a marker. The id must refer to a message from this MessageChannel.
 * @param limit
 *        The amount of message to be retrieved around the marker. Minimum: 1, Max: 100.
 *
 * @throws java.lang.IllegalArgumentException
 *         <ul>
 *             <li>Provided {@code messageId} is not positive.</li>
 *             <li>Provided {@code limit} is less than {@code 1} or greater than {@code 100}.</li>
 *         </ul>
 * @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_HISTORY Permission.MESSAGE_HISTORY}</li>
 *         </ul>
 *
 * @return {@link net.dv8tion.jda.core.requests.RestAction RestAction} - Type: {@link net.dv8tion.jda.core.entities.MessageHistory MessageHistory}
 *         <br>Provides a MessageHistory object with message around the provided message loaded into it.
 */
@CheckReturnValue
default RestAction<MessageHistory> getHistoryAround(long messageId, int limit) {
    return getHistoryAround(Long.toUnsignedString(messageId), limit);
}

From source file:net.dv8tion.jda.core.entities.MessageChannel.java

/**
 * Attempts to react to a message represented by the specified {@code messageId}
 * in this MessageChannel./*from  w  w w .  j  a  v  a2s  . c  o  m*/
 *
 * <p>The unicode provided has to be a UTF-8 representation of the emoji
 * that is supposed to be represented by the Reaction.
 * <br>To retrieve the characters needed you can use an api or
 * the official discord client by escaping the emoji (\:emoji-name:)
 * and copying the resulting emoji from the sent message.
 *
 * <p>This method encodes the provided unicode for you.
 * <b>Do not encode the emoji before providing the unicode.</b>
 *
 * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible:
 * <ul>
 *     <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}
 *     <br>Also can happen if the account lost the {@link net.dv8tion.jda.core.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}</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_ADD_REACTION Permission.MESSAGE_ADD_REACTION} in the
 *         {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}.</li>
 *
 *     <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_EMOJI}
 *     <br>The provided unicode character does not refer to a known emoji unicode character.
 *     <br>Proper unicode characters for emojis can be found at
 *         <a href="http://unicode.org/emoji/charts/full-emoji-list.html" target="_blank">http://unicode.org/emoji/charts/full-emoji-list.html</a></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 messageId to attach the reaction to
 * @param  unicode
 *         The UTF-8 characters to react with
 *
 * @throws java.lang.IllegalArgumentException
 *         <ul>
 *             <li>If provided {@code messageId} is not positive.</li>
 *         </ul>
 * @throws net.dv8tion.jda.core.exceptions.PermissionException
 *         If the MessageChannel this message was sent in was 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_ADD_REACTION Permission.MESSAGE_ADD_REACTION}</li>
 *             <li>{@link net.dv8tion.jda.core.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}</li>
 *         </ul>
 *
 * @return {@link net.dv8tion.jda.core.requests.RestAction}
 */
@CheckReturnValue
default RestAction<Void> addReactionById(long messageId, String unicode) {
    return addReactionById(Long.toUnsignedString(messageId), unicode);
}

From source file:net.dv8tion.jda.core.entities.MessageChannel.java

/**
 * Attempts to react to a message represented by the specified {@code messageId}
 * in this MessageChannel.//  w ww.j a  va  2 s  .  c om
 *
 * <p><b>An Emote is not the same as an emoji!</b>
 * <br>Emotes are custom guild-specific images unlike global unicode emojis!
 *
 * <p><b><u>Unicode emojis are not included as {@link net.dv8tion.jda.core.entities.Emote Emote}!</u></b>
 *
 * <p>The following {@link net.dv8tion.jda.core.requests.ErrorResponse ErrorResponses} are possible:
 * <ul>
 *     <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}
 *     <br>Also can happen if the account lost the {@link net.dv8tion.jda.core.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}</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_ADD_REACTION Permission.MESSAGE_ADD_REACTION} in the
 *         {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}.</li>
 *
 *     <li>{@link net.dv8tion.jda.core.requests.ErrorResponse#UNKNOWN_EMOJI}
 *     <br>The request was attempted after the provided {@link net.dv8tion.jda.core.entities.Emote Emote}
 *         was deleted.</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 messageId to attach the reaction to
 * @param  emote
 *         The not-null {@link net.dv8tion.jda.core.entities.Emote} to react with
 *
 * @throws java.lang.IllegalArgumentException
 *         <ul>
 *             <li>If provided {@code messageId} is not positive.</li>
 *             <li>If provided {@code emote} is {@code null}</li>
 *         </ul>
 * @throws net.dv8tion.jda.core.exceptions.PermissionException
 *         If the MessageChannel this message was sent in was 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_ADD_REACTION Permission.MESSAGE_ADD_REACTION}</li>
 *             <li>{@link net.dv8tion.jda.core.Permission#MESSAGE_HISTORY Permission.MESSAGE_HISTORY}</li>
 *         </ul>
 *
 * @return {@link net.dv8tion.jda.core.requests.RestAction}
 */
@CheckReturnValue
default RestAction<Void> addReactionById(long messageId, Emote emote) {
    return addReactionById(Long.toUnsignedString(messageId), emote);
}