Compare commits

..

No commits in common. "bd5515c587b2e14f4accf170716c484690acb93c" and "18f3bd746b03a93b8b0b4e4f3c66927671083e00" have entirely different histories.

5 changed files with 942 additions and 994 deletions

View file

@ -31,17 +31,17 @@
"discord.js": "^14.3.0", "discord.js": "^14.3.0",
"dotenv": "^16.0.0", "dotenv": "^16.0.0",
"emoji-regex": "^9.2.0", "emoji-regex": "^9.2.0",
"jest": "^29.5.0", "jest": "^27.4.5",
"jest-mock-extended": "^3.0.4", "jest-mock-extended": "^3.0.0",
"minimatch": "7.4.2", "minimatch": "7.4.2",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"random-bunny": "^2.0.5", "random-bunny": "^2.0.5",
"ts-jest": "^29.0.5", "ts-jest": "^27.1.2",
"typeorm": "^0.2.44", "typeorm": "^0.2.44",
"uuid": "^9.0.0" "uuid": "^9.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^18.0.0", "@types/node": "^18.0.0",
"typescript": "^5.0.2" "typescript": "^5.0.0"
} }
} }

View file

@ -75,12 +75,12 @@ export default class Timeout extends Command {
}, },
]); ]);
if (!targetMember.manageable) { // if (!targetMember.manageable) {
await interaction.reply('Insufficient bot permissions. Please contact a moderator.'); // await interaction.reply('Insufficient bot permissions. Please contact a moderator.');
return; // return;
} // }
await targetMember.timeout(timeLength.GetMilliseconds(), reason || ""); // await targetMember.timeout(timeLength.GetMilliseconds(), reason || "");
const channelName = await SettingsHelper.GetSetting('channels.logs.mod', interaction.guildId); const channelName = await SettingsHelper.GetSetting('channels.logs.mod', interaction.guildId);
@ -97,45 +97,7 @@ export default class Timeout extends Command {
const resultEmbed = new EmbedBuilder() const resultEmbed = new EmbedBuilder()
.setColor(EmbedColours.Ok) .setColor(EmbedColours.Ok)
.setDescription(`<@${targetUser.user.id}> has been timed out`); .setDescription("User successfully timed out");
const dmEmbed = new EmbedBuilder()
.setColor(EmbedColours.Ok)
.setDescription(`You have been timed out in ${interaction.guild.name}`)
.addFields([
{
name: "Reason",
value: reason || "*none*"
},
{
name: "Length",
value: timeLength.GetLengthShort(),
},
{
name: "Until",
value: timeLength.GetDateFromNow().toString(),
},
]);
try {
const dmChannel = await targetUser.user.createDM();
await dmChannel.send({ embeds: [ dmEmbed ]});
resultEmbed.addFields([
{
name: "DM Sent",
value: "true",
},
]);
} catch {
resultEmbed.addFields([
{
name: "DM Sent",
value: "false",
},
]);
}
await interaction.reply({ embeds: [ resultEmbed ]}); await interaction.reply({ embeds: [ resultEmbed ]});
} }

View file

@ -13,8 +13,6 @@ export default class AuditTools {
return "Kick"; return "Kick";
case AuditType.Ban: case AuditType.Ban:
return "Ban"; return "Ban";
case AuditType.Timeout:
return "Timeout";
default: default:
return "Other"; return "Other";
} }
@ -32,8 +30,6 @@ export default class AuditTools {
return AuditType.Kick; return AuditType.Kick;
case "ban": case "ban":
return AuditType.Ban; return AuditType.Ban;
case "timeout":
return AuditType.Timeout;
default: default:
return AuditType.General; return AuditType.General;
} }

View file

@ -1,16 +0,0 @@
import { PermissionsBitField, SlashCommandBuilder } from "discord.js";
import Timeout from "../../src/commands/timeout";
describe('Constructor', () => {
test('Expect CommandBuilder to be configured', () => {
const command = new Timeout();
expect(command.CommandBuilder).toBeDefined();
const commandBuilder = command.CommandBuilder as SlashCommandBuilder;
expect(commandBuilder.name).toBe("timeout");
expect(commandBuilder.description).toBe("Timeouts a user out, sending them a DM with the reason if possible");
expect(commandBuilder.options.length).toBe(3);
});
});

1858
yarn.lock

File diff suppressed because it is too large Load diff