mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 13:43:06 -04:00
24 lines
No EOL
592 B
JavaScript
24 lines
No EOL
592 B
JavaScript
|
|
const { stringwrap } = require("#utils/markdown");
|
|
const superagent = require("superagent");
|
|
|
|
module.exports = async (context)=>{
|
|
let choices = [];
|
|
if(context.value){
|
|
try {
|
|
let suggestions = await superagent.get("https://api.urbandictionary.com/v0/autocomplete-extra")
|
|
.query({
|
|
term: context.value
|
|
})
|
|
|
|
choices = suggestions.body.results
|
|
}catch(e){
|
|
// idk sucks ig?
|
|
}
|
|
}
|
|
|
|
return context.respond({ choices: choices.splice(0, 20).map((l)=>({
|
|
name: `${l.term} - ${stringwrap(l.preview, 20, false)}`,
|
|
value: l.term
|
|
}))});
|
|
} |