3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-07 11:07:19 +00:00

Merge branch 'master' of github.com:ZeppelinBot/Zeppelin into feat/application-commands

This commit is contained in:
Lily Bergonzat 2024-02-16 14:26:34 +01:00
commit 2c0e4b37ca
235 changed files with 3464 additions and 4799 deletions

View file

@ -14,10 +14,17 @@ import { ArgsFromSignatureOrArray, GuildPluginData } from "knub";
import moment from "moment-timezone";
import { RegExpRunner, allowTimeout } from "../../RegExpRunner";
import { getBaseUrl } from "../../pluginUtils";
import { MINUTES, multiSorter, renderUserUsername, sorter, trimLines } from "../../utils";
import {
InvalidRegexError,
MINUTES,
inputPatternToRegExp,
multiSorter,
renderUsername,
sorter,
trimLines,
} from "../../utils";
import { asyncFilter } from "../../utils/async";
import { hasDiscordPermissions } from "../../utils/hasDiscordPermissions";
import { InvalidRegexError, inputPatternToRegExp } from "../../validatorUtils";
import { CommonPlugin } from "../Common/CommonPlugin";
import { banSearchSignature } from "./commands/BanSearchCmd";
import { searchCmdSignature } from "./commands/SearchCmd";
@ -382,7 +389,7 @@ async function performMemberSearch(
return true;
}
const fullUsername = renderUserUsername(member.user);
const fullUsername = renderUsername(member);
if (await execRegExp(queryRegex, fullUsername).catch(allowTimeout)) return true;
return false;
@ -449,7 +456,7 @@ async function performBanSearch(
const execRegExp = getOptimizedRegExpRunner(pluginData, isSafeRegex);
matchingBans = await asyncFilter(matchingBans, async (user) => {
const fullUsername = renderUserUsername(user);
const fullUsername = renderUsername(user);
if (await execRegExp(queryRegex, fullUsername).catch(allowTimeout)) return true;
return false;
});
@ -493,10 +500,10 @@ function formatSearchResultList(members: Array<GuildMember | User>): string {
const paddedId = member.id.padEnd(longestId, " ");
let line;
if (member instanceof GuildMember) {
line = `${paddedId} ${renderUserUsername(member.user)}`;
line = `${paddedId} ${renderUsername(member)}`;
if (member.nickname) line += ` (${member.nickname})`;
} else {
line = `${paddedId} ${member.tag}`;
line = `${paddedId} ${renderUsername(member)}`;
}
return line;
});