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;
|
||||||
|
@ -38,8 +38,8 @@ export default class Score extends Command {
|
||||||
embed.addField('Department/Service', `${user.username} via Discord`.toUpperCase(), true);
|
embed.addField('Department/Service', `${user.username} via Discord`.toUpperCase(), true);
|
||||||
embed.setTimestamp();
|
embed.setTimestamp();
|
||||||
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
const log = <TextChannel> this.client.guilds.get(this.client.config.guildID).channels.get('611584771356622849');
|
const log = <TextChannel>this.client.guilds.get(this.client.config.guildID).channels.get('611584771356622849');
|
||||||
log.createMessage({ embed }).catch(() => {});
|
log.createMessage({ embed }).catch(() => { });
|
||||||
check = true;
|
check = true;
|
||||||
} else {
|
} else {
|
||||||
user = this.client.util.resolveMember(args[0], this.mainGuild)?.user;
|
user = this.client.util.resolveMember(args[0], this.mainGuild)?.user;
|
||||||
|
@ -70,12 +70,12 @@ export default class Score extends Command {
|
||||||
embed.addField('Reason', reason ?? 'N/A', true);
|
embed.addField('Reason', reason ?? 'N/A', true);
|
||||||
embed.setTimestamp();
|
embed.setTimestamp();
|
||||||
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
const log = <TextChannel> this.client.guilds.get(this.client.config.guildID).channels.get('611584771356622849');
|
const log = <TextChannel>this.client.guilds.get(this.client.config.guildID).channels.get('611584771356622849');
|
||||||
log.createMessage({ embed }).catch(() => {});
|
log.createMessage({ embed }).catch(() => { });
|
||||||
if (score.notify === true) {
|
if (score.notify === true) {
|
||||||
await this.client.getDMChannel(user.id).then((chan) => {
|
await this.client.getDMChannel(user.id).then((chan) => {
|
||||||
chan.createMessage(`__**Community Score - Hard Pull Notification**__\n*You have signed up to be notified whenever your hard score has been pulled. See \`?score\` for more information.*\n\n**Department/Service:** ${name.toUpperCase()}`);
|
chan.createMessage(`__**Community Score - Hard Pull Notification**__\n*You have signed up to be notified whenever your hard score has been pulled. See \`?score\` for more information.*\n\n**Department/Service:** ${name.toUpperCase()}`);
|
||||||
}).catch(() => {});
|
}).catch(() => { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,8 +193,8 @@ export default class Score extends Command {
|
||||||
embed2.addField('Department/Service', name.toUpperCase(), true);
|
embed2.addField('Department/Service', name.toUpperCase(), true);
|
||||||
embed2.setTimestamp();
|
embed2.setTimestamp();
|
||||||
embed2.setFooter(this.client.user.username, this.client.user.avatarURL);
|
embed2.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
const log = <TextChannel> this.client.guilds.get(this.client.config.guildID).channels.get('611584771356622849');
|
const log = <TextChannel>this.client.guilds.get(this.client.config.guildID).channels.get('611584771356622849');
|
||||||
log.createMessage({ embed: embed2 }).catch(() => {});
|
log.createMessage({ embed: embed2 }).catch(() => { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (args[1] === 'hard' && this.checkCustomPermissions(this.client.util.resolveMember(message.author.id, this.mainGuild), 6)) {
|
if (args[1] === 'hard' && this.checkCustomPermissions(this.client.util.resolveMember(message.author.id, this.mainGuild), 6)) {
|
||||||
|
|
|
@ -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