寻找指定ID的子频道
val guild: QGGuild = ...
// 假设这是某个子频道的ID
val id = 1234L.ID
val channel = guild.channel(id)
val chatChannel = guild.chatChannel(id)
val forumChannel = guild.forum(id)
批量获取子频道
val guild: QGGuild = ...
guild.channels
// .asFlow() // 也可以转成 Flow
.collect { channel -> }
val chatChannelList = guild.chatChannels
.asFlow().toList()
guild.forums.collect { forum -> }
寻找指定ID的子频道
QGGuild guild = ...
// 假设这是某个子频道的ID
var id = Identifies.of(1234L);
guild.getChannelAsync(id)
.thenAccept(channel -> {...});
guild.getChatChannelAsync(id)
.thenAccept(channel -> {...});
guild.getForumAsync(id)
.thenAccept(channel -> {...});
QGGuild guild = ...
// 假设这是某个子频道的ID
var id = Identifies.of(1234L);
final var channel = guild.getChannel(id);
final var chatChannel = guild.getChatChannel(id);
final var forum = guild.getForum(id);
QGGuild guild = ...
// 假设这是某个子频道的ID
var id = Identifies.of(1234L);
guild.getChannelReserve(id)
// 假设转化为 Reactor 的 `Mono`
.transform(SuspendReserves.mono())
.subscribe(channel -> {});
guild.getChatChannelReserve(id)
// 假设转化为 Reactor 的 `Mono`
.transform(SuspendReserves.mono())
.subscribe(channel -> {});
guild.getForumReserve(id)
// 假设转化为 Reactor 的 `Mono`
.transform(SuspendReserves.mono())
.subscribe(channel -> {});
批量获取子频道
QGGuild guild = ...
// 可以直接在异步中遍历
// 第一个参数 scope 可以选择 QGGuild、QGBot 等,
// 或者直接使用 GlobalScope
guild.getChannels().collectAsync(GlobalScope.INSTANCE, channel -> { });
// 可以使用 Collectables.collectAsync
var chatChannelsCollectable = guild.getChatChannels();
Collectables.collectAsync(chatChannelsCollectable, Collectors.toList())
.thenAccept(chatChannelList -> {});
// 可以直接使用 Collectable的扩展
var forumsCollectable = guild.getForums();
Collectables.toListAsync(forumsCollectable);
.thenAccept(forum -> {...});
QGGuild guild = ...
// 可以使用 SuspendReserves.list 转为 List
var channelList = guild.getChannels().transform(SuspendReserves.list());
// 可以使用 Collectables 转成 Stream 或 List
var chatChannelsCollectable = guild.getChatChannels();
Collectables.asStream(chatChannelsCollectable)
.forEach(chatChannel -> {});
// 可以直接使用 Collectable的扩展
var forumsCollectable = guild.getForums();
var forumList = Collectables.toList(forumsCollectable);
QGGuild guild = ...
// 可以直接在异步中遍历
// CoroutineScope 可以选择 QGBot、QGGuild等
// 也可以选择 GlobalScope
guild.getChannels().collectAsync(GlobalScope.INSTANCE, channel -> { });
// 可以使用 Collectables 转成 Flux
var chatChannelsCollectable = guild.getChatChannels();
Collectables.asFlux(chatChannelsCollectable)
.subscribe(chatChannel -> {});
var forumsCollectable = guild.getForums();
Collectables.asFlux(forumsCollectable)
.subscribe(forum -> {});