3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-14 22:05:01 +00:00

Migrate PingableRoles to new Plugin structure

This commit is contained in:
Dark 2020-07-21 23:11:05 +02:00
parent f324dfc227
commit ed344be4b5
9 changed files with 232 additions and 0 deletions

View file

@ -0,0 +1,14 @@
import { PingableRole } from "src/data/entities/PingableRole";
import { PluginData } from "knub";
import { PingableRolesPluginType } from "../types";
export async function getPingableRolesForChannel(
pluginData: PluginData<PingableRolesPluginType>,
channelId: string,
): Promise<PingableRole[]> {
if (!pluginData.state.cache.has(channelId)) {
pluginData.state.cache.set(channelId, await pluginData.state.pingableRoles.getForChannel(channelId));
}
return pluginData.state.cache.get(channelId);
}