mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-10 15:13:04 -04:00
remove permission
This commit is contained in:
parent
627c0877bb
commit
db477d7a49
1 changed files with 27 additions and 26 deletions
|
@ -9,24 +9,24 @@ const { editOrReply } = require("../../../labscore/utils/message");
|
||||||
const { STATICS } = require("../../../labscore/utils/statics");
|
const { STATICS } = require("../../../labscore/utils/statics");
|
||||||
|
|
||||||
|
|
||||||
function getPerspectiveColor(score){
|
function getPerspectiveColor(score) {
|
||||||
if(score >= 0.9) return "m"
|
if (score >= 0.9) return "m"
|
||||||
if(score >= 0.76) return "r"
|
if (score >= 0.76) return "r"
|
||||||
if(score >= 0.5) return "y"
|
if (score >= 0.5) return "y"
|
||||||
return "g"
|
return "g"
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatPerspectiveScores(data){
|
function formatPerspectiveScores(data) {
|
||||||
let entries = [];
|
let entries = [];
|
||||||
let srt = [];
|
let srt = [];
|
||||||
|
|
||||||
for(const scr of Object.keys(data.scores)){
|
for (const scr of Object.keys(data.scores)) {
|
||||||
let score = data.scores[scr];
|
let score = data.scores[scr];
|
||||||
perc = `${score.toString().substr(2,2)}.${score.toString().substr(3,1)}`
|
perc = `${score.toString().substr(2, 2)}.${score.toString().substr(3, 1)}`
|
||||||
if(perc.startsWith('0')) perc = ` ${perc.substr(1, perc.length)}`
|
if (perc.startsWith('0')) perc = ` ${perc.substr(1, perc.length)}`
|
||||||
srt.push(`${data.scores[scr]}|${format(perc + '%', getPerspectiveColor(score))} ${scr.substr(0,1).toUpperCase()}${scr.substr(1,scr.length).toLowerCase().replace(/_/g, ' ')}`)
|
srt.push(`${data.scores[scr]}|${format(perc + '%', getPerspectiveColor(score))} ${scr.substr(0, 1).toUpperCase()}${scr.substr(1, scr.length).toLowerCase().replace(/_/g, ' ')}`)
|
||||||
}
|
}
|
||||||
for(const i of srt.sort().reverse()) entries.push(i.split('|')[1])
|
for (const i of srt.sort().reverse()) entries.push(i.split('|')[1])
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,30 +45,31 @@ module.exports = {
|
||||||
limit: 1,
|
limit: 1,
|
||||||
duration: 5000
|
duration: 5000
|
||||||
},
|
},
|
||||||
permissionsClient: [Permissions.MANAGE_MESSAGES],
|
|
||||||
run: async (context, args) => {
|
run: async (context, args) => {
|
||||||
await context.triggerTyping();
|
await context.triggerTyping();
|
||||||
|
|
||||||
try{
|
try {
|
||||||
let msg = '';
|
let msg = '';
|
||||||
if (context.message.messageReference) {
|
if (context.message.messageReference) {
|
||||||
msg = await context.message.channel.fetchMessage(context.message.messageReference.messageId)
|
msg = await context.message.channel.fetchMessage(context.message.messageReference.messageId)
|
||||||
args.input = msg.content
|
args.input = msg.content
|
||||||
msg = `${icon("robouser")} <@${msg.author.id}> (${msg.author.id})\n${codeblock("ansi", [ msg.content ])}\n`
|
msg = `${icon("robouser")} <@${msg.author.id}> (${msg.author.id})\n${codeblock("ansi", [msg.content])}\n`
|
||||||
}
|
}
|
||||||
|
|
||||||
let perspectiveApi = await perspective(context, [ args.input ])
|
let perspectiveApi = await perspective(context, [args.input])
|
||||||
|
|
||||||
return await editOrReply(context, { embeds: [createEmbed("default", context, {
|
return await editOrReply(context, {
|
||||||
description: `${msg}${iconPill("rules", "Scores")} ${codeblock("ansi", formatPerspectiveScores(perspectiveApi.response.body))}`,
|
embeds: [createEmbed("default", context, {
|
||||||
footer: {
|
description: `${msg}${iconPill("rules", "Scores")} ${codeblock("ansi", formatPerspectiveScores(perspectiveApi.response.body))}`,
|
||||||
iconUrl: STATICS.perspectiveapi,
|
footer: {
|
||||||
text: `Perspective • ${context.application.name}`
|
iconUrl: STATICS.perspectiveapi,
|
||||||
}
|
text: `Perspective • ${context.application.name}`
|
||||||
})] })
|
}
|
||||||
}catch(e){
|
})]
|
||||||
await editOrReply(context, { embeds: [createEmbed("error", context, `Something went wrong.`)] })
|
})
|
||||||
console.log(e)
|
} catch (e) {
|
||||||
}
|
await editOrReply(context, { embeds: [createEmbed("error", context, `Something went wrong.`)] })
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
Loading…
Add table
Add a link
Reference in a new issue