Package io.manebot.chat
Interface Chat
-
- All Superinterfaces:
ChatMessageReceiver
public interface Chat extends ChatMessageReceiver
-
-
Method Summary
Modifier and Type Method Description default voidaddMember(PlatformUser user)Adds a platform-specific user to this conversation.voidaddMember(java.lang.String platformId)Adds a platform-specific user to this conversation.default voidaddUser(User user)Adds a user to this conversation.booleancanChangeTypingStatus()Finds if it is possible to change the typing status in this chat.default booleancanFormatMessages()Finds if this chat supports formatting messages.default booleancanReceiveMessages()Finds if the bot can receive messages in this conversation.default booleancanSendEmoji()Finds if the bot can get emoji in this conversation.default booleancanSendMessages()Finds if the bot can get simple text messages in this conversation.default java.util.Collection<java.lang.Character>getCommandPrefixes()Gets the default command prefixes for this chat, for messages to be handles as commands.default intgetDefaultPageSize()Gets the default page size for this chat.TextFormatgetFormat()Gets the formatter associated with this chat.java.lang.StringgetId()Gets this conversation's ID.java.util.Collection<ChatMessage>getLastMessages(int max)Gets the last n messages in this chat.default java.lang.StringgetName()Gets the user-friendly name of this chat.PlatformgetPlatform()Gets the platform associated with facilitating this conversation.default PlatformConnectiongetPlatformConnection()Gets the platform connection associated with facilitating this conversation.default java.util.Collection<java.lang.String>getPlatformUserIds()Gets a raw immutable collection of members, in the form of platform-specific Ids.java.util.Collection<PlatformUser>getPlatformUsers()Gets platform-specific user participants.default java.lang.StringgetTopic()Gets the current topic of the chat.default java.util.Collection<UserAssociation>getUserAssociations()Gets the member user associations for this conversation.default UserRegistrationgetUserRegistration()Gets the user registration handler associated with this chat.default java.util.Collection<User>getUsers()Gets the users in this conversation.default booleanisBuffered()Finds if this chat should buffer its output.booleanisConnected()Finds if this conversation is connected to the plugin's associated conversation resource.default booleanisParticipant(PlatformUser user)Finds if a given platform user is a member of this conversation.default booleanisParticipant(User user)Finds if a given user is a member of this conversation.booleanisPrivate()Finds if the conversation is private.booleanisTyping()Finds if the bot is typing in this conversation.default ChatMessageparseCommand(ChatMessage message)Processes a chat message and formats the message as a command.default voidremoveMember(PlatformUser user)Removes, or kicks, a platform-specific user from this conversation.voidremoveMember(java.lang.String platformId)Removes, or kicks, a platform-specific user from this conversation.default voidremoveUser(User user)Removes, or kicks, a user from the conversation.voidsetName(java.lang.String name)Sets the name, or title, of this conversation.default voidsetTopic(java.lang.String topic)Sets the chat's topic.voidsetTyping(boolean typing)Sets the Bot's typing status on this conversation.default TextBuildertext()Creates a new text builder for the chat's format.-
Methods inherited from interface io.manebot.chat.ChatMessageReceiver
canSendEmbeds, sendFormattedMessage, sendFormattedMessages, sendMessage, sendMessage, sendMessages, sendMessages, sendRawMessage, sendRawMessages
-
-
-
-
Method Detail
-
getPlatformConnection
default PlatformConnection getPlatformConnection()
Gets the platform connection associated with facilitating this conversation.- Returns:
- PlatformConnection instance.
-
getUserRegistration
default UserRegistration getUserRegistration()
Gets the user registration handler associated with this chat.- Returns:
- user registration instance.
-
getPlatform
Platform getPlatform()
Gets the platform associated with facilitating this conversation.- Returns:
- Platform instance.
-
getId
java.lang.String getId()
Gets this conversation's ID. Chat IDs should follow the format: platform:scope:internal Where, platform is the Platform instance name. scope is a Platform-specific scope. internal is a scope-specific identifier.- Returns:
- Chat ID.
-
getName
default java.lang.String getName()
Gets the user-friendly name of this chat.- Returns:
- chat user-friendly name.
-
setName
void setName(java.lang.String name) throws java.lang.UnsupportedOperationExceptionSets the name, or title, of this conversation.- Parameters:
name- Conversation title.- Throws:
java.lang.UnsupportedOperationException
-
setTopic
default void setTopic(java.lang.String topic)
Sets the chat's topic.- Parameters:
topic- chat topic to set.- Throws:
java.lang.UnsupportedOperationException- if chat topics are not supported by the platform.
-
getTopic
default java.lang.String getTopic()
Gets the current topic of the chat.- Returns:
- current topic if set, null otherwise.
-
isConnected
boolean isConnected()
Finds if this conversation is connected to the plugin's associated conversation resource.- Returns:
- true if the conversation is connected to a resource, false otherwise.
-
isBuffered
default boolean isBuffered()
Finds if this chat should buffer its output. Buffered output will get individual command response lines in "chunks" for most commands.- Returns:
- true if buffering should take place, false otherwise.
-
removeUser
default void removeUser(User user)
Removes, or kicks, a user from the conversation.- Parameters:
user- User to remove.
-
removeMember
void removeMember(java.lang.String platformId)
Removes, or kicks, a platform-specific user from this conversation.- Parameters:
platformId- Platform-specific Id to remove.
-
removeMember
default void removeMember(PlatformUser user)
Removes, or kicks, a platform-specific user from this conversation.- Parameters:
user- Platform-specific Id to remove.
-
addUser
default void addUser(User user)
Adds a user to this conversation.- Parameters:
user- User to add.
-
addMember
void addMember(java.lang.String platformId)
Adds a platform-specific user to this conversation.- Parameters:
platformId- platform-specific Id.
-
addMember
default void addMember(PlatformUser user)
Adds a platform-specific user to this conversation.- Parameters:
user- platform-specific user to add.
-
getLastMessages
java.util.Collection<ChatMessage> getLastMessages(int max)
Gets the last n messages in this chat.- Parameters:
max- Maximum messages to return.- Returns:
- ChatMessage collection of previous messages.
-
isParticipant
default boolean isParticipant(User user)
Finds if a given user is a member of this conversation.- Parameters:
user- user instance to search for in this conversation.- Returns:
- true if the user is a member of this conversation, false otherwise.
-
isParticipant
default boolean isParticipant(PlatformUser user)
Finds if a given platform user is a member of this conversation.- Parameters:
user- platform user instance to search for in this conversation.- Returns:
- true if the platform user is a member of this conversation, false otherwise.
-
getUsers
default java.util.Collection<User> getUsers()
Gets the users in this conversation.- Returns:
- immutable collection of users in this conversation.
-
getPlatformUsers
java.util.Collection<PlatformUser> getPlatformUsers()
Gets platform-specific user participants.- Returns:
- PlatformUser instances.
-
getUserAssociations
default java.util.Collection<UserAssociation> getUserAssociations()
Gets the member user associations for this conversation.- Returns:
- immutable collection of member user associations in this conversation.
-
getPlatformUserIds
default java.util.Collection<java.lang.String> getPlatformUserIds()
Gets a raw immutable collection of members, in the form of platform-specific Ids.- Returns:
- immutable collection of all members, in the form of platform-specific Ids.
-
isPrivate
boolean isPrivate()
Finds if the conversation is private. Private conversations are conversations which are typically a direct conversation between the Bot and a single User.- Returns:
- true if the conversation is private.
-
canChangeTypingStatus
boolean canChangeTypingStatus()
Finds if it is possible to change the typing status in this chat.- Returns:
- true if typing status can be changed, false otherwise.
-
setTyping
void setTyping(boolean typing)
Sets the Bot's typing status on this conversation.- Parameters:
typing- true to begin typing, false otherwise.
-
isTyping
boolean isTyping()
Finds if the bot is typing in this conversation.- Returns:
- true if the bot is typing, false otherwise.
-
canSendMessages
default boolean canSendMessages()
Finds if the bot can get simple text messages in this conversation.- Returns:
- true if the bot can get messages, false otherwise.
-
getFormat
TextFormat getFormat()
Gets the formatter associated with this chat. ChatFormatters are used to apply rich styles to text.- Returns:
- ChatFormatter instance.
-
text
default TextBuilder text()
Creates a new text builder for the chat's format.- Returns:
- TextBuilder instance.
-
canFormatMessages
default boolean canFormatMessages()
Finds if this chat supports formatting messages.- Returns:
- true if the chat supports formatting messages.
-
canReceiveMessages
default boolean canReceiveMessages()
Finds if the bot can receive messages in this conversation.- Returns:
- true if the bot receive get messages, false otherwise.
-
canSendEmoji
default boolean canSendEmoji()
Finds if the bot can get emoji in this conversation.- Returns:
- true if the bot receive get emoji, false otherwise.
-
getCommandPrefixes
default java.util.Collection<java.lang.Character> getCommandPrefixes()
Gets the default command prefixes for this chat, for messages to be handles as commands.- Returns:
- immutable collection of command prefixes (such as, "." or "!").
-
getDefaultPageSize
default int getDefaultPageSize()
Gets the default page size for this chat.- Returns:
- default page size.
-
parseCommand
default ChatMessage parseCommand(ChatMessage message)
Processes a chat message and formats the message as a command.- Parameters:
message- ChatMessage instance to check- Returns:
- ReceivedChatMessage instance of the parsed command, null if there is no command detected.
-
-