From 9db7447c8851390d48f438fcef2e37c84488ac71 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Thu, 6 Jan 2022 15:37:52 +0500 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/General/setafk.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/commands/General/setafk.js b/commands/General/setafk.js index aae18653..99d46bb2 100644 --- a/commands/General/setafk.js +++ b/commands/General/setafk.js @@ -19,23 +19,25 @@ class Setafk extends Command { async run(message, args, data) { const reason = args.join(" "); if (!reason || reason.length > 250) return message.error("general/setafk:MISSING_REASON"); + if (reason === "delete") { if (data.userData.afk) { data.userData.afk = null; - await data.userData.save(); + data.userData.save(); + return message.sendT("general/setafk:DELETED", { username: message.author.username }); }; + } else { + data.userData.afk = reason; + data.userData.save(); + + return message.success("general/setafk:SUCCESS", { + reason, + prefix: data.guild.prefix + }); }; - - message.success("general/setafk:SUCCESS", { - reason, - prefix: data.guild.prefix - }); - - data.userData.afk = reason; - data.userData.save(); } };