mirror of
https://github.com/danbulant/ssps-bot
synced 2026-06-19 06:11:31 +00:00
prestizni profil
This commit is contained in:
parent
efb1380e47
commit
09ccd77db5
1 changed files with 43 additions and 0 deletions
43
commands/ssps/profil.js
Normal file
43
commands/ssps/profil.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
const commando = require("@iceprod/discord.js-commando");
|
||||
const { MessageEmbed, APIMessage } = require("discord.js");
|
||||
const { DateTime } = require("luxon");
|
||||
const Person = require("../../utils/models/person");
|
||||
const api = require("../../utils/api");
|
||||
|
||||
module.exports = class profil extends commando.Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: "profil",
|
||||
memberName: "profil",
|
||||
group: "ssps",
|
||||
description: "Zobrazí profil uživatele",
|
||||
args: [{
|
||||
key: "user",
|
||||
type: "user",
|
||||
default: msg => msg.author,
|
||||
prompt: "Čí profil zobrazit?"
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { user }) {
|
||||
const embed = new MessageEmbed();
|
||||
const person = await Person.findOne({
|
||||
where: { discord: user.id }
|
||||
});
|
||||
if(!person) {
|
||||
embed.setColor("RED");
|
||||
embed.setTitle("Uživatel nenalezen.");
|
||||
embed.setDescription("Discord účet není propojený s účtem školním.");
|
||||
return msg.say(embed);
|
||||
}
|
||||
embed.setTitle(person.name);
|
||||
if(person.avatar) embed.setThumbnail(person.avatar);
|
||||
embed.setDescription(person.about);
|
||||
if(person.birthday) embed.addField("Narozeniny", DateTime.fromFormat(person.birthday, "yyyy-MM-dd").toFormat("dd. MM. yyyy"));
|
||||
embed.addField("Email", person.mail);
|
||||
embed.addField("Typ", api.isTeacherMail(person.mail) ? "Učitel" : api.isStudentMail(person.mail) ? "Student" : "Neprestižní");
|
||||
|
||||
return msg.say(embed);
|
||||
}
|
||||
};
|
||||
Loading…
Reference in a new issue