add operating systems to whois
parent
cd35782bb6
commit
fd70db8b73
|
@ -17,11 +17,27 @@ export default class AddItem extends Command {
|
||||||
const embed = new RichEmbed();
|
const embed = new RichEmbed();
|
||||||
embed.setTitle('Whois Data Codes');
|
embed.setTitle('Whois Data Codes');
|
||||||
embed.addField('Languages', '**Assembly Language:** lang-asm\n**C/C++:** lang-cfam\n**C#:** lang-csharp\n**Go:** lang-go\n**Java:** lang-java\n**JavaScript:** lang-js\n**Kotlin:** lang-kt\n**Python:** lang-py\n**Ruby:** lang-rb\n**Rust:** lang-rs\n**Swift:** lang-swift\n**TypeScript:** lang-ts');
|
embed.addField('Languages', '**Assembly Language:** lang-asm\n**C/C++:** lang-cfam\n**C#:** lang-csharp\n**Go:** lang-go\n**Java:** lang-java\n**JavaScript:** lang-js\n**Kotlin:** lang-kt\n**Python:** lang-py\n**Ruby:** lang-rb\n**Rust:** lang-rs\n**Swift:** lang-swift\n**TypeScript:** lang-ts');
|
||||||
|
embed.addField('Operating Systems', '**Arch:** os-arch\n**Debian:** os-deb\n**Fedora:** os-fedora\n**macOS:** os-mdarwin\n**RedHat:** os-redhat\n**Ubuntu:** os-ubuntu\n**Windows:** os-win');
|
||||||
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
embed.setTimestamp();
|
embed.setTimestamp();
|
||||||
return message.channel.createMessage({ embed });
|
return message.channel.createMessage({ embed });
|
||||||
}
|
}
|
||||||
if (['js', 'py', 'rb', 'ts', 'rs', 'go', 'cfam', 'csharp', 'swift', 'java', 'kt', 'asm'].includes(args[0].split('-')[1])) {
|
if (args[0].split('-')[0] === 'os' && ['arch', 'deb', 'fedora', 'mdarwin', 'redhat', 'ubuntu', 'win'].includes(args[0].split('-')[1])) {
|
||||||
|
const account = await this.client.db.member.findOne({ userID: message.member.id });
|
||||||
|
if (!account) {
|
||||||
|
// eslint-disable-next-line new-cap
|
||||||
|
const newAccount = new this.client.db.member({
|
||||||
|
userID: message.member.id,
|
||||||
|
additional: {
|
||||||
|
operatingSystems: [args[0].split('-')[1]],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
await newAccount.save();
|
||||||
|
}
|
||||||
|
await account.updateOne({ $addToSet: { 'additional.operatingSystems': args[0].split('-')[1] } });
|
||||||
|
return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Added OS code ${args[0]} to profile.***`);
|
||||||
|
}
|
||||||
|
if (args[0].split('-')[0] === 'lang' && ['js', 'py', 'rb', 'ts', 'rs', 'go', 'cfam', 'csharp', 'swift', 'java', 'kt', 'asm'].includes(args[0].split('-')[1])) {
|
||||||
const account = await this.client.db.member.findOne({ userID: message.member.id });
|
const account = await this.client.db.member.findOne({ userID: message.member.id });
|
||||||
if (!account) {
|
if (!account) {
|
||||||
// eslint-disable-next-line new-cap
|
// eslint-disable-next-line new-cap
|
||||||
|
@ -32,12 +48,11 @@ export default class AddItem extends Command {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await newAccount.save();
|
await newAccount.save();
|
||||||
return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Added language code ${args[0]} to profile.***`);
|
|
||||||
}
|
}
|
||||||
await account.updateOne({ $addToSet: { 'additional.langs': args[0].split('-')[1] } });
|
await account.updateOne({ $addToSet: { 'additional.langs': args[0].split('-')[1] } });
|
||||||
return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Added language code ${args[0]} to profile.***`);
|
return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Added language code ${args[0]} to profile.***`);
|
||||||
}
|
}
|
||||||
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Invalid language code.***`);
|
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Invalid data code.***`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return this.client.util.handleError(err, message, this);
|
return this.client.util.handleError(err, message, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,19 +17,28 @@ export default class DelItem extends Command {
|
||||||
const embed = new RichEmbed();
|
const embed = new RichEmbed();
|
||||||
embed.setTitle('Whois Data Codes');
|
embed.setTitle('Whois Data Codes');
|
||||||
embed.addField('Languages', '**Assembly Language:** lang-asm\n**C/C++:** lang-cfam\n**C#:** lang-csharp\n**Go:** lang-go\n**Java:** lang-java\n**JavaScript:** lang-js\n**Kotlin:** lang-kt\n**Python:** lang-py\n**Ruby:** lang-rb\n**Rust:** lang-rs\n**Swift:** lang-swift\n**TypeScript:** lang-ts');
|
embed.addField('Languages', '**Assembly Language:** lang-asm\n**C/C++:** lang-cfam\n**C#:** lang-csharp\n**Go:** lang-go\n**Java:** lang-java\n**JavaScript:** lang-js\n**Kotlin:** lang-kt\n**Python:** lang-py\n**Ruby:** lang-rb\n**Rust:** lang-rs\n**Swift:** lang-swift\n**TypeScript:** lang-ts');
|
||||||
|
embed.addField('Operating Systems', '**Arch:** os-arch\n**Debian:** os-deb\n**Fedora:** os-fedora\n**macOS:** os-mdarwin\n**RedHat:** os-redhat\n**Ubuntu:** os-ubuntu\n**Windows:** os-win');
|
||||||
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
embed.setTimestamp();
|
embed.setTimestamp();
|
||||||
return message.channel.createMessage({ embed });
|
return message.channel.createMessage({ embed });
|
||||||
}
|
}
|
||||||
if (['js', 'py', 'rb', 'ts', 'rs', 'go', 'cfam', 'csharp', 'swift', 'java', 'kt', 'asm'].includes(args[0].split('-')[1])) {
|
if (args[0].split('-')[0] === 'os' && ['arch', 'deb', 'fedora', 'mdarwin', 'redhat', 'ubuntu', 'win'].includes(args[0].split('-')[1])) {
|
||||||
|
const account = await this.client.db.member.findOne({ userID: message.member.id });
|
||||||
|
if (!account || !account?.additional.operatingSystems || account?.additional.operatingSystems.length < 1) {
|
||||||
|
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} You don't have any operating systems to remove.***`);
|
||||||
|
}
|
||||||
|
await account.updateOne({ $pull: { 'additional.operatingSystems': args[0].split('-')[1] } });
|
||||||
|
return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Removed OS code ${args[0]} from profile.***`);
|
||||||
|
}
|
||||||
|
if (args[0].split('-')[0] === 'lang' && ['js', 'py', 'rb', 'ts', 'rs', 'go', 'cfam', 'csharp', 'swift', 'java', 'kt', 'asm'].includes(args[0].split('-')[1])) {
|
||||||
const account = await this.client.db.member.findOne({ userID: message.member.id });
|
const account = await this.client.db.member.findOne({ userID: message.member.id });
|
||||||
if (!account || !account?.additional.langs || account?.additional.langs.length < 1) {
|
if (!account || !account?.additional.langs || account?.additional.langs.length < 1) {
|
||||||
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} You don't have any languages to remove.***`);
|
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} You don't have any languages to remove.***`);
|
||||||
}
|
}
|
||||||
await account.updateOne({ $pull: { 'additional.langs': args[0].split('-')[1] } });
|
await account.updateOne({ $pull: { 'additional.langs': args[0].split('-')[1] } });
|
||||||
return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Removed language code ${args[0]} to profile.***`);
|
return message.channel.createMessage(`***${this.client.util.emojis.SUCCESS} Removed language code ${args[0]} from profile.***`);
|
||||||
}
|
}
|
||||||
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Invalid language code.***`);
|
return message.channel.createMessage(`***${this.client.util.emojis.ERROR} Invalid data code.***`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return this.client.util.handleError(err, message, this);
|
return this.client.util.handleError(err, message, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,37 @@ export default class Whois extends Command {
|
||||||
}
|
}
|
||||||
embed.addField('Known Languages', langs.join(', '));
|
embed.addField('Known Languages', langs.join(', '));
|
||||||
}
|
}
|
||||||
|
if (account?.additional?.operatingSystems.length > 0) {
|
||||||
|
const operatingSystems: string[] = [];
|
||||||
|
for (const os of account.additional.operatingSystems.sort((a, b) => a.localeCompare(b))) {
|
||||||
|
switch (os) {
|
||||||
|
case 'arch':
|
||||||
|
operatingSystems.push('<:arch:707694976523304960> Arch');
|
||||||
|
break;
|
||||||
|
case 'deb':
|
||||||
|
operatingSystems.push('<:debian:707695042617147589> Debian');
|
||||||
|
break;
|
||||||
|
case 'fedora':
|
||||||
|
operatingSystems.push('<:fedora:707695073151680543> Fedora');
|
||||||
|
break;
|
||||||
|
case 'mdarwin':
|
||||||
|
operatingSystems.push('<:mac:707695427754917919> macOS');
|
||||||
|
break;
|
||||||
|
case 'redhat':
|
||||||
|
operatingSystems.push('<:redhat:707695102159749271> RedHat Enterprise Linux');
|
||||||
|
break;
|
||||||
|
case 'ubuntu':
|
||||||
|
operatingSystems.push('<:ubuntu:707695136888586300> Ubuntu');
|
||||||
|
break;
|
||||||
|
case 'win':
|
||||||
|
operatingSystems.push('<:windows10:707695160259248208> Windows');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
embed.addField('Used Operating Systems', operatingSystems.join(', '));
|
||||||
|
}
|
||||||
if (permissions.length > 0) {
|
if (permissions.length > 0) {
|
||||||
embed.addField('Permissions', permissions.join(', '));
|
embed.addField('Permissions', permissions.join(', '));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ export interface MemberInterface extends Document {
|
||||||
userID: string
|
userID: string
|
||||||
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', 'fedora', 'mdarwin', 'redhat', 'ubuntu', 'win'],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ const Member: Schema = new Schema({
|
||||||
userID: String,
|
userID: String,
|
||||||
additional: {
|
additional: {
|
||||||
langs: Array,
|
langs: Array,
|
||||||
|
operatingSystems: Array,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue