Finished timeout command
This commit is contained in:
30
package-lock.json
generated
30
package-lock.json
generated
@@ -7,14 +7,15 @@
|
||||
"": {
|
||||
"name": "illegitimate-bot",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"axios": "^1.3.4",
|
||||
"discord.js": "^14.8.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"log-beautify": "^1.2.0",
|
||||
"mongoose": "^7.0.1",
|
||||
"ms": "^2.1.3"
|
||||
"ms": "^2.1.3",
|
||||
"pretty-ms": "^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/builders": {
|
||||
@@ -553,6 +554,31 @@
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||
},
|
||||
"node_modules/parse-ms": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-3.0.0.tgz",
|
||||
"integrity": "sha512-Tpb8Z7r7XbbtBTrM9UhpkzzaMrqA2VXMT3YChzYltwV3P3pM6t8wl7TvpMnSTosz1aQAdVib7kdoys7vYOPerw==",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/pretty-ms": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-8.0.0.tgz",
|
||||
"integrity": "sha512-ASJqOugUF1bbzI35STMBUpZqdfYKlJugy6JBziGi2EE+AL5JPJGSzvpeVXojxrr0ViUYoToUjb5kjSEGf7Y83Q==",
|
||||
"dependencies": {
|
||||
"parse-ms": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
|
||||
@@ -10,13 +10,14 @@
|
||||
"prod:build:user": "node scripts/deploy-commands.js --dev"
|
||||
},
|
||||
"author": "Taken",
|
||||
"license": "ISC",
|
||||
"license": "GPL-3.0-only",
|
||||
"dependencies": {
|
||||
"axios": "^1.3.4",
|
||||
"discord.js": "^14.8.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"log-beautify": "^1.2.0",
|
||||
"mongoose": "^7.0.1",
|
||||
"ms": "^2.1.3"
|
||||
"ms": "^2.1.3",
|
||||
"pretty-ms": "^8.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ module.exports = {
|
||||
name: "timeout",
|
||||
description: "Times out a memeber",
|
||||
type: "slash",
|
||||
dev: true,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("timeout")
|
||||
@@ -34,11 +33,13 @@ module.exports = {
|
||||
|
||||
await interaction.deferReply()
|
||||
|
||||
const { default: prettyms } = await import("pretty-ms")
|
||||
const target1 = interaction.options.getUser("user")
|
||||
const target = interaction.guild.members.cache.get(target1.id)
|
||||
const timeString = interaction.options.getString("time")
|
||||
const reason = interaction.options.getString("reason") || "No reason provided"
|
||||
const time = ms(timeString)
|
||||
const prettyTime = prettyms(time, { verbose: true })
|
||||
const embedColor = Number(color.replace("#", "0x"))
|
||||
|
||||
if (target.bot) {
|
||||
@@ -111,7 +112,7 @@ module.exports = {
|
||||
await target.timeout(time, reason)
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Updated timeout of " + userMention(target.id) + " to " + timeString + " for " + reason,
|
||||
description: "Updated timeout of " + userMention(target.id) + " to " + prettyTime + " for " + reason,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + target.id,
|
||||
@@ -126,7 +127,7 @@ module.exports = {
|
||||
await target.timeout(time, reason)
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Timed out " + userMention(target.id) + " for " + timeString + " for " + reason,
|
||||
description: "Timed out " + userMention(target.id) + " for " + prettyTime + " for " + reason,
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: "ID: " + target.id,
|
||||
|
||||
Reference in New Issue
Block a user