From 785baaa902f67d6715658b1e56b04212d5f33303 Mon Sep 17 00:00:00 2001 From: Hiroyuki Date: Tue, 14 Sep 2021 14:42:22 -0400 Subject: [PATCH] fix: usermod bug fixes --- src/commands/modlogs.ts | 2 +- src/commands/usermod.ts | 4 ++++ src/commands/users.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands/modlogs.ts b/src/commands/modlogs.ts index c5cef6e..d24b046 100644 --- a/src/commands/modlogs.ts +++ b/src/commands/modlogs.ts @@ -51,7 +51,7 @@ export default class Modlogs extends Command { }); if (embeds.length === 1) { - msg.edit({ embeds: [embeds[0]] }); + msg.edit({ content: null, embeds: [embeds[0]] }); } else { this.client.util.createPaginationEmbed(message, embeds); } diff --git a/src/commands/usermod.ts b/src/commands/usermod.ts index 246f276..7f9fe38 100644 --- a/src/commands/usermod.ts +++ b/src/commands/usermod.ts @@ -1,4 +1,5 @@ import { Message } from 'discord.js'; +import { rename } from 'fs/promises'; import { Client, Command } from '../class'; import { LINUX_USERNAME_REGEX } from '../class/AccountUtil'; @@ -7,6 +8,7 @@ export default class Usermod extends Command { super(client); this.name = 'usermod'; this.description = 'Modifies properties of a user\'s cloud account'; + this.usage = `${this.client.config.prefix}usermod [account] [property: username | email] [value]`; this.permissions = { roles: ['662163685439045632', '701454780828221450'] }; this.enabled = true; } @@ -51,7 +53,9 @@ export default class Usermod extends Command { } await this.client.util.exec(`usermod -l ${value} ${account.username}`); + await rename(account.homepath, `/home/${value}`); await this.client.util.exec(`usermod -d /home/${value} ${value}`); + await this.client.util.exec(`groupmod -n ${value} ${account.username}`); await account.updateOne({ username: value, diff --git a/src/commands/users.ts b/src/commands/users.ts index f474b69..80a358a 100644 --- a/src/commands/users.ts +++ b/src/commands/users.ts @@ -57,7 +57,7 @@ export default class Users extends Command { }); if (embeds.length === 1) { - msg.edit({ embeds: [embeds[0]] }); + msg.edit({ content: null, embeds: [embeds[0]] }); } else { msg.delete(); this.client.util.createPaginationEmbed(message, embeds);