2020-10-01 01:43:38 +03:00
|
|
|
import { PingableRole } from "../../../data/entities/PingableRole";
|
|
|
|
import { GuildPluginData } from "knub";
|
2020-07-21 23:11:05 +02:00
|
|
|
import { PingableRolesPluginType } from "../types";
|
|
|
|
|
|
|
|
export async function getPingableRolesForChannel(
|
2020-10-01 01:43:38 +03:00
|
|
|
pluginData: GuildPluginData<PingableRolesPluginType>,
|
2020-07-21 23:11:05 +02:00
|
|
|
channelId: string,
|
|
|
|
): Promise<PingableRole[]> {
|
|
|
|
if (!pluginData.state.cache.has(channelId)) {
|
|
|
|
pluginData.state.cache.set(channelId, await pluginData.state.pingableRoles.getForChannel(channelId));
|
|
|
|
}
|
|
|
|
|
2020-11-09 20:03:57 +02:00
|
|
|
return pluginData.state.cache.get(channelId)!;
|
2020-07-21 23:11:05 +02:00
|
|
|
}
|