Package rs.kreme.ksbot.api.game
Class Chat
- java.lang.Object
-
- rs.kreme.ksbot.api.game.Chat
-
public class Chat extends java.lang.Object
The Chat class provides functionality for sending messages in both private and public chat within the RuneScape game environment. It leverages the KSContext interface to interact with the game client and automate sending messages.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ChatQuery
query()
Returns a FriendQuery object to filter and search friends.void
sendCommand(java.lang.String text)
Sends a command message.void
sendPrivateMessage(java.lang.String player, java.lang.String text)
Sends a private message to a specific player.void
sendPublicChat(java.lang.String text)
Sends a public chat message.
-
-
-
Constructor Detail
-
Chat
public Chat(KSContext ctx)
-
-
Method Detail
-
query
public ChatQuery query()
Returns a FriendQuery object to filter and search friends. Updates the cached friend list only if the game tick has advanced since last query.- Returns:
- FriendQuery containing the cached list of friends.
-
sendPrivateMessage
public void sendPrivateMessage(java.lang.String player, java.lang.String text)
Sends a private message to a specific player.- Parameters:
player
- the name of the player to send the message totext
- the content of the message to send- Throws:
java.lang.IllegalArgumentException
- if the player name or message text is null or emptyjava.lang.IllegalStateException
- if unable to open the private message interface
-
sendPublicChat
public void sendPublicChat(java.lang.String text)
Sends a public chat message.- Parameters:
text
- the content of the public chat message- Throws:
java.lang.IllegalArgumentException
- if the message text is null or empty
-
sendCommand
public void sendCommand(java.lang.String text)
Sends a command message.- Parameters:
text
- the content of the command message- Throws:
java.lang.IllegalArgumentException
- if the message text is null or empty
-
-