Search in sources :

Example 1 with VoiceStateUpdate

use of io.discloader.discloader.entity.sendable.VoiceStateUpdate in project DiscLoader by R3alCl0ud.

the class VoiceConnection method sendStateUpdate.

private void sendStateUpdate(IVoiceChannel channel) {
    this.stateUpdated = false;
    VoiceStateUpdate d = new VoiceStateUpdate(getGuild(), channel, false, false);
    getLoader().socket.send(new Packet(4, d));
}
Also used : Packet(io.discloader.discloader.entity.sendable.Packet) VoiceStateUpdate(io.discloader.discloader.entity.sendable.VoiceStateUpdate)

Example 2 with VoiceStateUpdate

use of io.discloader.discloader.entity.sendable.VoiceStateUpdate in project DiscLoader by R3alCl0ud.

the class Gateway method handleQueue.

public void handleQueue() {
    if (!ws.isOpen() || remaining == 0 || queue.isEmpty())
        return;
    Object raw_payload = queue.get(0);
    // loader.em
    remaining--;
    String payload = "";
    if (raw_payload instanceof JSONObject) {
        payload = raw_payload.toString();
    } else {
        if (raw_payload instanceof Packet && ((Packet) raw_payload).d instanceof VoiceStateUpdate) {
            payload = gson.toJson(raw_payload);
        } else {
            payload = DLUtil.gson.toJson(raw_payload);
        }
    }
    logger.info("Sending: " + payload);
    ws.sendText(payload);
    queue.remove(raw_payload);
    handleQueue();
}
Also used : Packet(io.discloader.discloader.entity.sendable.Packet) VoiceStateUpdate(io.discloader.discloader.entity.sendable.VoiceStateUpdate) JSONObject(org.json.JSONObject) JSONObject(org.json.JSONObject)

Aggregations

Packet (io.discloader.discloader.entity.sendable.Packet)2 VoiceStateUpdate (io.discloader.discloader.entity.sendable.VoiceStateUpdate)2 JSONObject (org.json.JSONObject)1