public class PrivateChannelImpl extends java.lang.Object implements PrivateChannel
Constructor and Description |
---|
PrivateChannelImpl(java.lang.String id,
User user) |
Modifier and Type | Method and Description |
---|---|
RestAction |
close()
Closes a PrivateChannel.
|
RestAction<java.lang.Void> |
deleteMessageById(java.lang.String messageId)
Attempts to delete a
Message from the Discord servers
that has the same id as the id provided. |
MessageHistory |
getHistory()
Creates a new
MessageHistory object for each call of this method.This is NOT and internal message cache, but rather it queries the Discord servers for old messages. |
java.lang.String |
getId()
The Snowflake id of this entity.
|
JDA |
getJDA()
Returns the
JDA instance of this PrivateChannel |
RestAction<Message> |
getMessageById(java.lang.String messageId)
Attempts to get a
Message from the Discord servers that has
the same id as the id provided. |
RestAction<java.util.List<Message>> |
getPinnedMessages()
Gets a List of
Messages that have been pinned in this channel.If no messages have been pinned, this returns an empty List. |
User |
getUser()
The
User that this PrivateChannel communicates with. |
boolean |
isFake() |
RestAction<java.lang.Void> |
pinMessageById(java.lang.String messageId)
Used to pin a message.
If the provided messageId is invalid or not in this channel, this does nothing. |
RestAction<Message> |
sendFile(java.io.File file,
Message message)
Uploads a file to the Discord servers and sends it to this
TextChannel . |
RestAction<Message> |
sendMessage(Message msg)
|
RestAction<Message> |
sendMessage(java.lang.String text)
Sends a plain text
Message to this channel. |
RestAction |
sendTyping()
Sends the typing status to discord.
|
PrivateChannelImpl |
setFake(boolean fake) |
RestAction<java.lang.Void> |
unpinMessageById(java.lang.String messageId)
Used to unpin a message.
If the provided messageId is invalid or not in this channel, this does nothing. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCreationTime
public PrivateChannelImpl(java.lang.String id, User user)
public User getUser()
PrivateChannel
User
that this PrivateChannel
communicates with.getUser
in interface PrivateChannel
User
.public JDA getJDA()
PrivateChannel
JDA
instance of this PrivateChannelgetJDA
in interface MessageChannel
getJDA
in interface PrivateChannel
public RestAction<Message> sendMessage(java.lang.String text)
MessageChannel
Message
to this channel.
This will fail if the account of the api does not have the Write-Permission
for this channel set
After the Message has been sent, the created Message
object is returned
This Object will be null, if the sending failed.
When the Rate-limit is reached (10 Messages in 10 secs), a RateLimitedException
is thrownsendMessage
in interface MessageChannel
text
- the text to sendpublic RestAction<Message> sendMessage(Message msg)
MessageChannel
Message
to this Channel
This method only extracts the mentions, text and tts status out of the given Message-Object
Therefore this can also be used to resend already received Messages
To allow above behaviour, this method returns a new Message
instance. The passed one is not modified!
If the sending of the Message failed (probably Permissions), this method returns null.
When the Rate-limit is reached (10 Messages in 10 secs), a RateLimitedException
is thrownsendMessage
in interface MessageChannel
msg
- the Message
to sendMessage
object or null if it failedpublic RestAction<Message> sendFile(java.io.File file, Message message)
MessageChannel
TextChannel
.
Sends the provided Message
with the uploaded file.null
for
the message
parameter.sendFile
in interface MessageChannel
file
- The file to upload to the TextChannel
.message
- The message to be sent along with the uploaded file. This value can be null
.Message
created from this upload.public RestAction<Message> getMessageById(java.lang.String messageId)
MessageChannel
Message
from the Discord servers that has
the same id as the id provided.getMessageById
in interface MessageChannel
messageId
- The id of the sought after Messagepublic RestAction<java.lang.Void> deleteMessageById(java.lang.String messageId)
MessageChannel
Message
from the Discord servers
that has the same id as the id provided.deleteMessageById
in interface MessageChannel
messageId
- The id of the Message which should be deletedpublic MessageHistory getHistory()
MessageChannel
MessageHistory
object for each call of this method.getHistory
in interface MessageChannel
public RestAction sendTyping()
MessageChannel
The official discord client sends this every 5 seconds even though the typing status lasts 10.
sendTyping
in interface MessageChannel
public RestAction<java.lang.Void> pinMessageById(java.lang.String messageId)
MessageChannel
pinMessageById
in interface MessageChannel
messageId
- The message to pin.public RestAction<java.lang.Void> unpinMessageById(java.lang.String messageId)
MessageChannel
unpinMessageById
in interface MessageChannel
messageId
- The message to pin.public RestAction<java.util.List<Message>> getPinnedMessages()
MessageChannel
Messages
that have been pinned in this channel.getPinnedMessages
in interface MessageChannel
public RestAction close()
PrivateChannel
close
in interface PrivateChannel
public java.lang.String getId()
ISnowflake
getId
in interface ISnowflake
public PrivateChannelImpl setFake(boolean fake)