3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-25 18:25:03 +00:00

.resolve instead of .fetch

Co-authored-by: Almeida <almeidx@pm.me>
This commit is contained in:
metal 2021-12-10 17:14:20 +00:00 committed by GitHub
parent 432e237a7b
commit c38ef6f0a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,14 +39,14 @@ export const ChangePermsAction = automodAction({
);
const target = await renderTarget(actionConfig.target);
const channelId = actionConfig.channel ? await renderChannel(actionConfig.channel) : null;
const role = await pluginData.guild.roles.fetch(target);
const role = pluginData.guild.roles.resolve(target);
if (!role) {
const member = await pluginData.guild.members.fetch(target).catch(noop);
if (!member) return;
}
if (channelId && isValidSnowflake(channelId)) {
const channel = await pluginData.guild.channels.fetch(channelId);
const channel = pluginData.guild.channels.resolve(channelId);
if (!channel) return;
const overwrite = channel.permissionOverwrites.cache.find((pw) => pw.id === target);
const allow = new Permissions(overwrite?.allow ?? 0n).serialize();