Skip to content

Commit 3b4d038

Browse files
committed
chore: remove debug code, rename single letter vars
1 parent f48081d commit 3b4d038

File tree

8 files changed

+24
-23
lines changed

8 files changed

+24
-23
lines changed

src/v2/autorespond/code_parsing/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ const jsCodeBlocks = createCodeBlockCapturer([
1313
'typescript',
1414
]);
1515

16-
const tap = <T>(x: T): T => {
17-
console.log(x)
18-
return x
19-
}
2016
const getFirstVar = pipe([jsCodeBlocks, pluck('code'), some(hasVarInSource)]);
2117

2218
const messageFor = (userId: string) => `

src/v2/commands/npm/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ const createNPMEmbed = (
203203
.setURL(url)
204204
.setFooter(
205205
{
206-
text: `requested by ${user.username}#${user.discriminator}`,
206+
text: `requested by ${user.username}`,
207207
iconURL: user.avatarURL({ size: 64, format: 'webp' })
208208
}
209209
)

src/v2/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ client.on('messageCreate', msg => {
153153
}
154154

155155
if (NON_COMMAND_MSG_TYPES.has(msg.channel.type) && msg.guild) {
156-
console.log("Handled")
157156
handleNonCommandGuildMessages(msg);
158157
}
159158
});

src/v2/modules/mod/commands/roles.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ const generateButtons = (roles: typeof ROLES | typeof NOTIFY_ROLES) =>
1818
const chunkAndRowify = pipe<
1919
Iterable<ButtonBuilder>,
2020
Iterable<ActionRowBuilder<MessageActionRowComponentBuilder>>
21-
>([chunk(5), map((x: ButtonBuilder[]) => new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(...x))]);
21+
>([
22+
chunk(5),
23+
map((buttonBuilders: ButtonBuilder[]) => new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(...buttonBuilders))
24+
]);
2225

2326
export async function setupRoles(
2427
interaction: CommandInteraction

src/v2/modules/onboarding/events/handleNotifyRolesSelected.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ export const handleNotifyRolesSelected = async (
3232
const msg = interaction.message as Message;
3333

3434
msg.edit({
35-
components: msg.components.map(x => {
36-
if (x.type === ComponentType.ActionRow) {
37-
return new ActionRowBuilder<MessageActionRowComponentBuilder>(x)
38-
.setComponents(...x.components.map(x => {
35+
components: msg.components.map(component => {
36+
if (component.type === ComponentType.ActionRow) {
37+
return new ActionRowBuilder<MessageActionRowComponentBuilder>(component)
38+
.setComponents(...component.components.map(x => {
3939
if (x.type === ComponentType.Button) {
4040
return new ButtonBuilder(x).setDisabled(true)
4141
}
4242
return x as unknown as MessageActionRowComponentBuilder
4343
}))
4444
}
4545

46-
return x
46+
return component
4747
}),
4848
});
4949

src/v2/modules/onboarding/events/handleRoleSelected.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,20 @@ export const handleRoleSelected = async (
4040
});
4141

4242
await msg.edit({
43-
components: msg.components.map(x => {
44-
if (x.type === ComponentType.ActionRow) {
45-
return new ActionRowBuilder<MessageActionRowComponentBuilder>(x).setComponents(x.components.map(x => {
46-
if (x.type === ComponentType.StringSelect) {
47-
return new StringSelectMenuBuilder(x).setDisabled(true)
48-
}
49-
return x as unknown as MessageActionRowComponentBuilder
50-
}))
43+
components: msg.components.map(component => {
44+
if (component.type === ComponentType.ActionRow) {
45+
return new ActionRowBuilder<MessageActionRowComponentBuilder>(component)
46+
.setComponents(
47+
component.components.map(subComponent => {
48+
if (subComponent.type === ComponentType.StringSelect) {
49+
return new StringSelectMenuBuilder(subComponent).setDisabled(true)
50+
}
51+
// This feels wrong, there really should be a better way to edit a component...surely
52+
return subComponent as unknown as MessageActionRowComponentBuilder
53+
})
54+
)
5155
}
52-
return x;
56+
return component;
5357
}),
5458
});
5559

src/v2/modules/onboarding/utils/sneakPin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Message, MessageType } from 'discord.js';
22

33
export const sneakPin = async (msg: Message): Promise<void> => {
44
const awaitedPinned = msg.channel.awaitMessages({
5-
filter: x => x.type === MessageType.ChannelPinnedMessage,
5+
filter: msg => msg.type === MessageType.ChannelPinnedMessage,
66
max: 1,
77
});
88

src/v2/utils/codeBlockCapturer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export function createCodeBlockCapturer(
1414
String.raw`${BACKTICKS}(?<language>${langAlts})\n(?<code>[\s\S]+?)\n${BACKTICKS}`,
1515
'gui'
1616
);
17-
console.log({ str })
1817
const matches = str.matchAll(langRegex);
1918
for (const {
2019
groups: { language, code },

0 commit comments

Comments
 (0)