Set nickname command
parent
b185152b69
commit
4b1c61f6e4
|
@ -1,6 +1,5 @@
|
||||||
# Package Management & Libraries
|
# Package Management & Libraries
|
||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
|
||||||
|
|
||||||
# Configuration Files
|
# Configuration Files
|
||||||
config.yaml
|
config.yaml
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,7 +29,7 @@
|
||||||
"eslint": "^7.19.0",
|
"eslint": "^7.19.0",
|
||||||
"eslint-config-airbnb-base": "^14.1.0",
|
"eslint-config-airbnb-base": "^14.1.0",
|
||||||
"eslint-plugin-import": "^2.20.2",
|
"eslint-plugin-import": "^2.20.2",
|
||||||
"typescript": "^3.9.2"
|
"typescript": "^3.9.8"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/text-to-speech": "^3.1.2",
|
"@google-cloud/text-to-speech": "^3.1.2",
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
"puppeteer": "^5.5.0",
|
"puppeteer": "^5.5.0",
|
||||||
"sd-notify": "^2.8.0",
|
"sd-notify": "^2.8.0",
|
||||||
"signale": "^1.4.0",
|
"signale": "^1.4.0",
|
||||||
"stripe": "^8.134.0",
|
"stripe": "^8.135.0",
|
||||||
"uuid": "^8.0.0",
|
"uuid": "^8.0.0",
|
||||||
"yaml": "^1.9.2"
|
"yaml": "^1.9.2"
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ export default class Score extends Command {
|
||||||
constructor(client: Client) {
|
constructor(client: Client) {
|
||||||
super(client);
|
super(client);
|
||||||
this.name = 'score';
|
this.name = 'score';
|
||||||
this.description = 'Retreives your Community Report';
|
this.description = 'Retrieves your Community Report';
|
||||||
this.usage = `${this.client.config.prefix}score\n${this.client.config.prefix}score <member> <type: 'hard' | 'soft'> <reporting department: ex. Library of Code sp-us | Cloud Account Services>:<reason>`;
|
this.usage = `${this.client.config.prefix}score\n${this.client.config.prefix}score <member> <type: 'hard' | 'soft'> <reporting department: ex. Library of Code sp-us | Cloud Account Services>:<reason>`;
|
||||||
this.subcmds = [Score_Hist, Score_Notify, Score_Pref];
|
this.subcmds = [Score_Hist, Score_Notify, Score_Pref];
|
||||||
this.permissions = 0;
|
this.permissions = 0;
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { Message } from 'eris';
|
||||||
|
import { Client, Command } from '../class';
|
||||||
|
|
||||||
|
export default class Setnick extends Command {
|
||||||
|
constructor(client: Client) {
|
||||||
|
super(client);
|
||||||
|
this.name = 'setnick';
|
||||||
|
this.description = 'Changes the nickname of a member';
|
||||||
|
this.usage = 'setnick <member> [new nickname]';
|
||||||
|
this.permissions = 2;
|
||||||
|
this.guildOnly = true;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async run(message: Message, args: string[]) {
|
||||||
|
try {
|
||||||
|
if (!args[0]) return this.client.commands.get('help').run(message, [this.name]);
|
||||||
|
const member = this.client.util.resolveMember(args[0], this.mainGuild);
|
||||||
|
if (!member) return this.error(message.channel, 'Cannot find user.');
|
||||||
|
let nickname = args.slice(1).join(' ');
|
||||||
|
if (args.length === 1) nickname = null;
|
||||||
|
if (nickname?.length > 32) return this.error(message.channel, 'New nickname may not be more than 32 characters long.');
|
||||||
|
await member.edit({ nick: nickname });
|
||||||
|
return this.success(message.channel, `Updated the nickname of ${member.user.username}#${member.user.discriminator}.`);
|
||||||
|
} catch (err) {
|
||||||
|
return this.client.util.handleError(err, message, this, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue