mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Add !guild_reload to reload the current guild's config and plugins
This commit is contained in:
parent
1b151fff24
commit
60c434999e
1 changed files with 22 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
import { Plugin, decorators as d, reply } from "knub";
|
import { Plugin, decorators as d, reply } from "knub";
|
||||||
import { Channel, Embed, EmbedOptions, Message, TextChannel, User, VoiceChannel } from "eris";
|
import { Channel, EmbedOptions, Message, TextChannel, User, VoiceChannel } from "eris";
|
||||||
import {
|
import {
|
||||||
embedPadding,
|
embedPadding,
|
||||||
errorMessage,
|
errorMessage,
|
||||||
|
@ -18,6 +18,8 @@ import { CaseType } from "../data/CaseType";
|
||||||
const MAX_SEARCH_RESULTS = 15;
|
const MAX_SEARCH_RESULTS = 15;
|
||||||
const MAX_CLEAN_COUNT = 50;
|
const MAX_CLEAN_COUNT = 50;
|
||||||
|
|
||||||
|
const activeReloads: Map<string, TextChannel> = new Map();
|
||||||
|
|
||||||
export class UtilityPlugin extends Plugin {
|
export class UtilityPlugin extends Plugin {
|
||||||
protected logs: GuildLogs;
|
protected logs: GuildLogs;
|
||||||
protected cases: GuildCases;
|
protected cases: GuildCases;
|
||||||
|
@ -30,7 +32,8 @@ export class UtilityPlugin extends Plugin {
|
||||||
search: false,
|
search: false,
|
||||||
clean: false,
|
clean: false,
|
||||||
info: false,
|
info: false,
|
||||||
server: true
|
server: false,
|
||||||
|
reload_guild: false
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
@ -41,7 +44,8 @@ export class UtilityPlugin extends Plugin {
|
||||||
search: true,
|
search: true,
|
||||||
clean: true,
|
clean: true,
|
||||||
info: true,
|
info: true,
|
||||||
server: true
|
server: true,
|
||||||
|
reload_guild: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -51,6 +55,11 @@ export class UtilityPlugin extends Plugin {
|
||||||
onLoad() {
|
onLoad() {
|
||||||
this.logs = new GuildLogs(this.guildId);
|
this.logs = new GuildLogs(this.guildId);
|
||||||
this.cases = new GuildCases(this.guildId);
|
this.cases = new GuildCases(this.guildId);
|
||||||
|
|
||||||
|
if (activeReloads && activeReloads.has(this.guildId)) {
|
||||||
|
activeReloads.get(this.guildId).createMessage(successMessage("Reloaded!"));
|
||||||
|
activeReloads.delete(this.guildId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@d.command("roles")
|
@d.command("roles")
|
||||||
|
@ -346,4 +355,14 @@ export class UtilityPlugin extends Plugin {
|
||||||
|
|
||||||
msg.channel.createMessage({ embed });
|
msg.channel.createMessage({ embed });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@d.command("reload_guild")
|
||||||
|
@d.permission("reload_guild")
|
||||||
|
reloadGuildCmd(msg: Message) {
|
||||||
|
if (activeReloads.has(this.guildId)) return;
|
||||||
|
activeReloads.set(this.guildId, msg.channel as TextChannel);
|
||||||
|
|
||||||
|
msg.channel.createMessage("Reloading...");
|
||||||
|
this.knub.reloadGuild(this.guildId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue