Skip to content

Commit

Permalink
Show more information in log messages (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
rorro authored Aug 24, 2024
1 parent 028d8d8 commit d330cc8
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ class ClearNameChangeHistoryCommand extends Command {

sendModLog(
interaction.guild,
`Cleared name change history (Username: ${username})`,
interaction.user,
requester?.user
`**Name Change History Cleared**\nUsername: \`${username}\`` +
(requesterId
? `\nRequested by: <@${requesterId}>, \`${requesterId}\`, \`${requester?.user.username}\``
: ''),
interaction.user
);
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/commands/instances/moderation/CreateAPIKeyCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CreateAPIKeyCommand extends Command {

async execute(interaction: ChatInputCommandInteraction) {
const project = interaction.options.getString('project', true);
const requesterId = interaction.options.getUser('requester', false)?.id;
const requesterId = interaction.options.getUser('requester', true).id;

const requester = interaction.guild?.members.cache.find(m => m.id === requesterId);

Expand All @@ -49,7 +49,7 @@ class CreateAPIKeyCommand extends Command {
});

sentDM.edit(
`Wise Old Man API key for "${project}":\n\`${key.id}\`\n\n<https://docs.wiseoldman.net/#rate-limits--api-keys>`
`Wise Old Man API key for \`${project}\`:\n\`${key.id}\`\n\n<https://docs.wiseoldman.net/#rate-limits--api-keys>`
);

// Respond on the WOM discord chat with a success status
Expand All @@ -61,9 +61,8 @@ class CreateAPIKeyCommand extends Command {

sendModLog(
interaction.guild,
`API Key created (Project: ${project})`,
interaction.user,
requester?.user
`**API Key Created**\nProject: \`${project}\`\nRequested by: <@${requesterId}>, \`${requesterId}\`, \`${requester.user.username}\``,
interaction.user
);

// Add the "API Consumer" role to the user
Expand Down
8 changes: 5 additions & 3 deletions src/commands/instances/moderation/DeleteCompetitionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ class DeleteCompetitionCommand extends Command {

sendModLog(
interaction.guild,
`Deleted competition (ID: ${competitionId})`,
interaction.user,
requester?.user
`**Deleted Competition**\nCompetition: \`${competitionId}\`` +
(requesterId
? `\nRequested by: <@${requesterId}>, \`${requesterId}\`, \`${requester?.user.username}\``
: ''),
interaction.user
);
}
}
Expand Down
9 changes: 8 additions & 1 deletion src/commands/instances/moderation/DeleteGroupCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ class DeleteGroupCommand extends Command {

await interaction.editReply({ embeds: [response] });

sendModLog(interaction.guild, `Deleted group (ID: ${groupId})`, interaction.user, requester?.user);
sendModLog(
interaction.guild,
`**Deleted Group**\nGroup: \`${groupId}\`` +
(requesterId
? `\nRequested by: <@${requesterId}>, \`${requesterId}\`, \`${requester?.user.username}\``
: ''),
interaction.user
);
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/commands/instances/moderation/DeletePlayerCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ class DeletePlayerCommand extends Command {

sendModLog(
interaction.guild,
`Deleted player (Username: ${username})`,
interaction.user,
requester?.user
`**Deleted User**\nUsername: \`${username}\`` +
(requesterId
? `\nRequested by: <@${requesterId}>, \`${requesterId}\`, \`${requester?.user.username}\``
: ''),
interaction.user
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class RemoveFromCompetitionCommand extends Command {
// Respond on the WOM discord chat with a success status
const response = new EmbedBuilder()
.setColor(config.visuals.green)
.setDescription(`✅ ${username} has been successfully removed from the competition.`);
.setDescription(`✅ \`${username}\` has been successfully removed from the competition.`);

try {
await removeFromCompetition(competitionId, username);
Expand All @@ -53,9 +53,11 @@ class RemoveFromCompetitionCommand extends Command {

sendModLog(
interaction.guild,
`Removed \`${username}\` from competition (ID: ${competitionId})`,
interaction.user,
requester?.user
`**Removed User From Competition**\nUsername: \`${username}\`\nCompetition: [${competitionId}](<https://wiseoldman.net/competitions/${competitionId}>)` +
(requesterId
? `\nRequested by: <@${requesterId}>, \`${requesterId}\`, \`${requester?.user.username}\``
: ''),
interaction.user
);
} catch (e) {
response.setColor(config.visuals.red).setDescription(`${e.message}`);
Expand Down
10 changes: 6 additions & 4 deletions src/commands/instances/moderation/RemoveFromGroupCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class RemoveFromGroupCommand extends Command {
// Respond on the WOM discord chat with a success status
const response = new EmbedBuilder()
.setColor(config.visuals.green)
.setDescription(`✅ ${username} has been successfully removed from the group.`);
.setDescription(`✅ \`${username}\` has been successfully removed from the group.`);

try {
await removeFromGroup(groupId, username);
Expand All @@ -53,9 +53,11 @@ class RemoveFromGroupCommand extends Command {

sendModLog(
interaction.guild,
`Removed \`${username}\` from group (ID: ${groupId})`,
interaction.user,
requester?.user
`**Removed User From Group**\nUsername: \`${username}\`\nGroup: [${groupId}](<https://wiseoldman.net/groups/${groupId}>)` +
(requesterId
? `\nRequested by: <@${requesterId}>, \`${requesterId}\`, \`${requester?.user.username}\``
: ''),
interaction.user
);
} catch (e) {
response.setColor(config.visuals.red).setDescription(`${e.message}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import config from '../../../config';
import { Command, CommandConfig, CommandError, sendModLog } from '../../../utils';

const DM_MESSAGE = (code: string, competitionId: number) =>
`Hey! Here's your new verification code for competition ${competitionId}: \n\`${code}\`\n\nPlease save it somewhere safe and be mindful of who you choose to share it with.`;
`Hey! Here's your new verification code for competition [${competitionId}](<https://wiseoldman.net/competitions/${competitionId}>): \n\`${code}\`\n\nPlease save it somewhere safe and be mindful of who you choose to share it with.`;

const CHAT_MESSAGE = (userId: string) =>
`Verification code successfully reset. A DM has been sent to <@${userId}>.`;
Expand Down Expand Up @@ -71,7 +71,7 @@ class ResetCompetitionCodeCommand extends Command {

sendModLog(
interaction.guild,
`Reset competition code (ID: ${competitionId}) - Sent to <@${user.id}>`,
`**Competition Code Reset**\nCompetition: [${competitionId}](<https://wiseoldman.net/competitions/${competitionId}>)\nSent to: <@${userId}>, \`${userId}\`, \`${user.user.username}\``,
interaction.user
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/instances/moderation/ResetGroupCodeCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import config from '../../../config';
import { Command, CommandConfig, CommandError, sendModLog } from '../../../utils';

const DM_MESSAGE = (code: string, groupId: number) =>
`Hey! Here's your new verification code for group ${groupId}: \n\`${code}\`\n\nPlease save it somewhere safe and be mindful of who you choose to share it with.`;
`Hey! Here's your new verification code for group [${groupId}](<https://wiseoldman.net/${groupId}>): \n\`${code}\`\n\nPlease save it somewhere safe and be mindful of who you choose to share it with.`;

const CHAT_MESSAGE = (userId: string) =>
`Verification code successfully reset. A DM has been sent to <@${userId}>.`;
Expand Down Expand Up @@ -71,7 +71,7 @@ class ResetGroupCodeCommand extends Command {

sendModLog(
interaction.guild,
`Reset group code (ID: ${groupId}) - Sent to <@${user.id}>`,
`**Group Code Reset**\nGroup: [${groupId}](<https://wiseoldman.net/groups/${groupId}>)\nSent to: <@${userId}>, \`${userId}\`, \`${user.user.username}\``,
interaction.user
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/instances/moderation/VerifyGroupCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class VerifyGroupCommand extends Command {

sendModLog(
interaction.guild,
`Verified ${group.name} (${group.id}) - Leader: <@${userId}>`,
`**Verified Group**\nGroup: [(${group.id}) ${group.name}](<https://wiseoldman.net/groups/${group.id}>)\nLeader: <@${userId}>, \`${userId}\`, \`${user.user.username}\``,
interaction.user
);

Expand Down
4 changes: 2 additions & 2 deletions src/content/patreon-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ With this generous pledge, you'll be literally keeping the lights on. As a rewar
- Higher ranking and visibility on group page searches
```

The avatar and banner size guide can be found [here](https://www.figma.com/design/6jj3KGb5JxUXgTMQ7JmDjD/Group-Images-Size-Guide).

# How to claim your benefits

After subscribing to our [Patreon](https://wiseoldman.net/patreon), you should connect your Discord account on Patreon (
see a guide [here](https://support.patreon.com/hc/en-us/articles/212052266-Getting-Discord-access>)), and then you can click the button below to claim your benefits.

** **

0 comments on commit d330cc8

Please sign in to comment.