zappyzep/backend/src/plugins/GuildInfoSaver.ts
2020-06-30 17:48:18 +03:00

25 lines
751 B
TypeScript

import { ZeppelinPluginClass } from "./ZeppelinPluginClass";
import { AllowedGuilds } from "../data/AllowedGuilds";
import { MINUTES } from "../utils";
export class GuildInfoSaverPlugin extends ZeppelinPluginClass {
public static pluginName = "guild_info_saver";
public static showInDocs = false;
protected allowedGuilds: AllowedGuilds;
private updateInterval;
onLoad() {
this.allowedGuilds = new AllowedGuilds();
this.updateGuildInfo();
this.updateInterval = setInterval(() => this.updateGuildInfo(), 60 * MINUTES);
}
onUnload() {
clearInterval(this.updateInterval);
}
protected updateGuildInfo() {
this.allowedGuilds.updateInfo(this.guildId, this.guild.name, this.guild.iconURL, this.guild.ownerID);
}
}