public class IncomingChatRequestEvent extends Event implements GenericDCCEvent
Listener
for this event, which means that all DCC CHAT requests will
be ignored by default.
If you wish to accept the connection, then you listen for this event and call
the accept()
method, which connects to the sender of the chat
request and allows lines to be sent to and from the bot.
Your bot must be able to connect directly to the user that sent the request.
Example:
// Accept all chat, whoever it's from. ReceiveChat chat = event.accept(); chat.sendLine("Hello"); String response = chat.readLine(); chat.close();
Constructor and Description |
---|
IncomingChatRequestEvent(PircBotX bot,
UserHostmask userHostmask,
User user,
InetAddress address,
int port,
String token,
boolean passive) |
Modifier and Type | Method and Description |
---|---|
ReceiveChat |
accept() |
boolean |
equals(Object o) |
InetAddress |
getAddress() |
InetAddress |
getChatAddress()
Deprecated.
Use
getAddress() from GenericDCCEvent
interface |
int |
getChatPort()
Deprecated.
Use
getPort() from GenericDCCEvent
interface |
String |
getChatToken()
Deprecated.
Use
getToken() from GenericDCCEvent
interface |
int |
getPort() |
String |
getToken() |
User |
getUser()
The source user that generated the event.
|
UserHostmask |
getUserHostmask()
The source user hostmask that generated the event.
|
int |
hashCode() |
boolean |
isPassive() |
void |
respond(String response)
Respond with a private message to the user that sent the request,
not a message over dcc since it might not of been accepted yet
|
String |
toString() |
compareTo, getBot, getId, getTimestamp
getBot, getTimestamp
compareTo
public IncomingChatRequestEvent(PircBotX bot, @NonNull UserHostmask userHostmask, User user, @NonNull InetAddress address, int port, String token, boolean passive)
public ReceiveChat accept() throws IOException
IOException
@Deprecated public InetAddress getChatAddress()
getAddress()
from GenericDCCEvent
interface@Deprecated public int getChatPort()
getPort()
from GenericDCCEvent
interface@Deprecated public String getChatToken()
getToken()
from GenericDCCEvent
interfacepublic void respond(String response)
respond
in interface GenericEvent
respond
in class Event
response
- The response to send@Nullable @Generated(value="lombok") public User getUser()
GenericUserEvent
getUser
in interface GenericUserEvent
@Generated(value="lombok") public UserHostmask getUserHostmask()
GenericUserEvent
getUserHostmask
in interface GenericUserEvent
@Generated(value="lombok") public InetAddress getAddress()
getAddress
in interface GenericDCCEvent
@Generated(value="lombok") public int getPort()
getPort
in interface GenericDCCEvent
@Generated(value="lombok") public String getToken()
getToken
in interface GenericDCCEvent
@Generated(value="lombok") public boolean isPassive()
isPassive
in interface GenericDCCEvent
Copyright © 2010–2020 Leon Blakey. All rights reserved.