forked from engineering/cloudservices
fix: usermod bug fixes
parent
2bad7fb05a
commit
785baaa902
|
@ -51,7 +51,7 @@ export default class Modlogs extends Command {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (embeds.length === 1) {
|
if (embeds.length === 1) {
|
||||||
msg.edit({ embeds: [embeds[0]] });
|
msg.edit({ content: null, embeds: [embeds[0]] });
|
||||||
} else {
|
} else {
|
||||||
this.client.util.createPaginationEmbed(message, embeds);
|
this.client.util.createPaginationEmbed(message, embeds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Message } from 'discord.js';
|
import { Message } from 'discord.js';
|
||||||
|
import { rename } from 'fs/promises';
|
||||||
import { Client, Command } from '../class';
|
import { Client, Command } from '../class';
|
||||||
import { LINUX_USERNAME_REGEX } from '../class/AccountUtil';
|
import { LINUX_USERNAME_REGEX } from '../class/AccountUtil';
|
||||||
|
|
||||||
|
@ -7,6 +8,7 @@ export default class Usermod extends Command {
|
||||||
super(client);
|
super(client);
|
||||||
this.name = 'usermod';
|
this.name = 'usermod';
|
||||||
this.description = 'Modifies properties of a user\'s cloud account';
|
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.permissions = { roles: ['662163685439045632', '701454780828221450'] };
|
||||||
this.enabled = true;
|
this.enabled = true;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +53,9 @@ export default class Usermod extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.client.util.exec(`usermod -l ${value} ${account.username}`);
|
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(`usermod -d /home/${value} ${value}`);
|
||||||
|
await this.client.util.exec(`groupmod -n ${value} ${account.username}`);
|
||||||
|
|
||||||
await account.updateOne({
|
await account.updateOne({
|
||||||
username: value,
|
username: value,
|
||||||
|
|
|
@ -57,7 +57,7 @@ export default class Users extends Command {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (embeds.length === 1) {
|
if (embeds.length === 1) {
|
||||||
msg.edit({ embeds: [embeds[0]] });
|
msg.edit({ content: null, embeds: [embeds[0]] });
|
||||||
} else {
|
} else {
|
||||||
msg.delete();
|
msg.delete();
|
||||||
this.client.util.createPaginationEmbed(message, embeds);
|
this.client.util.createPaginationEmbed(message, embeds);
|
||||||
|
|
Loading…
Reference in New Issue