use of net.dv8tion.jda.api.entities.Channel in project JDA by DV8FromTheWorld.
the class ChannelCreateHandler method handleInternally.
@Override
protected Long handleInternally(DataObject content) {
ChannelType type = ChannelType.fromId(content.getInt("type"));
long guildId = 0;
JDAImpl jda = getJDA();
if (type.isGuild()) {
guildId = content.getLong("guild_id");
if (jda.getGuildSetupController().isLocked(guildId))
return guildId;
}
Channel channel = buildChannel(type, content, guildId);
if (channel == null) {
WebSocketClient.LOG.debug("Discord provided an CREATE_CHANNEL event with an unknown channel type! JSON: {}", content);
return null;
}
jda.handleEvent(new ChannelCreateEvent(jda, responseNumber, channel));
return null;
}
use of net.dv8tion.jda.api.entities.Channel in project dDiscordBot by DenizenScript.
the class DiscordConnection method getChannel.
public Channel getChannel(long id) {
Channel result = client.getGuildChannelById(id);
if (result != null) {
return result;
}
result = client.getPrivateChannelById(id);
if (result != null) {
return result;
}
return null;
}
use of net.dv8tion.jda.api.entities.Channel in project dDiscordBot by DenizenScript.
the class DiscordConnection method getMessage.
public Message getMessage(long channel, long message) {
Message result = cache.getMessage(channel, message);
if (result != null) {
return result;
}
if (!DenizenDiscordBot.allowMessageRetrieval) {
return null;
}
Channel chan = getChannel(channel);
if (!(chan instanceof MessageChannel)) {
return null;
}
return ((MessageChannel) chan).retrieveMessageById(message).complete();
}
Aggregations