Skip to content

Commit 44dbac2

Browse files
authored
Show correct patreon tier in mod log message (#291)
1 parent 3a84bf8 commit 44dbac2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/patreon-trigger.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,14 @@ export async function handlePatreonModalSubmit(interaction: ModalSubmitInteracti
9595
return;
9696
}
9797

98+
const isTier2Supporter = hasRole(
99+
interaction.member as GuildMember,
100+
config.discord.roles.patreonSupporterT2
101+
);
102+
98103
let groupId: number | undefined;
99104

100-
if (hasRole(interaction.member as GuildMember, config.discord.roles.patreonSupporterT2)) {
105+
if (isTier2Supporter) {
101106
const groupIdValue = interaction.fields.getTextInputValue('groupId');
102107
const isInteger = typeof groupIdValue === 'string' && Number.isInteger(parseInt(groupIdValue));
103108

@@ -123,8 +128,10 @@ export async function handlePatreonModalSubmit(interaction: ModalSubmitInteracti
123128
sendModLog(
124129
interaction.guild,
125130
`${interaction.user} has claimed ${
126-
groupId ? 'Tier 2' : 'Tier 1'
127-
} Patreon benefits for: \nUsername: ${username}${groupId ? `\nGroup id: ${groupId}` : ''}`
131+
isTier2Supporter ? 'Tier 2' : 'Tier 1'
132+
} Patreon benefits for: \nUsername: ${username}${
133+
isTier2Supporter ? `\nGroup id: ${groupId ?? '--'}` : ''
134+
}`
128135
);
129136
} catch (error) {
130137
interaction.reply({ content: error.message, ephemeral: true });

0 commit comments

Comments
 (0)