formatting

This commit is contained in:
Erik 2022-01-16 22:30:51 +02:00
parent 1541d2af83
commit a84b91da8f
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589
2 changed files with 20 additions and 8 deletions

View File

@ -14,6 +14,10 @@
// "sourceType": "module" // "sourceType": "module"
// }, // },
"rules": { "rules": {
"max-len": ["warn", {
"code": 140,
"ignoreComments": true
}],
"accessor-pairs": "warn", "accessor-pairs": "warn",
"array-callback-return": "warn", "array-callback-return": "warn",
"arrow-parens": "warn", "arrow-parens": "warn",
@ -52,7 +56,7 @@
"func-name-matching": "warn", "func-name-matching": "warn",
"func-names": "warn", "func-names": "warn",
"func-style": "warn", "func-style": "warn",
"function-paren-newline": "warn", "function-paren-newline": ["warn", "consistent"],
"generator-star-spacing": "warn", "generator-star-spacing": "warn",
"grouped-accessor-pairs": "warn", "grouped-accessor-pairs": "warn",
"guard-for-in": "warn", "guard-for-in": "warn",
@ -157,7 +161,9 @@
"no-var": "warn", "no-var": "warn",
"no-void": "warn", "no-void": "warn",
"no-whitespace-before-property": "warn", "no-whitespace-before-property": "warn",
"nonblock-statement-body-position": "warn", "nonblock-statement-body-position": ["warn", "any", {
}],
"object-curly-spacing": [ "object-curly-spacing": [
"warn", "warn",
"always" "always"

View File

@ -15,7 +15,11 @@ const addField = (array, type) => {
}; };
const sorted = array.sort((a, b) => a.position - b.position) || []; const sorted = array.sort((a, b) => a.position - b.position) || [];
for (const i of sorted) { for (const i of sorted) {
const text = `${Emojis.role} **${i.role}** has ${i.permissions.map((p) => `\`${PermissionNames[p]}\``).join(', ')} in ${Emojis[i.type === 'text' ? 'text-channel' : 'voice-channel']} **${i.channel}**\n`; const text = `${Emojis.role} **${i.role}** has ${i.permissions.map(
(p) => `\`${PermissionNames[p]}\``
).join(', ')} in ${Emojis[i.type === 'text'
? 'text-channel'
: 'voice-channel']} **${i.channel}**\n`;
if (field.value.length + text.length <= EmbedLimits.fieldValue) field.value += text; if (field.value.length + text.length <= EmbedLimits.fieldValue) field.value += text;
} }
return field; return field;
@ -264,7 +268,7 @@ class MuteSetting extends Setting {
} }
async fields(guild) { fields(guild) {
const setting = guild._settings[this.name] || {}; const setting = guild._settings[this.name] || {};
return [ return [
{ {
@ -277,7 +281,7 @@ class MuteSetting extends Setting {
value: `\`${setting.type || 0}\``, value: `\`${setting.type || 0}\``,
inline: true inline: true
}, },
//{ name: '\u200b', value: '\u200b', inline: true }, { name: '\u200b', value: '\u200b', inline: true },
{ {
name: guild.format('SETTING_MUTE_PERMANENT'), name: guild.format('SETTING_MUTE_PERMANENT'),
value: guild.format('GENERAL_STATE', { bool: setting.permanent }, { code: true }), value: guild.format('GENERAL_STATE', { bool: setting.permanent }, { code: true }),
@ -288,7 +292,7 @@ class MuteSetting extends Setting {
value: setting.default ? Util.humanise(setting.default) : '`N/A`', value: setting.default ? Util.humanise(setting.default) : '`N/A`',
inline: true inline: true
}, },
//{ name: '\u200b', value: '\u200b', inline: true } { name: '\u200b', value: '\u200b', inline: true }
]; ];
} }
@ -301,8 +305,10 @@ class MuteSetting extends Setting {
return async (interaction) => { return async (interaction) => {
if (interaction.isButton()) { if (interaction.isButton()) {
if ((/^\d$/u).test(interaction.customId)) setting.type = parseInt(interaction.customId); if ((/^\d$/u).test(interaction.customId)) setting.type = parseInt(interaction.customId);
else if (['allow_permanent', 'disallow_permanent'].includes(interaction.customId)) setting.allowPermanent = interaction.customId === 'allow_permanent'; else if (['allow_permanent', 'disallow_permanent'].includes(interaction.customId))
else if ((/\d+h/u).test(interaction.customId)) setting.defaultDuration = this.client.resolver.resolveTime(interaction.customId); setting.allowPermanent = interaction.customId === 'allow_permanent';
else if ((/\d+h/u).test(interaction.customId))
setting.defaultDuration = this.client.resolver.resolveTime(interaction.customId);
} else if (interaction.customId === 'role') { } else if (interaction.customId === 'role') {
if (interaction.value === 'create') await this.createRole(); if (interaction.value === 'create') await this.createRole();
[setting.role] = interaction.values; [setting.role] = interaction.values;