better snippet, rand image on char view

master
Kit Kasune 3 years ago
parent 0ce81eff87
commit b84f180248
  1. 4
      .vscode/discordjs.code-snippets
  2. 2
      commands/anime/charimage.js
  3. 3
      util/anime/charsearch.js

@ -10,7 +10,7 @@
"scope": "javascript,typescript",
"prefix": "djscmd",
"body": [
"const Discord = require('discord.js');${1:\n${2:\n}const $3 = require(\"$4\");\n}",
"const Discord = require('discord.js');${1:\n${2:\n}const $3 = require(\"$4\");}\n",
"module.exports = {",
" name: \"$5\",",
" aliases: [$6],",
@ -19,7 +19,7 @@
" description: \"$8\",",
" syntax: '`$9`',",
" extra: ${10:null}${11:,\n guildOnly: true}",
" },${12:\n cooldown: {\n time: $13,\n silent: ${14|true,false|}${15:,\n message: \"$16\"\\}},}",
" },${12:\n cooldown: {\n time: $13,\n silent: ${14|true,false|}${15:,\n message: \"$16\"}\n \\},}",
" help: new Discord.MessageEmbed()",
" .setTitle(\"Help -> $17\")",
" .setDescription(\"$18\")${19:\n .addField(\"$20\", \"$21\")}",

@ -59,7 +59,7 @@ module.exports = {
let ch = await Char.findOne({id: fn});
if (list) {
let pages = ch.images.map(im => new Discord.MessageEmbed()
let pages = ch.images.push(ch.thumbnail).map(im => new Discord.MessageEmbed()
.setTitle(ch.name)
.setDescription(`**Name:** ${ch.name}`)
.addField('Other', `**Anime**: ${client.misc.cache.animeID.get(ch.anime)}\n\n**Gender**: ${ch.gender}\n`)

@ -13,13 +13,14 @@ module.exports = async (message, client, search, threshold=-10000, type='full')
let cch = char.anime ? char : await Char.findOne({id: client.misc.cache.chars.get(char)});
let ani = await Ani.findOne({id: cch.anime});
let forceAni = false; if (!ani) {forceAni = true;}
cch.images.push(cch.thumbnail);
let rte = new Discord.MessageEmbed()
.setTitle(cch.name)
.setAuthor('Character Search', message.author.avatarURL())
.setDescription(`**Name:** ${cch.name}`)
.addField('Other', `**Anime**: ${forceAni ? cch.anime : `${ani.name} | ${ani.japname} | \`${ani.id}\``}\n\n**Gender**: ${cch.gender}\n`)
.setColor("c375f0")
.setImage(cch.thumbnail)
.setImage(cch.images[Math.floor(Math.random() * (cch.images.length + 1))])
.setFooter('Natsuki', client.user.avatarURL())
.setTimestamp();
if (type === 'full') {

Loading…
Cancel
Save