mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-17 15:15:02 +00:00
13 lines
625 B
TypeScript
13 lines
625 B
TypeScript
import { GuildPluginData } from "knub";
|
|
import { ReactionRolesPluginType } from "../types.js";
|
|
import { refreshReactionRoles } from "./refreshReactionRoles.js";
|
|
|
|
export async function runAutoRefresh(pluginData: GuildPluginData<ReactionRolesPluginType>) {
|
|
// Refresh reaction roles on all reaction role messages
|
|
const reactionRoles = await pluginData.state.reactionRoles.all();
|
|
const idPairs = new Set(reactionRoles.map((r) => `${r.channel_id}-${r.message_id}`));
|
|
for (const pair of idPairs) {
|
|
const [channelId, messageId] = pair.split("-");
|
|
await refreshReactionRoles(pluginData, channelId, messageId);
|
|
}
|
|
}
|