mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 04:25:01 +00:00
Migrate Roles to new Plugin structure
This commit is contained in:
parent
ebcb28261b
commit
3685cc4df8
7 changed files with 388 additions and 0 deletions
49
backend/src/plugins/Roles/RolesPlugin.ts
Normal file
49
backend/src/plugins/Roles/RolesPlugin.ts
Normal file
|
@ -0,0 +1,49 @@
|
|||
import { zeppelinPlugin } from "../ZeppelinPluginBlueprint";
|
||||
import { PluginOptions } from "knub";
|
||||
import { ConfigSchema, RolesPluginType } from "./types";
|
||||
import { GuildLogs } from "src/data/GuildLogs";
|
||||
import { AddRoleCmd } from "./commands/AddRoleCmd";
|
||||
import { RemoveRoleCmd } from "./commands/RemoveRoleCmd";
|
||||
import { MassAddRoleCmd } from "./commands/MassAddRoleCmd";
|
||||
import { MassRemoveRoleCmd } from "./commands/MassRemoveRoleCmd";
|
||||
|
||||
const defaultOptions: PluginOptions<RolesPluginType> = {
|
||||
config: {
|
||||
can_assign: false,
|
||||
can_mass_assign: false,
|
||||
assignable_roles: ["558037973581430785"],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
level: ">=50",
|
||||
config: {
|
||||
can_assign: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
level: ">=100",
|
||||
config: {
|
||||
can_mass_assign: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const RolesPlugin = zeppelinPlugin<RolesPluginType>()("roles", {
|
||||
configSchema: ConfigSchema,
|
||||
defaultOptions,
|
||||
|
||||
// prettier-ignore
|
||||
commands: [
|
||||
AddRoleCmd,
|
||||
RemoveRoleCmd,
|
||||
MassAddRoleCmd,
|
||||
MassRemoveRoleCmd,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
const { state, guild } = pluginData;
|
||||
|
||||
state.logs = new GuildLogs(guild.id);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue