mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Typed log functions + more
This commit is contained in:
parent
d2ac700143
commit
bed6589d48
166 changed files with 4021 additions and 869 deletions
|
@ -1,6 +1,6 @@
|
|||
import { GuildMemberEditData, Permissions } from "discord.js";
|
||||
import intersection from "lodash.intersection";
|
||||
import { memberToConfigAccessibleMember } from "../../../utils/configAccessibleObjects";
|
||||
import { memberToTemplateSafeMember } from "../../../utils/templateSafeObjects";
|
||||
import { LogType } from "../../../data/LogType";
|
||||
import { canAssignRole } from "../../../utils/canAssignRole";
|
||||
import { getMissingPermissions } from "../../../utils/getMissingPermissions";
|
||||
|
@ -37,7 +37,7 @@ export const LoadDataEvt = persistEvt({
|
|||
if (config.persisted_roles) requiredPermissions |= p.MANAGE_ROLES;
|
||||
const missingPermissions = getMissingPermissions(me.permissions, requiredPermissions);
|
||||
if (missingPermissions) {
|
||||
pluginData.getPlugin(LogsPlugin).log(LogType.BOT_ALERT, {
|
||||
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
||||
body: `Missing permissions for persist plugin: ${missingPermissionError(missingPermissions)}`,
|
||||
});
|
||||
return;
|
||||
|
@ -47,7 +47,7 @@ export const LoadDataEvt = persistEvt({
|
|||
if (config.persisted_roles) {
|
||||
for (const roleId of config.persisted_roles) {
|
||||
if (!canAssignRole(pluginData.guild, me, roleId)) {
|
||||
pluginData.getPlugin(LogsPlugin).log(LogType.BOT_ALERT, {
|
||||
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
||||
body: `Missing permissions to assign role \`${roleId}\` in persist plugin`,
|
||||
});
|
||||
return;
|
||||
|
@ -74,8 +74,8 @@ export const LoadDataEvt = persistEvt({
|
|||
await member.edit(toRestore, "Restored upon rejoin");
|
||||
await pluginData.state.persistedData.clear(member.id);
|
||||
|
||||
pluginData.state.logs.log(LogType.MEMBER_RESTORE, {
|
||||
member: memberToConfigAccessibleMember(member),
|
||||
pluginData.getPlugin(LogsPlugin).logMemberRestore({
|
||||
member,
|
||||
restoredData: restoredData.join(", "),
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue