public class GroupImpl extends java.lang.Object implements Group
Constructor and Description |
---|
GroupImpl(java.lang.String id,
JDAImpl api) |
Modifier and Type | Method and Description |
---|---|
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. |
Call |
getCurrentCall() |
java.util.List<Friend> |
getFriends() |
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. |
RestAction<MessageHistory> |
getHistoryAround(Message markerMessage,
int limit) |
RestAction<MessageHistory> |
getHistoryAround(java.lang.String markedMessageId,
int limit) |
java.lang.String |
getIconId() |
java.lang.String |
getIconUrl() |
java.lang.String |
getId()
The Snowflake id of this entity.
|
JDA |
getJDA()
Returns the
JDA instance of this MessageChannel |
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. |
java.lang.String |
getName()
Returns the name set for this group.
If no name has been set for this group, then null is returned. |
java.util.List<User> |
getNonFriendUsers() |
User |
getOwner() |
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. |
java.util.HashMap<java.lang.String,User> |
getUserMap() |
java.util.List<User> |
getUsers() |
RestAction |
leaveGroup() |
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.
|
GroupImpl |
setCurrentCall(Call call) |
GroupImpl |
setIconId(java.lang.String iconId) |
GroupImpl |
setName(java.lang.String name) |
GroupImpl |
setOwner(User owner) |
RestAction<Call> |
startCall() |
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 GroupImpl(java.lang.String id, JDAImpl api)
public java.lang.String getName()
Group
getName
in interface Group
getName
in interface MessageChannel
public java.lang.String getIconUrl()
getIconUrl
in interface Group
public java.util.List<User> getNonFriendUsers()
getNonFriendUsers
in interface Group
public java.util.List<Friend> getFriends()
getFriends
in interface Group
public RestAction<Call> startCall()
startCall
in interface CallableChannel
public Call getCurrentCall()
getCurrentCall
in interface CallableChannel
public RestAction leaveGroup()
leaveGroup
in interface Group
public java.lang.String getId()
ISnowflake
getId
in interface ISnowflake
public JDA getJDA()
MessageChannel
JDA
instance of this MessageChannelgetJDA
in interface MessageChannel
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<MessageHistory> getHistoryAround(Message markerMessage, int limit)
getHistoryAround
in interface MessageChannel
public RestAction<MessageHistory> getHistoryAround(java.lang.String markedMessageId, int limit)
getHistoryAround
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
RestAction
.public RestAction<java.lang.Void> pinMessageById(java.lang.String messageId)
MessageChannel
pinMessageById
in interface MessageChannel
messageId
- The message to pin.RestAction
<Void
>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
RestAction<List<Message>>
public java.util.HashMap<java.lang.String,User> getUserMap()
public GroupImpl setName(java.lang.String name)
public GroupImpl setIconId(java.lang.String iconId)