2019-06-23 19:18:41 +03:00
|
|
|
import { ZeppelinPlugin } from "./ZeppelinPlugin";
|
|
|
|
import { AllowedGuilds } from "../data/AllowedGuilds";
|
|
|
|
import { MINUTES } from "../utils";
|
|
|
|
|
|
|
|
export class GuildInfoSaverPlugin extends ZeppelinPlugin {
|
|
|
|
public static pluginName = "guild_info_saver";
|
2019-08-22 01:22:26 +03:00
|
|
|
public static showInDocs = false;
|
2019-06-23 19:18:41 +03:00
|
|
|
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() {
|
2019-07-12 14:25:27 +03:00
|
|
|
this.allowedGuilds.updateInfo(this.guildId, this.guild.name, this.guild.iconURL, this.guild.ownerID);
|
2019-06-23 19:18:41 +03:00
|
|
|
}
|
|
|
|
}
|