mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Reformat all files with Prettier
This commit is contained in:
parent
0cde0d46d2
commit
ac79eb09f5
206 changed files with 727 additions and 888 deletions
|
@ -17,7 +17,7 @@ export const AddRolesAction = automodAction({
|
|||
defaultConfig: [],
|
||||
|
||||
async apply({ pluginData, contexts, actionConfig, ruleName }) {
|
||||
const members = unique(contexts.map(c => c.member).filter(nonNullish));
|
||||
const members = unique(contexts.map((c) => c.member).filter(nonNullish));
|
||||
const me = pluginData.guild.members.cache.get(pluginData.client.user!.id)!;
|
||||
|
||||
const missingPermissions = getMissingPermissions(me.permissions, p.MANAGE_ROLES);
|
||||
|
@ -41,7 +41,7 @@ export const AddRolesAction = automodAction({
|
|||
|
||||
if (rolesWeCannotAssign.length) {
|
||||
const roleNamesWeCannotAssign = rolesWeCannotAssign.map(
|
||||
roleId => pluginData.guild.roles.cache.get(roleId as Snowflake)?.name || roleId,
|
||||
(roleId) => pluginData.guild.roles.cache.get(roleId as Snowflake)?.name || roleId,
|
||||
);
|
||||
const logs = pluginData.getPlugin(LogsPlugin);
|
||||
logs.logBotAlert({
|
||||
|
@ -52,7 +52,7 @@ export const AddRolesAction = automodAction({
|
|||
}
|
||||
|
||||
await Promise.all(
|
||||
members.map(async member => {
|
||||
members.map(async (member) => {
|
||||
const memberRoles = new Set(member.roles.cache.keys());
|
||||
for (const roleId of rolesToAssign) {
|
||||
memberRoles.add(roleId as Snowflake);
|
||||
|
|
|
@ -41,7 +41,7 @@ export const AlertAction = automodAction({
|
|||
const theMessageLink =
|
||||
contexts[0].message && messageLink(pluginData.guild.id, contexts[0].message.channel_id, contexts[0].message.id);
|
||||
|
||||
const safeUsers = contexts.map(c => (c.user ? userToTemplateSafeUser(c.user) : null)).filter(isTruthy);
|
||||
const safeUsers = contexts.map((c) => (c.user ? userToTemplateSafeUser(c.user) : null)).filter(isTruthy);
|
||||
const safeUser = safeUsers[0];
|
||||
const actionsTaken = Object.keys(pluginData.config.get().rules[ruleName].actions).join(", ");
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ export const ArchiveThreadAction = automodAction({
|
|||
|
||||
async apply({ pluginData, contexts }) {
|
||||
const threads = contexts
|
||||
.filter(c => c.message?.channel_id)
|
||||
.map(c => pluginData.guild.channels.cache.get(c.message!.channel_id))
|
||||
.filter((c) => c.message?.channel_id)
|
||||
.map((c) => pluginData.guild.channels.cache.get(c.message!.channel_id))
|
||||
.filter((c): c is ThreadChannel => c?.isThread() ?? false);
|
||||
|
||||
for (const thread of threads) {
|
||||
|
|
|
@ -35,7 +35,7 @@ export const BanAction = automodAction({
|
|||
hide: Boolean(actionConfig.hide_case),
|
||||
};
|
||||
|
||||
const userIdsToBan = unique(contexts.map(c => c.user?.id).filter(nonNullish));
|
||||
const userIdsToBan = unique(contexts.map((c) => c.user?.id).filter(nonNullish));
|
||||
|
||||
const modActions = pluginData.getPlugin(ModActionsPlugin);
|
||||
for (const userId of userIdsToBan) {
|
||||
|
|
|
@ -15,13 +15,13 @@ export const ChangeNicknameAction = automodAction({
|
|||
defaultConfig: {},
|
||||
|
||||
async apply({ pluginData, contexts, actionConfig }) {
|
||||
const members = unique(contexts.map(c => c.member).filter(nonNullish));
|
||||
const members = unique(contexts.map((c) => c.member).filter(nonNullish));
|
||||
|
||||
for (const member of members) {
|
||||
if (pluginData.state.recentNicknameChanges.has(member.id)) continue;
|
||||
const newName = typeof actionConfig === "string" ? actionConfig : actionConfig.name;
|
||||
|
||||
member.edit({ nick: newName }).catch(err => {
|
||||
member.edit({ nick: newName }).catch((err) => {
|
||||
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
||||
body: `Failed to change the nickname of \`${member.id}\``,
|
||||
});
|
||||
|
|
|
@ -31,8 +31,8 @@ export const KickAction = automodAction({
|
|||
hide: Boolean(actionConfig.hide_case),
|
||||
};
|
||||
|
||||
const userIdsToKick = unique(contexts.map(c => c.user?.id).filter(nonNullish));
|
||||
const membersToKick = await asyncMap(userIdsToKick, id => resolveMember(pluginData.client, pluginData.guild, id));
|
||||
const userIdsToKick = unique(contexts.map((c) => c.user?.id).filter(nonNullish));
|
||||
const membersToKick = await asyncMap(userIdsToKick, (id) => resolveMember(pluginData.client, pluginData.guild, id));
|
||||
|
||||
const modActions = pluginData.getPlugin(ModActionsPlugin);
|
||||
for (const member of membersToKick) {
|
||||
|
|
|
@ -10,7 +10,7 @@ export const LogAction = automodAction({
|
|||
defaultConfig: true,
|
||||
|
||||
async apply({ pluginData, contexts, ruleName, matchResult }) {
|
||||
const users = unique(contexts.map(c => c.user)).filter(isTruthy);
|
||||
const users = unique(contexts.map((c) => c.user)).filter(isTruthy);
|
||||
const user = users[0];
|
||||
const actionsTaken = Object.keys(pluginData.config.get().rules[ruleName].actions).join(", ");
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ export const MuteAction = automodAction({
|
|||
hide: Boolean(actionConfig.hide_case),
|
||||
};
|
||||
|
||||
const userIdsToMute = unique(contexts.map(c => c.user?.id).filter(nonNullish));
|
||||
const userIdsToMute = unique(contexts.map((c) => c.user?.id).filter(nonNullish));
|
||||
|
||||
const mutes = pluginData.getPlugin(MutesPlugin);
|
||||
for (const userId of userIdsToMute) {
|
||||
|
|
|
@ -18,7 +18,7 @@ export const RemoveRolesAction = automodAction({
|
|||
defaultConfig: [],
|
||||
|
||||
async apply({ pluginData, contexts, actionConfig, ruleName }) {
|
||||
const members = unique(contexts.map(c => c.member).filter(nonNullish));
|
||||
const members = unique(contexts.map((c) => c.member).filter(nonNullish));
|
||||
const me = pluginData.guild.members.cache.get(pluginData.client.user!.id)!;
|
||||
|
||||
const missingPermissions = getMissingPermissions(me.permissions, p.MANAGE_ROLES);
|
||||
|
@ -42,7 +42,7 @@ export const RemoveRolesAction = automodAction({
|
|||
|
||||
if (rolesWeCannotRemove.length) {
|
||||
const roleNamesWeCannotRemove = rolesWeCannotRemove.map(
|
||||
roleId => pluginData.guild.roles.cache.get(roleId as Snowflake)?.name || roleId,
|
||||
(roleId) => pluginData.guild.roles.cache.get(roleId as Snowflake)?.name || roleId,
|
||||
);
|
||||
const logs = pluginData.getPlugin(LogsPlugin);
|
||||
logs.logBotAlert({
|
||||
|
@ -53,7 +53,7 @@ export const RemoveRolesAction = automodAction({
|
|||
}
|
||||
|
||||
await Promise.all(
|
||||
members.map(async member => {
|
||||
members.map(async (member) => {
|
||||
const memberRoles = new Set(member.roles.cache.keys());
|
||||
for (const roleId of rolesToRemove) {
|
||||
memberRoles.delete(roleId as Snowflake);
|
||||
|
|
|
@ -32,8 +32,8 @@ export const ReplyAction = automodAction({
|
|||
|
||||
async apply({ pluginData, contexts, actionConfig, ruleName }) {
|
||||
const contextsWithTextChannels = contexts
|
||||
.filter(c => c.message?.channel_id)
|
||||
.filter(c => {
|
||||
.filter((c) => c.message?.channel_id)
|
||||
.filter((c) => {
|
||||
const channel = pluginData.guild.channels.cache.get(c.message!.channel_id as Snowflake);
|
||||
return channel instanceof TextChannel || channel instanceof ThreadChannel;
|
||||
});
|
||||
|
@ -48,7 +48,7 @@ export const ReplyAction = automodAction({
|
|||
}, new Map());
|
||||
|
||||
for (const [channelId, _contexts] of contextsByChannelId.entries()) {
|
||||
const users = unique(Array.from(new Set(_contexts.map(c => c.user).filter(Boolean)))) as User[];
|
||||
const users = unique(Array.from(new Set(_contexts.map((c) => c.user).filter(Boolean)))) as User[];
|
||||
const user = users[0];
|
||||
|
||||
const renderReplyText = async (str: string) =>
|
||||
|
|
|
@ -31,8 +31,8 @@ export const WarnAction = automodAction({
|
|||
hide: Boolean(actionConfig.hide_case),
|
||||
};
|
||||
|
||||
const userIdsToWarn = unique(contexts.map(c => c.user?.id).filter(nonNullish));
|
||||
const membersToWarn = await asyncMap(userIdsToWarn, id => resolveMember(pluginData.client, pluginData.guild, id));
|
||||
const userIdsToWarn = unique(contexts.map((c) => c.user?.id).filter(nonNullish));
|
||||
const membersToWarn = await asyncMap(userIdsToWarn, (id) => resolveMember(pluginData.client, pluginData.guild, id));
|
||||
|
||||
const modActions = pluginData.getPlugin(ModActionsPlugin);
|
||||
for (const member of membersToWarn) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue