Search in sources :

Example 1 with TypingStartEvent

use of io.discloader.discloader.common.event.channel.TypingStartEvent in project DiscLoader by R3alCl0ud.

the class TypingStart method handle.

@Override
public void handle(SocketPacket packet) {
    String d = gson.toJson(packet.d);
    TypingStartJSON data = gson.fromJson(d, TypingStartJSON.class);
    ITextChannel channel = EntityRegistry.getTextChannelByID(data.channel_id);
    if (channel == null)
        channel = EntityRegistry.getPrivateChannelByID(data.channel_id);
    if (channel == null)
        return;
    IUser user = EntityRegistry.getUserByID(data.user_id);
    if (user == null || channel.getTyping() == null)
        return;
    channel.getTyping().put(user.getID(), user);
    TypingStartEvent e = new TypingStartEvent(user, channel);
    loader.emit(e);
    loader.emit("TypingStart", e);
}
Also used : ITextChannel(io.discloader.discloader.entity.channel.ITextChannel) TypingStartJSON(io.discloader.discloader.network.json.TypingStartJSON) IUser(io.discloader.discloader.entity.user.IUser) TypingStartEvent(io.discloader.discloader.common.event.channel.TypingStartEvent)

Aggregations

TypingStartEvent (io.discloader.discloader.common.event.channel.TypingStartEvent)1 ITextChannel (io.discloader.discloader.entity.channel.ITextChannel)1 IUser (io.discloader.discloader.entity.user.IUser)1 TypingStartJSON (io.discloader.discloader.network.json.TypingStartJSON)1