mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 20:35:02 +00:00
Update to Knub30.0.0-beta.37 and Eris 0.15, first pass
This commit is contained in:
parent
84da543205
commit
f6be4f4af6
133 changed files with 6507 additions and 380 deletions
|
@ -13,7 +13,8 @@ const defaultOptions: PluginOptions<SelfGrantableRolesPluginType> = {
|
|||
},
|
||||
};
|
||||
|
||||
export const SelfGrantableRolesPlugin = zeppelinGuildPlugin<SelfGrantableRolesPluginType>()("self_grantable_roles", {
|
||||
export const SelfGrantableRolesPlugin = zeppelinGuildPlugin<SelfGrantableRolesPluginType>()({
|
||||
name: "self_grantable_roles",
|
||||
showInDocs: true,
|
||||
|
||||
configSchema: ConfigSchema,
|
||||
|
@ -93,7 +94,7 @@ export const SelfGrantableRolesPlugin = zeppelinGuildPlugin<SelfGrantableRolesPl
|
|||
RoleAddCmd,
|
||||
],
|
||||
|
||||
onLoad(pluginData) {
|
||||
afterLoad(pluginData) {
|
||||
pluginData.state.cooldowns = new CooldownManager();
|
||||
},
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ export const RoleAddCmd = selfGrantableRolesCmd({
|
|||
async run({ message: msg, args, pluginData }) {
|
||||
const lock = await pluginData.locks.acquire(memberRolesLock(msg.author));
|
||||
|
||||
const applyingEntries = getApplyingEntries(pluginData, msg);
|
||||
const applyingEntries = await getApplyingEntries(pluginData, msg);
|
||||
if (applyingEntries.length === 0) {
|
||||
lock.unlock();
|
||||
return;
|
||||
|
|
|
@ -7,7 +7,7 @@ export const RoleHelpCmd = selfGrantableRolesCmd({
|
|||
permission: null,
|
||||
|
||||
async run({ message: msg, pluginData }) {
|
||||
const applyingEntries = getApplyingEntries(pluginData, msg);
|
||||
const applyingEntries = await getApplyingEntries(pluginData, msg);
|
||||
if (applyingEntries.length === 0) return;
|
||||
|
||||
const allPrimaryAliases: string[] = [];
|
||||
|
|
|
@ -18,7 +18,7 @@ export const RoleRemoveCmd = selfGrantableRolesCmd({
|
|||
async run({ message: msg, args, pluginData }) {
|
||||
const lock = await pluginData.locks.acquire(memberRolesLock(msg.author));
|
||||
|
||||
const applyingEntries = getApplyingEntries(pluginData, msg);
|
||||
const applyingEntries = await getApplyingEntries(pluginData, msg);
|
||||
if (applyingEntries.length === 0) {
|
||||
lock.unlock();
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as t from "io-ts";
|
||||
import { BasePluginType, guildCommand, CooldownManager } from "knub";
|
||||
import { BasePluginType, typedGuildCommand, CooldownManager } from "knub";
|
||||
|
||||
const RoleMap = t.record(t.string, t.array(t.string));
|
||||
|
||||
|
@ -31,4 +31,4 @@ export interface SelfGrantableRolesPluginType extends BasePluginType {
|
|||
};
|
||||
}
|
||||
|
||||
export const selfGrantableRolesCmd = guildCommand<SelfGrantableRolesPluginType>();
|
||||
export const selfGrantableRolesCmd = typedGuildCommand<SelfGrantableRolesPluginType>();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { TSelfGrantableRoleEntry, SelfGrantableRolesPluginType } from "../types";
|
||||
import { GuildPluginData } from "knub";
|
||||
|
||||
export function getApplyingEntries(
|
||||
export async function getApplyingEntries(
|
||||
pluginData: GuildPluginData<SelfGrantableRolesPluginType>,
|
||||
msg,
|
||||
): TSelfGrantableRoleEntry[] {
|
||||
const config = pluginData.config.getForMessage(msg);
|
||||
): Promise<TSelfGrantableRoleEntry[]> {
|
||||
const config = await pluginData.config.getForMessage(msg);
|
||||
return Object.entries(config.entries)
|
||||
.filter(
|
||||
([k, e]) =>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue