Profile command

merge-requests/17/head
Hiroyuki 2021-03-05 18:02:50 -04:00
parent c0a96a5f67
commit 0289632f50
No known key found for this signature in database
GPG Key ID: C15AC26538975A24
5 changed files with 70 additions and 163 deletions

53
src/commands/profile.ts Normal file
View File

@ -0,0 +1,53 @@
import { Message } from 'eris';
import { Client, Command } from '../class';
export default class Profile extends Command {
constructor(client: Client) {
super(client);
this.name = 'profile';
this.description = 'Manages your profile on CR';
this.usage = 'profile <bio/github/gitlab> <new value>';
this.permissions = 0;
this.enabled = true;
}
public async run(message: Message, args: string[]) {
const profile = await this.client.db.Member.findOne({ userID: message.author.id });
if (!profile) return this.error(message.channel, 'Please try again later. We do not currently have a member profile for you.');
if (!args[1]) return this.error(message.channel, 'No new value was provided.');
const newValue = args.slice(1).join(' ');
if (newValue.length >= 512) return this.error(message.channel, 'Please shorten your input.');
switch (args[0]) {
case 'github':
await profile.updateOne({
additional: {
...profile.additional,
github: args[1],
},
});
this.success(message.channel, 'Updated GitHub.');
break;
case 'gitlab':
await profile.updateOne({
additional: {
...profile.additional,
gitlab: args[1],
},
});
this.success(message.channel, 'Updated GitLab.');
break;
case 'bio':
await profile.updateOne({
additional: {
...profile.additional,
bio: newValue,
},
});
this.success(message.channel, 'Updated bio.');
break;
default:
return this.error(message.channel, 'Please specify a valid option to change.');
}
}
}

View File

@ -58,14 +58,17 @@ export default class Whois extends Command {
if (ackResolve?.extension) { if (ackResolve?.extension) {
description += `☎️ ${ackResolve.extension}\n`; description += `☎️ ${ackResolve.extension}\n`;
} }
if (ackResolve?.gitlab) {
description += `${emotes.gitlab} ${ackResolve.gitlab}\n`; const memberProfile = await this.client.db.Member.findOne({ userID: message.author.id });
if (memberProfile?.additional?.gitlab) {
description += `${emotes.gitlab} ${memberProfile?.additional.gitlab}\n`;
} }
if (ackResolve?.github) { if (memberProfile?.additional?.github) {
description += `${emotes.github} ${ackResolve.github}\n`; description += `${emotes.github} ${memberProfile?.additional.github}\n`;
} }
if (ackResolve?.bio) { if (memberProfile?.additional?.bio) {
description += `${emotes.bio} *${ackResolve.bio}*\n`; description += `${emotes.bio} *${memberProfile?.additional.bio}*\n`;
} }
description += `\n<@${member.id}>`; description += `\n<@${member.id}>`;
embed.setDescription(description); embed.setDescription(description);
@ -93,8 +96,8 @@ export default class Whois extends Command {
embed2.addField('Department/Service', 'Library of Code sp-us | Bureau of Community Reports'.toUpperCase(), true); embed2.addField('Department/Service', 'Library of Code sp-us | Bureau of Community Reports'.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(() => { });
let totalScore = '0'; let totalScore = '0';
if (score.total < 200) totalScore = '---'; if (score.total < 200) totalScore = '---';
else if (score.total > 800) totalScore = '800'; else if (score.total > 800) totalScore = '800';

View File

@ -1,149 +0,0 @@
[
{
"name": "Matthew",
"id": "278620217221971968",
"title": "Chief Director of Engineering",
"pn": ["AD", "FSEN", "FSO", "FSCR", "FSCE", "FSED"],
"dept": "Board of Directors",
"emailAddress": "matthew@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/matthew",
"github": "https://github.com/matthew119427",
"bio": "so baby come light me up, and maybe ill let you on it. a little bit dangerous, but baby thats how i want it. a little less conversation and a little more touch my body. cuz im so into you... ~ Ariana Grande, Into You - Dangerous Woman",
"acknowledgements": ["Maintainer & Lead Developer"]
},
{
"name": "Bsian",
"id": "253600545972027394",
"title": "Director of Engineering",
"pn": ["AD", "FSEN", "FSCR", "FSED"],
"dept": "Board of Directors",
"emailAddress": "bsian@staff.libraryofcode.org",
"bio": "I also like trains",
"acknowledgements": ["Maintainer & Assistant Lead Developer"]
},
{
"name": "NightRaven",
"id": "239261547959025665",
"title": "Director of Information Security",
"pn": ["AD", "FSEN", "FSO", "FSCR", "FSED"],
"dept": "Board of Directors",
"emailAddress": "nightraven@staff.libraryofcode.org",
"bio": "I like trains"
},
{
"name": "Unknown",
"id": "143414786913206272",
"title": "Director of Operations",
"pn": ["AD", "FSO", "FSM", "FSCR"],
"dept": "Board of Directors",
"emailAddress": "unknown@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/unknown",
"bio": "im not a proffesional developer or anything, i just enjoy it as a hobby."
},
{
"name": "TheSkele27",
"id": "213632190557192192",
"title": "Director of Community Engagement",
"pn": ["AD", "FSCE"],
"dept": "Board of Directors",
"emailAddress": "theskele27@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/TheSkele27",
"github": "https://github.com/TheSkele27",
"bio": "Is water wet?"
},
{
"name": "Catbirby",
"id": "131953641371205632",
"pn": ["SP", "FSO", "FSM"],
"dept": "Supervisor",
"emailAddress": "catbirby@staff.libraryofcode.org",
"github": "https://github.com/catbirby",
"bio": "Computer Tech/Networking Nerd/SysADin/Graphic Designer/Audiophile. I don't do much coding but know my way around most languages."
},
{
"name": "D3XTER",
"id": "468009964263178262",
"pn": ["ST", "CE-I"],
"dept": "Core Team",
"emailAddress": "dexter@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/D3XTER",
"bio": "Hi I'm D3XTER how are ya?"
},
{
"name": "DedShotTM",
"id": "402154763363418142",
"pn": ["ST", "FSCR"],
"dept": "Technician & Moderator",
"emailAddress": "dedshot@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/DedShotTM",
"github": "https://github.com/DedShotTM",
"bio": "Imagine having a bio",
"acknowledgements": ["Contributor"]
},
{
"name": "EdgyBoi2414",
"id": "397432516010835970",
"pn": ["ST"],
"dept": "Core Team",
"emailAddress": "edgyboi2414@gmail.com",
"gitlab": "https://gitlab.libraryofcode.org/EdgyBoi2414",
"github": "https://github.com/EdgyBoi2414",
"bio": "\"If teardrops could be bottled, there'd be swimming pools, built by model..\" - Some Philosopher"
},
{
"name": "Hector",
"id": "377781496292835339",
"pn": ["ST", "CRS-I"],
"dept": "Technician",
"emailAddress": "hector@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/Hector",
"github": "https://github.com/Hector6704",
"bio": "Hi there, I'm the developer of Delta, the Discord bot. I'm a free-time French JavASript developer. I hope you'll enjoy LOC!",
"acknowledgements": ["Contributor"]
},
{
"name": "KhaaZ",
"id": "179908288337412096",
"pn": ["ST", "FSEN"],
"dept": "Core Team",
"emailAddress": "khaaz@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/KhaaZ",
"github": "https://github.com/Khaazz",
"bio": "I baguette for a living and eat code for breakfast.",
"acknowledgements": ["Assistant Maintainer"]
},
{
"name": "PlayerVMachine",
"id": "273999507174195203",
"pn": ["ST", "ED-I"],
"dept": "Instructor & Core Team",
"emailAddress": "nicolas@staff.libraryofcode.org",
"bio": "I write C++ to pay off my student loans"
},
{
"name": "Sterben",
"id": "241361691730903040",
"pn": ["ST", "CRS-I", "ENG-I"],
"dept": "Core Team",
"emailAddress": "sterben@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/Sterben",
"github": "https://github.com/sterben6",
"bio": "im bored"
},
{
"name": "Raymond",
"id": "314564798992089090",
"pn": ["AS"],
"dept": "Associate",
"emailAddress": "smashjarchive@staff.libraryofcode.org",
"gitlab": "https://gitlab.libraryofcode.org/javaarchive",
"github": "https://github.com/javaarchive",
"bio": "I don't like reinventing the wheel and don't like coding on small screens like laptops as much"
},
{
"name": "Null",
"id": "323673862971588609",
"gitlab": "https://gitlab.libraryofcode.org/null",
"acknowledgements": ["Contributor"]
}
]

View File

@ -5,6 +5,9 @@ export interface MemberInterface extends Document {
additional: { additional: {
langs: ['js', 'py', 'rb', 'ts', 'rs', 'go', 'cfam', 'csharp', 'swift', 'java', 'kt', 'asm'], langs: ['js', 'py', 'rb', 'ts', 'rs', 'go', 'cfam', 'csharp', 'swift', 'java', 'kt', 'asm'],
operatingSystems: ['arch', 'deb', 'cent', 'fedora', 'manjaro', 'mdarwin', 'redhat', 'ubuntu', 'win'], operatingSystems: ['arch', 'deb', 'cent', 'fedora', 'manjaro', 'mdarwin', 'redhat', 'ubuntu', 'win'],
github: string;
gitlab: string;
bio: string;
}, },
} }
@ -13,6 +16,9 @@ const Member: Schema = new Schema({
additional: { additional: {
langs: Array, langs: Array,
operatingSystems: Array, operatingSystems: Array,
github: String,
gitlab: String,
bio: String,
}, },
}); });

View File

@ -7,9 +7,6 @@ export interface StaffInterface extends Document {
dept: string, dept: string,
pn: string[], pn: string[],
emailAddress: string, emailAddress: string,
gitlab: string,
github: string,
bio: string,
extension: string, extension: string,
acknowledgements: string[], acknowledgements: string[],
} }
@ -21,9 +18,6 @@ const Staff: Schema = new Schema({
dept: String, dept: String,
pn: Array, pn: Array,
emailAddress: String, emailAddress: String,
gitlab: String,
github: String,
bio: String,
extension: String, extension: String,
acknowledgements: Array, acknowledgements: Array,
}); });