Skip to content

Commit

Permalink
Remove permission, position, and likely spammer logs
Browse files Browse the repository at this point in the history
Signed-off-by: cobalt <[email protected]>
  • Loading branch information
cobaltt7 committed Dec 22, 2024
1 parent 7f4edb4 commit 43f2c36
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 89 deletions.
4 changes: 2 additions & 2 deletions modules/board/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export default async function generateBoardMessage(
info instanceof Message ? info.reactions.resolve(BOARD_EMOJI)?.count || 0 : info.reactions;

async function messageToBoardData(message: Message): Promise<BaseMessageOptions> {
const { files, embeds } = await extractMessageExtremities(message, );
embeds.unshift(await messageToEmbed(message,));
const { files, embeds } = await extractMessageExtremities(message);
embeds.unshift(await messageToEmbed(message));

return {
allowedMentions: { users: [] },
Expand Down
47 changes: 0 additions & 47 deletions modules/logging/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ import type { AuditLog } from "./util.ts";

import { unifiedDiff } from "difflib";
import {
AuditLogOptionsType,
Base,
BaseChannel,
channelMention,
ChannelType,
ForumLayoutType,
roleMention,
SortOrderType,
TextChannel,
ThreadAutoArchiveDuration,
userMention,
VideoQualityMode,
} from "discord.js";
import { formatAnyEmoji } from "strife.js";
Expand Down Expand Up @@ -56,42 +52,6 @@ export async function channelDelete(entry: AuditLog<AuditLogEvent.ChannelDelete>
LogSeverity.ImportantUpdate,
);
}
export async function channelOverwriteCreate(
entry: AuditLog<AuditLogEvent.ChannelOverwriteCreate>,
): Promise<void> {
await log(
`${LoggingEmojis.Channel} Permissions for ${
entry.extra instanceof Base ? entry.extra.toString()
: entry.extra.type === AuditLogOptionsType.Member ? userMention(entry.extra.id)
: roleMention(entry.extra.id)
} in ${channelMention(entry.target.id)} changed${extraAuditLogsInfo(entry)}`,
LogSeverity.ServerChange,
);
}
export async function channelOverwriteUpdate(
entry: AuditLog<AuditLogEvent.ChannelOverwriteUpdate>,
): Promise<void> {
await log(
`${LoggingEmojis.Channel} Permissions for ${
entry.extra instanceof Base ? entry.extra.toString()
: entry.extra.type === AuditLogOptionsType.Member ? userMention(entry.extra.id)
: roleMention(entry.extra.id)
} in ${channelMention(entry.target.id)} changed${extraAuditLogsInfo(entry)}`,
LogSeverity.ServerChange,
);
}
export async function channelOverwriteDelete(
entry: AuditLog<AuditLogEvent.ChannelOverwriteDelete>,
): Promise<void> {
await log(
`${LoggingEmojis.Channel} Permissions for ${
entry.extra instanceof Base ? entry.extra.toString()
: entry.extra.type === AuditLogOptionsType.Member ? userMention(entry.extra.id)
: roleMention(entry.extra.id)
} in ${channelMention(entry.target.id)} changed${extraAuditLogsInfo(entry)}`,
LogSeverity.ServerChange,
);
}

export async function channelUpdate(
oldChannel: DMChannel | NonThreadGuildBasedChannel,
Expand Down Expand Up @@ -159,13 +119,6 @@ export async function channelUpdate(
}`,
LogSeverity.ImportantUpdate,
);
if (oldChannel.rawPosition !== newChannel.rawPosition)
await log(
`${LoggingEmojis.Channel} ${newChannel.toString()} moved to position ${
newChannel.rawPosition
}`,
LogSeverity.ServerChange,
);
if (oldChannel.type !== newChannel.type) {
await log(
`${LoggingEmojis.Channel} ${newChannel.toString()} converted to a${
Expand Down
21 changes: 1 addition & 20 deletions modules/logging/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@ import {
AuditLogEvent,
AutoModerationRule,
AutoModerationRuleTriggerType,
userMention,
WebhookType,
} from "discord.js";
import { defineEvent } from "strife.js";

import config from "../../common/config.ts";
import {
channelCreate,
channelDelete,
channelOverwriteCreate,
channelOverwriteDelete,
channelOverwriteUpdate,
channelUpdate,
} from "./channels.ts";
import { channelCreate, channelDelete, channelUpdate } from "./channels.ts";
import { guildUpdate, inviteCreate, inviteDelete } from "./guild.ts";
import {
messageDelete,
Expand Down Expand Up @@ -49,9 +41,6 @@ import {
const events: { [Event in AuditLogEvent]?: (entry: AuditLog<Event>) => Awaitable<void> } = {
[AuditLogEvent.ChannelCreate]: channelCreate,
[AuditLogEvent.ChannelDelete]: channelDelete,
[AuditLogEvent.ChannelOverwriteCreate]: channelOverwriteCreate,
[AuditLogEvent.ChannelOverwriteUpdate]: channelOverwriteUpdate,
[AuditLogEvent.ChannelOverwriteDelete]: channelOverwriteDelete,
[AuditLogEvent.MemberKick]: memberKick,
[AuditLogEvent.MemberPrune]: memberPrune,
[AuditLogEvent.MemberBanAdd]: memberBanAdd,
Expand Down Expand Up @@ -107,14 +96,6 @@ const events: { [Event in AuditLogEvent]?: (entry: AuditLog<Event>) => Awaitable
[AuditLogEvent.GuildScheduledEventUpdate]: guildScheduledEventUpdate,
[AuditLogEvent.ThreadCreate]: threadCreate,
[AuditLogEvent.ThreadDelete]: threadDelete,
async [AuditLogEvent.ApplicationCommandPermissionUpdate](entry) {
await log(
`${LoggingEmojis.Integration} Permissions for ${userMention(
entry.extra.applicationId,
)}’s commands changed${extraAuditLogsInfo(entry)}`,
LogSeverity.ServerChange,
);
},
async [AuditLogEvent.AutoModerationRuleCreate](entry) {
if (!(entry.target instanceof AutoModerationRule)) return;
await log(
Expand Down
4 changes: 1 addition & 3 deletions modules/logging/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ export async function messageDelete(message: Message | PartialMessage): Promise<

const content = !shush && messageToText(message, false);
const { embeds, files } =
shush ?
{ embeds: [], files: [] }
: await extractMessageExtremities(message, undefined, false);
shush ? { embeds: [], files: [] } : await extractMessageExtremities(message, false);

const unknownAttachments = message.attachments.filter((file) => isFileExpired(file.url));

Expand Down
17 changes: 0 additions & 17 deletions modules/logging/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ export async function memberBanRemove(
export async function guildMemberAdd(member: GuildMember): Promise<void> {
if (member.guild.id !== config.guild.id) return;
await log(`${LoggingEmojis.Member} ${member.toString()} joined`, LogSeverity.Resource);

if (member.user.flags?.has("Spammer")) {
await log(
`${LoggingEmojis.Punishment} ${member.toString()} marked as likely spammer`,
LogSeverity.Alert,
);
}
}
export async function guildMemberRemove(member: GuildMember | PartialGuildMember): Promise<void> {
if (member.guild.id !== config.guild.id) return;
Expand Down Expand Up @@ -141,14 +134,4 @@ export async function userUpdate(oldUser: PartialUser | User, newUser: User): Pr
LogSeverity.Alert,
);
}

const spammer = !!newUser.flags?.has("Spammer");
if (!!oldUser.flags?.has("Spammer") !== spammer) {
await log(
`${LoggingEmojis.Punishment} ${newUser.toString()} ${
spammer ? "" : "un"
}marked as likely spammer`,
LogSeverity.Alert,
);
}
}

0 comments on commit 43f2c36

Please sign in to comment.