Skip to content

Commit

Permalink
lint project
Browse files Browse the repository at this point in the history
  • Loading branch information
keybraker committed Nov 9, 2024
1 parent a51602b commit 1e53186
Show file tree
Hide file tree
Showing 9 changed files with 154 additions and 154 deletions.
88 changes: 44 additions & 44 deletions src/Interpreter/attribute.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,61 +57,61 @@ export async function setAttribute(
for (let l = 0; l < AttributeBlueprints.length; l++) {
if (candidate === AttributeBlueprints[l].name) {
switch (AttributeBlueprints[l].auth) {
case AuthType.admin:
if (!isUserAuthorised(member)) {
return {
result: false,
value: `attribute ${candidate} can only be **set by an administrator**`,
};
case AuthType.admin:
if (!isUserAuthorised(member)) {
return {
result: false,
value: `attribute ${candidate} can only be **set by an administrator**`,
};
}

break;
case AuthType.none:
// passes through no checks needed
break;
default:
if (!voiceChannel) {
return {
result: false,
value: 'you must be in a channel handled by Portal',
};
}

for (let i = 0; i < pGuild.pChannels.length; i++) {
for (let j = 0; j < pGuild.pChannels[i].pVoiceChannels.length; j++) {
if (pGuild.pChannels[i].pVoiceChannels[j].id === voiceChannel.id) {
pChannel = pGuild.pChannels[i];
pVoiceChannel = pGuild.pChannels[i].pVoiceChannels[j];

break;
}
}
}

break;
case AuthType.none:
// passes through no checks needed
break;
default:
if (!voiceChannel) {
if (!pChannel || !pVoiceChannel) {
return {
result: false,
value: 'you must be in a channel handled by Portal',
};
}

if (AttributeBlueprints[l].auth === AuthType.portal) {
if (pChannel.creatorId !== member.id) {
return {
result: false,
value: 'you must be in a channel handled by Portal',
value: `attribute ${candidate} can only be **set by the portal creator**`,
};
}

for (let i = 0; i < pGuild.pChannels.length; i++) {
for (let j = 0; j < pGuild.pChannels[i].pVoiceChannels.length; j++) {
if (pGuild.pChannels[i].pVoiceChannels[j].id === voiceChannel.id) {
pChannel = pGuild.pChannels[i];
pVoiceChannel = pGuild.pChannels[i].pVoiceChannels[j];

break;
}
}
}

if (!pChannel || !pVoiceChannel) {
} else if (AttributeBlueprints[l].auth === AuthType.voice) {
if (pVoiceChannel.creatorId !== member.id) {
return {
result: false,
value: 'you must be in a channel handled by Portal',
value: `attribute ${candidate} can only be **set by the voice creator**`,
};
}
}

if (AttributeBlueprints[l].auth === AuthType.portal) {
if (pChannel.creatorId !== member.id) {
return {
result: false,
value: `attribute ${candidate} can only be **set by the portal creator**`,
};
}
} else if (AttributeBlueprints[l].auth === AuthType.voice) {
if (pVoiceChannel.creatorId !== member.id) {
return {
result: false,
value: `attribute ${candidate} can only be **set by the voice creator**`,
};
}
}

break;
break;
}

const pMember = pGuild.pMembers.find((m) => m.id === member.id);
Expand Down
8 changes: 4 additions & 4 deletions src/blueprints/attribute.blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,8 @@ export const AttributeBlueprints: Blueprint[] = [
r.bitrate === newBitrate
? `attribute ${category.join('.') + '.' + attribute} set successfully to \`${value}\``
: `attribute ${
category.join('.') + '.' + attribute
} failed to be set to\`${value}\` to ${value} (is ${r.bitrate})`,
category.join('.') + '.' + attribute
} failed to be set to\`${value}\` to ${value} (is ${r.bitrate})`,
});
})
.catch((e) => {
Expand Down Expand Up @@ -1113,8 +1113,8 @@ export const AttributeBlueprints: Blueprint[] = [
updatedVoiceChannel.position === Number(value)
? `attribute ${category.join('.') + '.' + attribute} set successfully to \`${value}\``
: `attribute ${
category.join('.') + '.' + attribute
} failed to be set to\`${value}\` to ${value} (is ${updatedVoiceChannel.position})`,
category.join('.') + '.' + attribute
} failed to be set to\`${value}\` to ${value} (is ${updatedVoiceChannel.position})`,
};
},
auth: AuthType.voice,
Expand Down
24 changes: 12 additions & 12 deletions src/blueprints/pipe.blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ export const PipeBlueprints: Blueprint[] = [
? isAcronym(str)
? str
: str
.replace(/[-_,.:*=+]/g, ' ')
.split(' ')
.map((s) => s[0])
.join('')
.replace(/[-_,.:*=+]/g, ' ')
.split(' ')
.map((s) => s[0])
.join('')
: typeof str === 'object'
? str
.map((s) =>
s
.replace(/[-_,.:*=+]/g, ' ')
.split(' ')
.map((sm) => (isAcronym(sm) ? sm : sm[0]))
.join(''),
)
.join(',')
.map((s) =>
s
.replace(/[-_,.:*=+]/g, ' ')
.split(' ')
.map((sm) => (isAcronym(sm) ? sm : sm[0]))
.join(''),
)
.join(',')
: (str ?? '');
},
set: () => undefined,
Expand Down
20 changes: 10 additions & 10 deletions src/blueprints/variable.blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ export const VariableBlueprints: Blueprint[] = [
name: 'memberHistory',
hover: 'all members to ever pass through channel',
get: () =>
// voiceChannel: VoiceChannel | undefined | null, pVoiceChannel: PVoiceChannel | undefined | null,
// pChannels: PChannel[] | undefined | null, pGuild, guild: Guild
{
return 'noYetImplemented';
},
// voiceChannel: VoiceChannel | undefined | null, pVoiceChannel: PVoiceChannel | undefined | null,
// pChannels: PChannel[] | undefined | null, pGuild, guild: Guild
{
return 'noYetImplemented';
},
set: () => undefined,
auth: AuthType.none,
},
Expand Down Expand Up @@ -318,11 +318,11 @@ export const VariableBlueprints: Blueprint[] = [
name: 'statusHistory',
hover: 'all statuses from start',
get: () =>
// voiceChannel: VoiceChannel | undefined | null, pVoiceChannel: PVoiceChannel | undefined | null,
// pChannels: PChannel[] | undefined | null, pGuild, guild: Guild
{
return 'noYetImplemented';
},
// voiceChannel: VoiceChannel | undefined | null, pVoiceChannel: PVoiceChannel | undefined | null,
// pChannels: PChannel[] | undefined | null, pGuild, guild: Guild
{
return 'noYetImplemented';
},
set: () => undefined,
auth: AuthType.none,
},
Expand Down
50 changes: 25 additions & 25 deletions src/commands/noAuth/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,16 +337,16 @@ async function propertyReply(type: string, specific: string | null) {
}

switch (type) {
case 'commands':
return commandDocumentation.getHelp();
case 'variables':
return variableDocumentation.getHelp();
case 'pipes':
return pipeDocumentation.getHelp();
case 'attributes':
return attributeDocumentation.getHelp();
case 'structures':
return structureDocumentation.getHelp();
case 'commands':
return commandDocumentation.getHelp();
case 'variables':
return variableDocumentation.getHelp();
case 'pipes':
return pipeDocumentation.getHelp();
case 'attributes':
return attributeDocumentation.getHelp();
case 'structures':
return structureDocumentation.getHelp();
}

return messageHelp('commands', 'help', `*${type}* does not exist in portal`);
Expand All @@ -356,21 +356,21 @@ async function guideReply(type: string) {
let guide: EmbedBuilder | null = null;

switch (type) {
case 'commands':
guide = commandDocumentation.getGuide();
break;
case 'variables':
guide = variableDocumentation.getGuide();
break;
case 'pipes':
guide = pipeDocumentation.getGuide();
break;
case 'attributes':
guide = attributeDocumentation.getGuide();
break;
case 'structures':
guide = structureDocumentation.getGuide();
break;
case 'commands':
guide = commandDocumentation.getGuide();
break;
case 'variables':
guide = variableDocumentation.getGuide();
break;
case 'pipes':
guide = pipeDocumentation.getGuide();
break;
case 'attributes':
guide = attributeDocumentation.getGuide();
break;
case 'structures':
guide = structureDocumentation.getGuide();
break;
}

if (!guide) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/noAuth/spam_rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { PGuild } from '../../types/classes/PGuild.class.js';
import { ReturnPromise, ScopeLimit } from '../../types/classes/PTypes.interface.js';

const COMMAND_NAME = 'spam_rules';
const DESCRIPTION = "returns server's spam rules";
const DESCRIPTION = 'returns server\'s spam rules';

export default {
time: 0,
Expand Down
46 changes: 23 additions & 23 deletions src/libraries/help.library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,20 @@ export function getKeyFromEnum(value: string, enumeration: enumTypes): string |
let enumerationArray;

switch (enumeration) {
case OpapGameId:
enumerationArray = Object.values(OpapGameId);
break;
case RankSpeed:
enumerationArray = Object.values(RankSpeed);
break;
case ProfanityLevel:
enumerationArray = Object.values(ProfanityLevel);
break;
case Locale:
enumerationArray = Object.values(Locale);
break;
default:
return undefined;
case OpapGameId:
enumerationArray = Object.values(OpapGameId);
break;
case RankSpeed:
enumerationArray = Object.values(RankSpeed);
break;
case ProfanityLevel:
enumerationArray = Object.values(ProfanityLevel);
break;
case Locale:
enumerationArray = Object.values(Locale);
break;
default:
return undefined;
}

for (const enumerationValue of enumerationArray) {
Expand Down Expand Up @@ -228,15 +228,15 @@ export async function updateMusicMessage(
const musicQueue = pGuild.musicQueue
? pGuild.musicQueue.length > 1
? pGuild.musicQueue
.map((v, i) => {
if (i !== 0 && i < 6) {
return `${i}. ${maxString(v.title, 61)}`;
} else if (i === 6) {
return `...${pGuild.musicQueue.length - 6} more`;
}
})
.filter((v) => !!v)
.join('\n')
.map((v, i) => {
if (i !== 0 && i < 6) {
return `${i}. ${maxString(v.title, 61)}`;
} else if (i === 6) {
return `...${pGuild.musicQueue.length - 6} more`;
}
})
.filter((v) => !!v)
.join('\n')
: 'empty'
: 'empty';

Expand Down
Loading

0 comments on commit 1e53186

Please sign in to comment.