@JSGetter public DelegateStream<HostObjectChannel> channels() { return new DelegateStream<>( Discord.getInstance() .getChannels() .stream() .map(c -> HostObjectChannel.impl(c, ScriptableObject.getTopLevelScope(this)))); }
@JSFunction public HostObjectChannel getChannel(String id) { IChannel channel = Discord.getInstance().getChannelById(id); if (channel == null) return null; return HostObjectChannel.impl(channel, ScriptableObject.getTopLevelScope(this)); }