Coding Global Background
Coding Global

Code Command error?

Archiviert a year ago
2 Nachrichten
2 Mitglieder
Erstellt a year ago
Aktualisiert a year ago
In Discord öffnen
O
Dani
Verified
Hey, i have this code that’s not properly running through my bot. My hosting service works fine but when i try to use the commands it doesn’t go through. If you need the entire GitHub repo pls let me know. I was trying to create a warn feature where it would have a time included in the warn to then be removed from the warnings after a set amount of time. And perm warns for it to be permanently there.


const { client } = require("../index");
const warns = require('../schemas/warns');

module.exports = {
name: 'warn',
description: 'warn a user',
async execute(message, args) {
if (!message.member.permissions.has('MANAGE_MESSAGES')) return;
const warnUser = message.guild.members.cache.get(args[1]) || message.mentions.members?.first()
if (!warnUser) return message.react("❌");
if (args[0] === ">permwarn") {
if (args[2]) {
actionPost({
msg: message,
u: warnUser,
a: "warn",
r: message.content.substring(>permwarn ${warnUser.id} .length),
s: "permwarn"
});
} else {
return message.react("❌");
}
}

else if (args[0] === ">warn") {
if (args[2] && Number(args[2]) && Number(args[2]) > 0 && Number(args[2]) < 6) {
let time = args[3];
if (time) {

actionPost({
msg: message,
u: warnUser,
a: "warn",
r: message.content.substring(>warn ${warnUser.id} ${args[2]} .length),
s: Number(args[2]),
expTime: time
});

const ms = msToMilliseconds(time);
setTimeout(() => {
console.log(Warning for ${warnUser.tag} expired.);
}, ms);
} else {
actionPost({
msg: message,
u: warnUser,
a: "warn",
r: message.content.substring(>warn ${warnUser.id} .length),
s: 1
});
}

Antworten (1)