mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-09 22:53:06 -04:00
major cleanup
This commit is contained in:
parent
ddd918470e
commit
a8cf49e31e
60 changed files with 537 additions and 619 deletions
|
@ -21,13 +21,13 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context) => {
|
||||
context.triggerTyping();
|
||||
if (!context.message.messageReference) return editOrReply(context, { embeds: [createEmbed("warning", context, "You need to reply to a message containing a song link.")] })
|
||||
if (!context.message.messageReference) return editOrReply(context, createEmbed("warning", context, "You need to reply to a message containing a song link."))
|
||||
try {
|
||||
let msg;
|
||||
try {
|
||||
msg = await context.message.channel.fetchMessage(context.message.messageReference.messageId)
|
||||
} catch (e) {
|
||||
return editOrReply(context, { embeds: [createEmbed("error", context, "Unable to fetch message.")] })
|
||||
return editOrReply(context, createEmbed("error", context, "Unable to fetch message."))
|
||||
}
|
||||
let urls = msg.content.match(urlr)
|
||||
if (urls) {
|
||||
|
@ -54,7 +54,7 @@ module.exports = {
|
|||
}
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return editOrReply(context, { embeds: [createEmbed("error", context, `Unable to perform song search.`)] })
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform song search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
||||
|
@ -7,26 +7,23 @@ const { bingImages } = require('../../../labscore/api');
|
|||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
function createImageResultPage(context, result){
|
||||
let res = {
|
||||
"embeds": [
|
||||
createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: `https://www.google.com/s2/favicons?domain=${encodeURIComponent(result.url)}&sz=256`,
|
||||
name: result.title,
|
||||
url: result.url
|
||||
},
|
||||
image: {
|
||||
url: result.image
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.bing,
|
||||
text: `Microsoft Bing • ${context.application.name}`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
if(result.thumbnail) res.embeds[0].thumbnail = { url: result.thumbnail };
|
||||
function createImageResultPage(context, result) {
|
||||
let res = page(
|
||||
createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: `https://www.google.com/s2/favicons?domain=${encodeURIComponent(result.url)}&sz=256`,
|
||||
name: result.title,
|
||||
url: result.url
|
||||
},
|
||||
image: {
|
||||
url: result.image
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.bing,
|
||||
text: `Microsoft Bing • ${context.application.name}`
|
||||
}
|
||||
}))
|
||||
if (result.thumbnail) res.embeds[0].thumbnail = { url: result.thumbnail };
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -44,28 +41,27 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
try{
|
||||
if (!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try {
|
||||
let search = await bingImages(context, args.query, context.channel.nsfw)
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]})
|
||||
|
||||
|
||||
if (search.body.status == 2) return editOrReply(context, createEmbed("error", context, search.body.message))
|
||||
|
||||
let pages = []
|
||||
for(const res of search.body.results){
|
||||
for (const res of search.body.results) {
|
||||
pages.push(createImageResultPage(context, res))
|
||||
}
|
||||
|
||||
if(!pages.length) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]})
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
|
||||
if (!pages.length) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform bing search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform bing search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -108,12 +108,12 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
if(!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try{
|
||||
let search = await bing(context, args.query, context.channel.nsfw)
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]})
|
||||
if(search.body.status == 2) return editOrReply(context, createEmbed("error", context, search.body.message))
|
||||
|
||||
let pages = []
|
||||
for(const res of search.body.results){
|
||||
|
@ -121,16 +121,15 @@ module.exports = {
|
|||
if(sp) pages.push(sp)
|
||||
}
|
||||
|
||||
if(!pages.length) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]})
|
||||
if(!pages.length) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform bing search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform bing search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
||||
|
@ -7,26 +7,22 @@ const { googleImages } = require('../../../labscore/api');
|
|||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
function createImageResultPage(context, result){
|
||||
let res = {
|
||||
"embeds": [
|
||||
createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: `https://www.google.com/s2/favicons?domain=${encodeURIComponent(result.url)}&sz=256`,
|
||||
name: result.title,
|
||||
url: result.url
|
||||
},
|
||||
image: {
|
||||
url: result.image
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.google,
|
||||
text: `Google Images • ${context.application.name}`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
if(result.thumbnail) res.embeds[0].thumbnail = { url: result.thumbnail };
|
||||
function createImageResultPage(context, result) {
|
||||
let res = page(createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: `https://www.google.com/s2/favicons?domain=${encodeURIComponent(result.url)}&sz=256`,
|
||||
name: result.title,
|
||||
url: result.url
|
||||
},
|
||||
image: {
|
||||
url: result.image
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.google,
|
||||
text: `Google Images • ${context.application.name}`
|
||||
}
|
||||
}))
|
||||
if (result.thumbnail) res.embeds[0].thumbnail = { url: result.thumbnail };
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -44,28 +40,27 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
try{
|
||||
if (!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try {
|
||||
let search = await googleImages(context, args.query, context.channel.nsfw)
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]})
|
||||
|
||||
if (search.body.status == 2) return editOrReply(context, createEmbed("error", context, search.body.message))
|
||||
|
||||
let pages = []
|
||||
for(const res of search.body.results){
|
||||
for (const res of search.body.results) {
|
||||
pages.push(createImageResultPage(context, res))
|
||||
}
|
||||
|
||||
if(!pages.length) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]})
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
|
||||
if (!pages.length) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform google search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform google search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -67,28 +67,27 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
if(!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try{
|
||||
let search = await google(context, args.query, context.channel.nsfw)
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]})
|
||||
if(search.body.status == 2) return editOrReply(context, createEmbed("error", context, search.body.message))
|
||||
|
||||
let pages = []
|
||||
for(const res of search.body.results){
|
||||
pages.push(createSearchResultPage(context, res))
|
||||
}
|
||||
|
||||
if(!pages.length) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]})
|
||||
if(!pages.length) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform google search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform google search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
||||
|
@ -52,12 +52,12 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
if(!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try{
|
||||
let search = await lyrics(context, args.query)
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]})
|
||||
if(search.body.status == 2) return editOrReply(context, createEmbed("error", context, search.body.message))
|
||||
let fields = [];
|
||||
|
||||
for(const f of search.body.lyrics.split('\n\n')){
|
||||
|
@ -78,18 +78,17 @@ module.exports = {
|
|||
pageFields = pageFields.splice(0, pageFields.length - 1)
|
||||
}
|
||||
|
||||
pages.push({embeds:[createLyricsPage(context, search, pageFields)]})
|
||||
pages.push(page(createLyricsPage(context, search, pageFields)))
|
||||
}
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
if(e.response?.body?.status && e.response.body.status == 2 && e.response.body.message) return editOrReply(context, {embeds:[createEmbed("error", context, e.response.body.message)]})
|
||||
if(e.response?.body?.status && e.response.body.status == 2 && e.response.body.message) return editOrReply(context, createEmbed("error", context, e.response.body.message))
|
||||
console.log(JSON.stringify(e.raw))
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Something went wrong.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Something went wrong.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { link, pill } = require('../../../labscore/utils/markdown')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
@ -10,32 +10,29 @@ const { Components } = require('detritus-client/lib/utils');
|
|||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
function createQuoraAnswerPage(context, question, answer){
|
||||
function createQuoraAnswerPage(context, question, answer) {
|
||||
let tags = question.tags.map((t) => {
|
||||
return pill(t)
|
||||
})
|
||||
let res = {
|
||||
"embeds": [
|
||||
createEmbed("default", context, {
|
||||
title: question.title,
|
||||
url: answer.url,
|
||||
description: `${tags.splice(0, 3).join(' ')}\n\n${answer.content.substr(0,2000)}`,
|
||||
footer: {
|
||||
iconUrl: STATICS.quora,
|
||||
text: `Quora • ${context.application.name}`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
let res = page(
|
||||
createEmbed("default", context, {
|
||||
title: question.title,
|
||||
url: answer.url,
|
||||
description: `${tags.splice(0, 3).join(' ')}\n\n${answer.content.substr(0, 2000)}`,
|
||||
footer: {
|
||||
iconUrl: STATICS.quora,
|
||||
text: `Quora • ${context.application.name}`
|
||||
}
|
||||
}))
|
||||
|
||||
if(answer.content.length >= 2000){
|
||||
if(res.embeds[0].description.endsWith(' ')) res.embeds[0].description = res.embeds[0].description.substr(0,res.embeds[0].description.length - 1)
|
||||
if (answer.content.length >= 2000) {
|
||||
if (res.embeds[0].description.endsWith(' ')) res.embeds[0].description = res.embeds[0].description.substr(0, res.embeds[0].description.length - 1)
|
||||
res.embeds[0].description += link(answer.url, '...', 'Click to read the entire answer.')
|
||||
}
|
||||
|
||||
if(answer.author){
|
||||
if (answer.author) {
|
||||
res.embeds[0].author = {
|
||||
name: answer.author.name.substr(0,1000),
|
||||
name: answer.author.name.substr(0, 1000),
|
||||
iconUrl: answer.author.icon,
|
||||
url: answer.author.url
|
||||
}
|
||||
|
@ -43,7 +40,7 @@ function createQuoraAnswerPage(context, question, answer){
|
|||
return res;
|
||||
}
|
||||
|
||||
async function quoraPaginator(context, pages, refMappings, currentRef){
|
||||
async function quoraPaginator(context, pages, refMappings, currentRef) {
|
||||
const paging = await paginator.createPaginator({
|
||||
context,
|
||||
pages,
|
||||
|
@ -55,7 +52,7 @@ async function quoraPaginator(context, pages, refMappings, currentRef){
|
|||
});
|
||||
|
||||
paging.on("interaction", async ({ context: ctx, listener }) => {
|
||||
if(ctx.customId == "search"){
|
||||
if (ctx.customId == "search") {
|
||||
// Kill the original paginator and replace it with a select
|
||||
listener.stopWithoutUpdate()
|
||||
|
||||
|
@ -74,26 +71,26 @@ async function quoraPaginator(context, pages, refMappings, currentRef){
|
|||
// Get the page reference and fetch the results
|
||||
let ref = refMappings.filter((r) => r.ref == sctx.data.values[0])
|
||||
ref = ref[0]
|
||||
try{
|
||||
try {
|
||||
let search = await quoraResult(context, ref.link)
|
||||
search = search.response.body
|
||||
|
||||
if(search.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.message)]})
|
||||
|
||||
|
||||
if (search.status == 2) return editOrReply(context, createEmbed("error", context, search.message))
|
||||
|
||||
let nextPages = []
|
||||
// Create the initial page
|
||||
|
||||
for(const answer of search.answers){
|
||||
|
||||
for (const answer of search.answers) {
|
||||
nextPages.push(createQuoraAnswerPage(context, search.question, answer))
|
||||
}
|
||||
|
||||
|
||||
nextPages = formatPaginationEmbeds(nextPages)
|
||||
|
||||
|
||||
await quoraPaginator(context, nextPages, refMappings, sctx.data.values[0])
|
||||
|
||||
}catch(e){
|
||||
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform quora search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform quora search.`))
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -112,7 +109,7 @@ async function quoraPaginator(context, pages, refMappings, currentRef){
|
|||
options: selectOptions
|
||||
})
|
||||
|
||||
await ctx.editOrRespond({content: `<@${context.userId}> Select a question.`, components})
|
||||
await ctx.editOrRespond({ content: `<@${context.userId}> Select a question.`, components })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -131,29 +128,29 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
try{
|
||||
if (!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try {
|
||||
let search = await quora(context, args.query)
|
||||
search = search.response.body
|
||||
|
||||
if(search.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.message)]})
|
||||
|
||||
|
||||
if (search.status == 2) return editOrReply(context, createEmbed("error", context, search.message))
|
||||
|
||||
let pages = []
|
||||
|
||||
// Create the initial page
|
||||
for(const answer of search.answers){
|
||||
for (const answer of search.answers) {
|
||||
pages.push(createQuoraAnswerPage(context, search.question, answer))
|
||||
}
|
||||
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
|
||||
const refMappings = search.results
|
||||
|
||||
await quoraPaginator(context, pages, refMappings, refMappings[0].ref)
|
||||
|
||||
}catch(e){
|
||||
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform quora search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform quora search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
const { link, icon, highlight, iconPill } = require('../../../labscore/utils/markdown')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { link, icon, iconPill } = require('../../../labscore/utils/markdown')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
||||
|
@ -8,24 +8,20 @@ const { reddit } = require('../../../labscore/api');
|
|||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
function createRedditPage(context, result){
|
||||
let res = {
|
||||
"embeds": [
|
||||
createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: result.subreddit.icon,
|
||||
name: result.subreddit.name,
|
||||
url: result.subreddit.link
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.reddit,
|
||||
text: `Reddit • ${context.application.name}`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
function createRedditPage(context, result) {
|
||||
let res = page(createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: result.subreddit.icon,
|
||||
name: result.subreddit.name,
|
||||
url: result.subreddit.link
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.reddit,
|
||||
text: `Reddit • ${context.application.name}`
|
||||
}
|
||||
}))
|
||||
|
||||
if(result.post.image) res.embeds[0].image = { url: result.post.image };
|
||||
if (result.post.image) res.embeds[0].image = { url: result.post.image };
|
||||
|
||||
let description = [`**${link(result.post.link, result.post.title)}**`]
|
||||
|
||||
|
@ -35,7 +31,7 @@ function createRedditPage(context, result){
|
|||
// awardData.push(`${icon(`reddit_${a}`)}${highlight(result.awards[a])}`)
|
||||
//}
|
||||
|
||||
if(awardData.length >= 1) description.push(`${awardData.join(' ')}`)
|
||||
if (awardData.length >= 1) description.push(`${awardData.join(' ')}`)
|
||||
|
||||
description.push(``)
|
||||
description.push(`${iconPill("upvote", result.post.score)} ${icon("user")} ${link(result.author.link, `u/${result.author.name}`)}`)
|
||||
|
@ -61,30 +57,29 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
try{
|
||||
if (!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try {
|
||||
let search = await reddit(context, args.query, context.channel.nsfw)
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]})
|
||||
|
||||
if (search.body.status == 2) return editOrReply(context, createEmbed("error", context, search.body.message))
|
||||
|
||||
let pages = []
|
||||
for(const res of search.body.results){
|
||||
if(args.type == "image" && !res.post.image) continue;
|
||||
for (const res of search.body.results) {
|
||||
if (args.type == "image" && !res.post.image) continue;
|
||||
pages.push(createRedditPage(context, res))
|
||||
}
|
||||
|
||||
if(pages.length == 0) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found.`)]})
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
if (pages.length == 0) return editOrReply(context, createEmbed("warning", context, `No results found.`))
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
if(e.response && e.response.body.message) return editOrReply(context, {embeds:[createEmbed("error", context, e.response.body.message)]})
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform reddit search.`)]})
|
||||
if (e.response && e.response.body.message) return editOrReply(context, createEmbed("error", context, e.response.body.message))
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform reddit search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
const { getRecentImage } = require("../../../labscore/utils/attachment");
|
||||
|
@ -8,35 +8,32 @@ const { reverseImageSearch } = require('../../../labscore/api');
|
|||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
function createReverseImageSearchResultPage(context, result, source){
|
||||
let res = {
|
||||
"embeds": [
|
||||
createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: `https://www.google.com/s2/favicons?domain=${encodeURIComponent(result.url)}&sz=256`,
|
||||
name: result.name,
|
||||
url: result.url
|
||||
},
|
||||
image: {
|
||||
url: result.image
|
||||
},
|
||||
thumbnail: {
|
||||
url: source
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.google,
|
||||
text: `Google Cloud Vision • ${context.application.name}`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
if(result.thumbnail) res.embeds[0].thumbnail = { url: result.thumbnail };
|
||||
function createReverseImageSearchResultPage(context, result, source) {
|
||||
let res = page(
|
||||
createEmbed("default", context, {
|
||||
author: {
|
||||
iconUrl: `https://www.google.com/s2/favicons?domain=${encodeURIComponent(result.url)}&sz=256`,
|
||||
name: result.name,
|
||||
url: result.url
|
||||
},
|
||||
image: {
|
||||
url: result.image
|
||||
},
|
||||
thumbnail: {
|
||||
url: source
|
||||
},
|
||||
footer: {
|
||||
iconUrl: STATICS.google,
|
||||
text: `Google Cloud Vision • ${context.application.name}`
|
||||
}
|
||||
}))
|
||||
if (result.thumbnail) res.embeds[0].thumbnail = { url: result.thumbnail };
|
||||
return res;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'reverse-image',
|
||||
aliases: ['reverse','reverseimage'],
|
||||
aliases: ['reverse', 'reverseimage'],
|
||||
metadata: {
|
||||
description: 'Performs a reverse-image-search.',
|
||||
description_short: 'Reverse image search',
|
||||
|
@ -46,28 +43,27 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context) => {
|
||||
context.triggerTyping();
|
||||
try{
|
||||
try {
|
||||
let image = await getRecentImage(context, 50)
|
||||
if(!image) return editOrReply(context, { embeds: [createEmbed("warning", context, "No images found.")] })
|
||||
if (!image) return editOrReply(context, createEmbed("warning", context, "No images found."))
|
||||
|
||||
let search = await reverseImageSearch(context, image)
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message)]})
|
||||
|
||||
if (search.body.status == 2) return editOrReply(context, createEmbed("error", context, search.body.message))
|
||||
|
||||
let pages = []
|
||||
for(const res of search.body.results){
|
||||
for (const res of search.body.results) {
|
||||
pages.push(createReverseImageSearchResultPage(context, res, image))
|
||||
}
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform reverse image search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform reverse image search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { pill } = require('../../../labscore/utils/markdown')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
|
||||
|
@ -7,26 +7,22 @@ const { rule34 } = require('../../../labscore/api');
|
|||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
function createRule34Page(context, result){
|
||||
let res = {
|
||||
"embeds": [
|
||||
createEmbed("default", context, {
|
||||
description: '',
|
||||
image: {
|
||||
url: result.fileUrl
|
||||
},
|
||||
footer: {
|
||||
text: `Rating: ${result.rating}`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
|
||||
function createRule34Page(context, result) {
|
||||
let res = page(createEmbed("default", context, {
|
||||
description: '',
|
||||
image: {
|
||||
url: result.fileUrl
|
||||
},
|
||||
footer: {
|
||||
text: `Rating: ${result.rating}`
|
||||
}
|
||||
}))
|
||||
|
||||
// Render a few tags
|
||||
if(result.tags) {
|
||||
if (result.tags) {
|
||||
let tags = result.tags.splice(0, 5)
|
||||
let tagDisplay = ''
|
||||
for(const t of tags) tagDisplay += pill(t)
|
||||
for (const t of tags) tagDisplay += pill(t)
|
||||
res.embeds[0].description += `\n${tagDisplay}`
|
||||
}
|
||||
|
||||
|
@ -56,39 +52,38 @@ module.exports = {
|
|||
usage: 'rule34 <query> [-site <service>]'
|
||||
},
|
||||
args: [
|
||||
{name: 'site', default: 'rule34', type: 'string', help: `Site to search on \` ${Object.keys(SITES).join(', ')} \``}
|
||||
{ name: 'site', default: 'rule34', type: 'string', help: `Site to search on \` ${Object.keys(SITES).join(', ')} \`` }
|
||||
],
|
||||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
|
||||
// very important, maybe make this a command option eventually
|
||||
if(!context.channel.nsfw){
|
||||
return editOrReply(context, {embeds:[createEmbed("nsfw", context)]})
|
||||
if (!context.channel.nsfw) {
|
||||
return editOrReply(context, createEmbed("nsfw", context))
|
||||
}
|
||||
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
if(!Object.keys(SITES).includes(args.site.toLowerCase())) return editOrReply(context, {embeds:[createEmbed("warning", context, `Invalid site type.`)]})
|
||||
try{
|
||||
if (!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
if (!Object.keys(SITES).includes(args.site.toLowerCase())) return editOrReply(context, createEmbed("warning", context, `Invalid site type.`))
|
||||
try {
|
||||
let search = await rule34(context, args.query, args.site.toLowerCase())
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 2) return editOrReply(context, {embeds:[createEmbed("error", context, search.body.message )]})
|
||||
if(search.body.data.length == 0) return editOrReply(context, {embeds:[createEmbed("warning", context, `No results found on ${SITES[args.site.toLowerCase()]}.`)]})
|
||||
|
||||
if (search.body.status == 2) return editOrReply(context, createEmbed("error", context, search.body.message))
|
||||
if (search.body.data.length == 0) return editOrReply(context, createEmbed("warning", context, `No results found on ${SITES[args.site.toLowerCase()]}.`))
|
||||
|
||||
let pages = []
|
||||
for(const res of search.body.data){
|
||||
for (const res of search.body.data) {
|
||||
pages.push(createRule34Page(context, res))
|
||||
}
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform rule34 search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform rule34 search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,4 +1,4 @@
|
|||
const { createEmbed, formatPaginationEmbeds } = require('../../../labscore/utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { link, iconPill } = require('../../../labscore/utils/markdown')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
@ -32,8 +32,7 @@ function createUrbanPage(context, result){
|
|||
value: result.example.substr(0, 1023),
|
||||
inline: false
|
||||
})
|
||||
let res = {"embeds": [e]}
|
||||
return res;
|
||||
return page(e);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -61,14 +60,13 @@ module.exports = {
|
|||
pages.push(createUrbanPage(context, res))
|
||||
}
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform urban dictionary search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform urban dictionary search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -22,8 +22,7 @@ function createWikiHowPage(context, result){
|
|||
if(result.image) e.image = {
|
||||
url: result.image
|
||||
}
|
||||
let res = {"embeds": [e]}
|
||||
return res;
|
||||
return page(e);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -46,20 +45,19 @@ module.exports = {
|
|||
|
||||
let pages = []
|
||||
|
||||
if(search.body.data.length == 0) return editOrReply(context, {embeds:[createEmbed("error", context, `No results found.`)]})
|
||||
if(search.body.data.length == 0) return editOrReply(context, createEmbed("error", context, `No results found.`))
|
||||
|
||||
for(const res of search.body.data){
|
||||
pages.push(createWikiHowPage(context, res))
|
||||
}
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform wikihow search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform wikihow search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -8,25 +8,6 @@ const superagent = require('superagent')
|
|||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
function createWikiHowPage(context, result){
|
||||
let e = createEmbed("default", context, {
|
||||
author: {
|
||||
name: result.title,
|
||||
url: result.link
|
||||
},
|
||||
description: result.snippet,
|
||||
footer: {
|
||||
iconUrl: STATICS.wikihow,
|
||||
text: `WikiHow • ${context.application.name}`
|
||||
}
|
||||
})
|
||||
if(result.image) e.image = {
|
||||
url: result.image
|
||||
}
|
||||
let res = {"embeds": [e]}
|
||||
return res;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: 'wikipedia',
|
||||
label: 'query',
|
||||
|
@ -51,7 +32,7 @@ module.exports = {
|
|||
|
||||
let pages = []
|
||||
|
||||
if(!search.body.pages.length) return editOrReply(context, {embeds:[createEmbed("error", context, `No results found.`)]})
|
||||
if(!search.body.pages.length) return editOrReply(context, createEmbed("error", context, `No results found.`))
|
||||
|
||||
for(const res of Object.values(search.body.pages)){
|
||||
let p = createEmbed("default", context, {
|
||||
|
@ -74,14 +55,13 @@ module.exports = {
|
|||
pages.push(page(p))
|
||||
}
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform wikipedia search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform wikipedia search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -8,38 +8,34 @@ const { citation } = require('../../../labscore/utils/markdown');
|
|||
|
||||
const { Permissions } = require("detritus-client/lib/constants");
|
||||
|
||||
function createWolframPage(context, pod, query, sources){
|
||||
let res = {
|
||||
"embeds": [
|
||||
createEmbed("default", context, {
|
||||
author: {
|
||||
name: pod.title,
|
||||
url: `https://www.wolframalpha.com/input?i=${encodeURIComponent(query)}`
|
||||
},
|
||||
description: undefined,
|
||||
footer: {
|
||||
iconUrl: STATICS.wolframalpha,
|
||||
text: `Wolfram|Alpha • ${context.application.name}`
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
if(pod.icon) res.embeds[0].author.iconUrl = pod.icon
|
||||
if(pod.value) res.embeds[0].description = pod.value.substr(0,1000)
|
||||
if(pod.value && pod.refs) {
|
||||
for(const r of pod.refs){
|
||||
let src = Object.values(sources).filter((s)=>s.ref == r)[0]
|
||||
if(!src) continue;
|
||||
|
||||
function createWolframPage(context, pod, query, sources) {
|
||||
let res = page(createEmbed("default", context, {
|
||||
author: {
|
||||
name: pod.title,
|
||||
url: `https://www.wolframalpha.com/input?i=${encodeURIComponent(query)}`
|
||||
},
|
||||
description: undefined,
|
||||
footer: {
|
||||
iconUrl: STATICS.wolframalpha,
|
||||
text: `Wolfram|Alpha • ${context.application.name}`
|
||||
}
|
||||
}))
|
||||
if (pod.icon) res.embeds[0].author.iconUrl = pod.icon
|
||||
if (pod.value) res.embeds[0].description = pod.value.substr(0, 1000)
|
||||
if (pod.value && pod.refs) {
|
||||
for (const r of pod.refs) {
|
||||
let src = Object.values(sources).filter((s) => s.ref == r)[0]
|
||||
if (!src) continue;
|
||||
|
||||
// Only add a direct source if one is available
|
||||
if(src.collections){
|
||||
if (src.collections) {
|
||||
res.embeds[0].description += citation(r, src.url, src.title + ' | ' + src.collections[0].text)
|
||||
continue;
|
||||
}
|
||||
if(src.url) res.embeds[0].description += citation(r, src.url, src.title)
|
||||
if (src.url) res.embeds[0].description += citation(r, src.url, src.title)
|
||||
}
|
||||
}
|
||||
if(pod.image) res.embeds[0].image = { url: pod.image };
|
||||
if (pod.image) res.embeds[0].image = { url: pod.image };
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -57,26 +53,25 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
try{
|
||||
if (!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try {
|
||||
let search = await wolframAlpha(context, args.query)
|
||||
search = search.response
|
||||
|
||||
if(search.body.status == 1) return editOrReply(context, {embeds:[createEmbed("warning", context, search.body.message)]})
|
||||
|
||||
if (search.body.status == 1) return editOrReply(context, createEmbed("warning", context, search.body.message))
|
||||
|
||||
let pages = []
|
||||
for(const res of search.body.data){
|
||||
for (const res of search.body.data) {
|
||||
pages.push(createWolframPage(context, res, args.query, search.body.sources))
|
||||
}
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform Wolfram|Alpha search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform Wolfram|Alpha search.`))
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
const { createEmbed, formatPaginationEmbeds, page } = require('../../../labscore/utils/embed')
|
||||
const { link, iconPill, timestamp, smallPill } = require('../../../labscore/utils/markdown')
|
||||
const { link, iconPill, smallPill } = require('../../../labscore/utils/markdown')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
const { STATICS } = require('../../../labscore/utils/statics')
|
||||
|
||||
|
@ -124,11 +124,11 @@ module.exports = {
|
|||
permissionsClient: [Permissions.EMBED_LINKS, Permissions.SEND_MESSAGES, Permissions.USE_EXTERNAL_EMOJIS, Permissions.READ_MESSAGE_HISTORY],
|
||||
run: async (context, args) => {
|
||||
context.triggerTyping();
|
||||
if(!args.query) return editOrReply(context, {embeds:[createEmbed("warning", context, `Missing Parameter (query).`)]})
|
||||
if(!args.query) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (query).`))
|
||||
try{
|
||||
if(args.type == 'all') args.type = undefined;
|
||||
else {
|
||||
if(!YOUTUBE_CATEGORIES[args.type.toLowerCase()]) return editOrReply(context, {embeds:[createEmbed("warning", context, `Invalid Parameter (type).`)]})
|
||||
if(!YOUTUBE_CATEGORIES[args.type.toLowerCase()]) return editOrReply(context, createEmbed("warning", context, `Invalid Parameter (type).`))
|
||||
args.type = YOUTUBE_CATEGORIES[args.type.toLowerCase()]
|
||||
}
|
||||
let search = await youtube(context, args.query, args.type)
|
||||
|
@ -139,14 +139,13 @@ module.exports = {
|
|||
pages.push(createYoutubePage(context, res))
|
||||
}
|
||||
|
||||
pages = formatPaginationEmbeds(pages)
|
||||
const paging = await paginator.createPaginator({
|
||||
await paginator.createPaginator({
|
||||
context,
|
||||
pages
|
||||
pages: formatPaginationEmbeds(pages)
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
return editOrReply(context, {embeds:[createEmbed("error", context, `Unable to perform youtube search.`)]})
|
||||
return editOrReply(context, createEmbed("error", context, `Unable to perform youtube search.`))
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue