mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 06:33:05 -04:00
[cmd](urbandictionary) add icon, fix author link
This commit is contained in:
parent
07bb620cd1
commit
0ea80b7452
2 changed files with 14 additions and 5 deletions
|
@ -9,7 +9,11 @@ const { urbandictionary } = require('../../../labscore/api');
|
||||||
function createUrbanPage(context, result){
|
function createUrbanPage(context, result){
|
||||||
let e = createEmbed("default", context, {
|
let e = createEmbed("default", context, {
|
||||||
description: `**${link(result.link, result.title)}**`,
|
description: `**${link(result.link, result.title)}**`,
|
||||||
fields: []
|
fields: [],
|
||||||
|
footer: {
|
||||||
|
iconUrl: STATICS.urbandictionary,
|
||||||
|
text: `UrbanDictionary • ${context.application.name}`
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if(result.description) e.fields.push({
|
if(result.description) e.fields.push({
|
||||||
name: "Description",
|
name: "Description",
|
||||||
|
@ -18,7 +22,7 @@ function createUrbanPage(context, result){
|
||||||
})
|
})
|
||||||
e.fields.push({
|
e.fields.push({
|
||||||
name: "Stats",
|
name: "Stats",
|
||||||
value: `${icon("upvote")}${highlight(result.score.likes)} ${icon("downvote")}${highlight(result.score.dislikes)}\n**Author:** ${link(`https://www.urbandictionary.com/author.php?author=${result.author}`, result.author)}`,
|
value: `${icon("upvote")}${highlight(result.score.likes)} ${icon("downvote")}${highlight(result.score.dislikes)}\n**Author:** ${link(`https://www.urbandictionary.com/author.php?author=${encodeURIComponent(result.author)}`, result.author)}`,
|
||||||
inline: true
|
inline: true
|
||||||
})
|
})
|
||||||
if(result.example) e.fields.push({
|
if(result.example) e.fields.push({
|
||||||
|
@ -26,7 +30,6 @@ function createUrbanPage(context, result){
|
||||||
value: result.example.substr(0, 1023),
|
value: result.example.substr(0, 1023),
|
||||||
inline: false
|
inline: false
|
||||||
})
|
})
|
||||||
console.log(JSON.stringify(e))
|
|
||||||
let res = {"embeds": [e]}
|
let res = {"embeds": [e]}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +63,6 @@ module.exports = {
|
||||||
});
|
});
|
||||||
}catch(e){
|
}catch(e){
|
||||||
console.log(e)
|
console.log(e)
|
||||||
console.log(JSON.stringify(e.errors, null, 2))
|
|
||||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform google search.`)]})
|
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform google search.`)]})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
const { Hosts } = require('../api/endpoints')
|
const { Hosts } = require('../api/endpoints')
|
||||||
|
|
||||||
|
// Add static brand icons here
|
||||||
|
// Update the revision id to break discord cache
|
||||||
const Statics = Object.freeze({
|
const Statics = Object.freeze({
|
||||||
brands: {
|
brands: {
|
||||||
photofunia: {
|
photofunia: {
|
||||||
|
@ -29,6 +31,10 @@ const Statics = Object.freeze({
|
||||||
youtube: {
|
youtube: {
|
||||||
file: "brands/youtube.png",
|
file: "brands/youtube.png",
|
||||||
revision: 1
|
revision: 1
|
||||||
|
},
|
||||||
|
urbandictionary: {
|
||||||
|
file: "brands/urbandictionary.png",
|
||||||
|
revision: 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -44,5 +50,6 @@ module.exports.STATICS = Object.freeze({
|
||||||
google: staticAsset(Statics.brands.google),
|
google: staticAsset(Statics.brands.google),
|
||||||
wolframalpha: staticAsset(Statics.brands.wolframalpha),
|
wolframalpha: staticAsset(Statics.brands.wolframalpha),
|
||||||
inferkit: staticAsset(Statics.brands.inferkit),
|
inferkit: staticAsset(Statics.brands.inferkit),
|
||||||
youtube: staticAsset(Statics.brands.youtube)
|
youtube: staticAsset(Statics.brands.youtube),
|
||||||
|
urbandictionary: staticAsset(Statics.brands.urbandictionary)
|
||||||
})
|
})
|
Loading…
Add table
Add a link
Reference in a new issue