mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-22 01:05:02 +00:00
Start move to configAccessibleObjects, exclude perm overrides from logs
configAccessibleObjects are used to guarantee backwards compatibility and consistency. Perm overrides from our own plugins are ignored as to not spam logs through bot managed slowmode or companion channels
This commit is contained in:
parent
1c7e97c785
commit
d24aea7c5c
28 changed files with 259 additions and 75 deletions
|
@ -1,4 +1,5 @@
|
|||
import { CooldownManager } from "knub";
|
||||
import { GuildLogs } from "../../../data/GuildLogs";
|
||||
import { trimPluginDescription } from "../../utils";
|
||||
import { LogsPlugin } from "../Logs/LogsPlugin";
|
||||
import { zeppelinGuildPlugin } from "../ZeppelinPluginBlueprint";
|
||||
|
@ -32,4 +33,8 @@ export const CompanionChannelsPlugin = zeppelinGuildPlugin<CompanionChannelsPlug
|
|||
beforeLoad(pluginData) {
|
||||
pluginData.state.errorCooldownManager = new CooldownManager();
|
||||
},
|
||||
|
||||
afterLoad(pluginData) {
|
||||
pluginData.state.serverLogs = new GuildLogs(pluginData.guild.id);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -53,6 +53,7 @@ export async function handleCompanionPermissions(
|
|||
for (const channelId of permsToDelete) {
|
||||
const channel = pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
if (!channel || !(channel instanceof TextChannel)) continue;
|
||||
pluginData.state.serverLogs.ignoreLog(LogType.CHANNEL_UPDATE, channelId, 3 * 1000);
|
||||
await channel.permissionOverwrites
|
||||
.resolve(userId as Snowflake)
|
||||
?.delete(`Companion Channel for ${oldChannel!.id} | User Left`);
|
||||
|
@ -61,6 +62,7 @@ export async function handleCompanionPermissions(
|
|||
for (const [channelId, permissions] of permsToSet) {
|
||||
const channel = pluginData.guild.channels.cache.get(channelId as Snowflake);
|
||||
if (!channel || !(channel instanceof TextChannel)) continue;
|
||||
pluginData.state.serverLogs.ignoreLog(LogType.CHANNEL_UPDATE, channelId, 3 * 1000);
|
||||
await channel.permissionOverwrites.create(userId as Snowflake, new Permissions(BigInt(permissions)).serialize(), {
|
||||
reason: `Companion Channel for ${voiceChannel!.id} | User Joined`,
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import * as t from "io-ts";
|
||||
import { BasePluginType, CooldownManager, typedGuildEventListener } from "knub";
|
||||
import { GuildLogs } from "../../data/GuildLogs";
|
||||
import { tNullable } from "../../utils";
|
||||
|
||||
// Permissions using these numbers: https://abal.moe/Eris/docs/reference (add all allowed/denied ones up)
|
||||
|
@ -24,6 +25,7 @@ export interface CompanionChannelsPluginType extends BasePluginType {
|
|||
config: TConfigSchema;
|
||||
state: {
|
||||
errorCooldownManager: CooldownManager;
|
||||
serverLogs: GuildLogs;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue