Reformat all files with Prettier
This commit is contained in:
parent
0cde0d46d2
commit
ac79eb09f5
206 changed files with 727 additions and 888 deletions
|
@ -55,10 +55,7 @@ export const AboutCmd = utilityCmd({
|
|||
];
|
||||
|
||||
const loadedPlugins = Array.from(
|
||||
pluginData
|
||||
.getKnubInstance()
|
||||
.getLoadedGuild(pluginData.guild.id)!
|
||||
.loadedPlugins.keys(),
|
||||
pluginData.getKnubInstance().getLoadedGuild(pluginData.guild.id)!.loadedPlugins.keys(),
|
||||
);
|
||||
loadedPlugins.sort();
|
||||
|
||||
|
@ -100,9 +97,9 @@ export const AboutCmd = utilityCmd({
|
|||
|
||||
// For the embed color, find the highest colored role the bot has - this is their color on the server as well
|
||||
const botMember = await resolveMember(pluginData.client, pluginData.guild, pluginData.client.user!.id);
|
||||
let botRoles = botMember?.roles.cache.map(r => (msg.channel as GuildChannel).guild.roles.cache.get(r.id)!) || [];
|
||||
botRoles = botRoles.filter(r => !!r); // Drop any unknown roles
|
||||
botRoles = botRoles.filter(r => r.color); // Filter to those with a color
|
||||
let botRoles = botMember?.roles.cache.map((r) => (msg.channel as GuildChannel).guild.roles.cache.get(r.id)!) || [];
|
||||
botRoles = botRoles.filter((r) => !!r); // Drop any unknown roles
|
||||
botRoles = botRoles.filter((r) => r.color); // Filter to those with a color
|
||||
botRoles.sort(sorter("position", "DESC")); // Sort by position (highest first)
|
||||
if (botRoles.length) {
|
||||
aboutContent.embeds![0].color = botRoles[0].color;
|
||||
|
|
|
@ -30,10 +30,10 @@ export async function cleanMessages(
|
|||
|
||||
// Delete & archive in ID order
|
||||
savedMessages = Array.from(savedMessages).sort((a, b) => (a.id > b.id ? 1 : -1));
|
||||
const idsToDelete = savedMessages.map(m => m.id) as Snowflake[];
|
||||
const idsToDelete = savedMessages.map((m) => m.id) as Snowflake[];
|
||||
|
||||
// Make sure the deletions aren't double logged
|
||||
idsToDelete.forEach(id => pluginData.state.logs.ignoreLog(LogType.MESSAGE_DELETE, id));
|
||||
idsToDelete.forEach((id) => pluginData.state.logs.ignoreLog(LogType.MESSAGE_DELETE, id));
|
||||
pluginData.state.logs.ignoreLog(LogType.MESSAGE_DELETE_BULK, idsToDelete[0]);
|
||||
|
||||
// Actually delete the messages
|
||||
|
@ -171,12 +171,12 @@ export async function cleanCmd(pluginData: GuildPluginData<UtilityPluginType>, a
|
|||
let responseMsg: Message | undefined;
|
||||
if (messagesToClean.length > 0) {
|
||||
// Save to-be-deleted messages that were missing from the database
|
||||
const existingStored = await pluginData.state.savedMessages.getMultiple(messagesToClean.map(m => m.id));
|
||||
const alreadyStored = existingStored.map(stored => stored.id);
|
||||
const messagesToStore = messagesToClean.filter(potentialMsg => !alreadyStored.includes(potentialMsg.id));
|
||||
const existingStored = await pluginData.state.savedMessages.getMultiple(messagesToClean.map((m) => m.id));
|
||||
const alreadyStored = existingStored.map((stored) => stored.id);
|
||||
const messagesToStore = messagesToClean.filter((potentialMsg) => !alreadyStored.includes(potentialMsg.id));
|
||||
await pluginData.state.savedMessages.createFromMessages(messagesToStore);
|
||||
|
||||
const savedMessagesToClean = await pluginData.state.savedMessages.getMultiple(messagesToClean.map(m => m.id));
|
||||
const savedMessagesToClean = await pluginData.state.savedMessages.getMultiple(messagesToClean.map((m) => m.id));
|
||||
const cleanResult = await cleanMessages(pluginData, targetChannel, savedMessagesToClean, msg.author);
|
||||
|
||||
let responseText = `Cleaned ${messagesToClean.length} ${messagesToClean.length === 1 ? "message" : "messages"}`;
|
||||
|
|
|
@ -58,10 +58,7 @@ export const HelpCmd = utilityCmd({
|
|||
|
||||
const description = command.config!.extra!.blueprint.description;
|
||||
const usage = command.config!.extra!.blueprint.usage;
|
||||
const commandSlug = trigger
|
||||
.trim()
|
||||
.toLowerCase()
|
||||
.replace(/\s/g, "-");
|
||||
const commandSlug = trigger.trim().toLowerCase().replace(/\s/g, "-");
|
||||
|
||||
let snippet = `**${prefix}${trigger}**`;
|
||||
if (description) snippet += `\n${description}`;
|
||||
|
|
|
@ -28,7 +28,7 @@ export const RolesCmd = utilityCmd({
|
|||
|
||||
if (args.search) {
|
||||
const searchStr = args.search.toLowerCase();
|
||||
roles = roles.filter(r => r.name.toLowerCase().includes(searchStr) || r.id === searchStr);
|
||||
roles = roles.filter((r) => r.name.toLowerCase().includes(searchStr) || r.id === searchStr);
|
||||
}
|
||||
|
||||
if (args.counts) {
|
||||
|
@ -75,7 +75,7 @@ export const RolesCmd = utilityCmd({
|
|||
} else if (sort === "memberCount" && args.counts) {
|
||||
roles.sort(sorter("_memberCount", sortDir));
|
||||
} else if (sort === "name") {
|
||||
roles.sort(sorter(r => r.name.toLowerCase(), sortDir));
|
||||
roles.sort(sorter((r) => r.name.toLowerCase(), sortDir));
|
||||
} else {
|
||||
sendErrorMessage(pluginData, msg.channel, "Unknown sorting method");
|
||||
return;
|
||||
|
@ -85,7 +85,7 @@ export const RolesCmd = utilityCmd({
|
|||
|
||||
const chunks = chunkArray(roles, 20);
|
||||
for (const [i, chunk] of chunks.entries()) {
|
||||
const roleLines = chunk.map(role => {
|
||||
const roleLines = chunk.map((role) => {
|
||||
const paddedId = role.id.padEnd(longestId, " ");
|
||||
let line = `${paddedId} ${role.name}`;
|
||||
if (role._memberCount != null) {
|
||||
|
|
|
@ -50,7 +50,7 @@ export const VcmoveCmd = utilityCmd({
|
|||
const voiceChannels = [...pluginData.guild.channels.cache.values()].filter(
|
||||
(c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE,
|
||||
);
|
||||
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
|
||||
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, (ch) => ch.name);
|
||||
if (!closestMatch) {
|
||||
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
|
||||
return;
|
||||
|
@ -129,7 +129,7 @@ export const VcmoveAllCmd = utilityCmd({
|
|||
const voiceChannels = [...pluginData.guild.channels.cache.values()].filter(
|
||||
(c): c is VoiceChannel => c.type === ChannelTypeStrings.VOICE,
|
||||
);
|
||||
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, ch => ch.name);
|
||||
const closestMatch = simpleClosestStringMatch(args.channel, voiceChannels, (ch) => ch.name);
|
||||
if (!closestMatch) {
|
||||
sendErrorMessage(pluginData, msg.channel, "No matching voice channels");
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue