mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-14 17:13:05 -04:00
adds incognito mode, fixes /emoji
This commit is contained in:
parent
fbdf212151
commit
e61a604b7c
36 changed files with 401 additions and 127 deletions
|
@ -1,11 +1,12 @@
|
|||
const { googleImages } = require('#api');
|
||||
const { paginator } = require('#client');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { editOrReply } = require('#utils/message')
|
||||
const { STATICS } = require('#utils/statics')
|
||||
|
||||
const { ApplicationCommandOptionTypes, InteractionCallbackTypes } = require('detritus-client/lib/constants');
|
||||
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
|
||||
|
||||
// TODO: create a favicon() util
|
||||
function createImageResultPage(context, result) {
|
||||
|
@ -46,10 +47,17 @@ module.exports = {
|
|||
description: 'Image search query.',
|
||||
type: ApplicationCommandOptionTypes.TEXT,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'incognito',
|
||||
description: 'Makes the response only visible to you.',
|
||||
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
],
|
||||
run: async (context, args) => {
|
||||
await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
await acknowledge(context, args.incognito);
|
||||
|
||||
try {
|
||||
let search = await googleImages(context, args.query, false) //safesearch is always on
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
const { google } = require('#api');
|
||||
const { paginator } = require('#client');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { link, citation } = require('#utils/markdown')
|
||||
const { editOrReply } = require('#utils/message')
|
||||
const { STATICS } = require('#utils/statics')
|
||||
|
||||
const { ApplicationCommandOptionTypes, InteractionCallbackTypes } = require('detritus-client/lib/constants');
|
||||
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
|
||||
|
||||
// TODO: create a favicon() util
|
||||
function createSearchResultPage(context, result){
|
||||
|
@ -71,10 +72,17 @@ module.exports = {
|
|||
description: 'Google search query.',
|
||||
type: ApplicationCommandOptionTypes.TEXT,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'incognito',
|
||||
description: 'Makes the response only visible to you.',
|
||||
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
],
|
||||
run: async (context, args) => {
|
||||
await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
await acknowledge(context, args.incognito);
|
||||
|
||||
try{
|
||||
let search = await google(context, args.query, false) // safe search is always on
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
const { lyrics } = require('#api');
|
||||
const { paginator } = require('#client');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { smallIconPill } = require('#utils/markdown');
|
||||
const { editOrReply } = require('#utils/message')
|
||||
const { STATICS } = require('#utils/statics')
|
||||
|
||||
const { ApplicationCommandOptionTypes, InteractionCallbackTypes } = require('detritus-client/lib/constants');
|
||||
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
|
||||
|
||||
const META_FIELDS = {
|
||||
"Album": "stat_videos",
|
||||
|
@ -56,10 +57,17 @@ module.exports = {
|
|||
description: 'Song name or partial lyrics.',
|
||||
type: ApplicationCommandOptionTypes.TEXT,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'incognito',
|
||||
description: 'Makes the response only visible to you.',
|
||||
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
],
|
||||
run: async (context, args) => {
|
||||
await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
await acknowledge(context, args.incognito);
|
||||
|
||||
try{
|
||||
let search = await lyrics(context, args.query)
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
const { wolframAlpha } = require('#api');
|
||||
const { paginator } = require('#client');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { citation } = require('#utils/markdown');
|
||||
const { editOrReply } = require('#utils/message')
|
||||
const { STATICS } = require('#utils/statics')
|
||||
|
||||
const { ApplicationCommandOptionTypes, InteractionCallbackTypes } = require('detritus-client/lib/constants');
|
||||
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
|
||||
|
||||
function createWolframPage(context, pod, query, sources) {
|
||||
let res = page(createEmbed("default", context, {
|
||||
|
@ -56,10 +57,17 @@ module.exports = {
|
|||
description: 'Computational Query.',
|
||||
type: ApplicationCommandOptionTypes.TEXT,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'incognito',
|
||||
description: 'Makes the response only visible to you.',
|
||||
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
],
|
||||
run: async (context, args) => {
|
||||
await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
await acknowledge(context, args.incognito);
|
||||
|
||||
try {
|
||||
let search = await wolframAlpha(context, args.query)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
const { paginator } = require('#client');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { editOrReply } = require('#utils/message')
|
||||
|
||||
const { ApplicationCommandOptionTypes, InteractionCallbackTypes } = require('detritus-client/lib/constants');
|
||||
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
|
||||
|
||||
const superagent = require('superagent')
|
||||
|
||||
|
@ -24,10 +25,17 @@ module.exports = {
|
|||
description: 'Search query, can be a title, words from the comic, etc.',
|
||||
type: ApplicationCommandOptionTypes.TEXT,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'incognito',
|
||||
description: 'Makes the response only visible to you.',
|
||||
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
],
|
||||
run: async (context, args) => {
|
||||
await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
await acknowledge(context, args.incognito);
|
||||
|
||||
if(!isNaN(parseInt(args.query))){
|
||||
try{
|
||||
|
|
|
@ -2,11 +2,14 @@ const { youtube } = require('#api');
|
|||
const { paginator } = require('#client');
|
||||
const { YOUTUBE_CATEGORIES } = require('#constants');
|
||||
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed')
|
||||
const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed');
|
||||
const { acknowledge } = require('#utils/interactions');
|
||||
const { link, iconPill } = require('#utils/markdown')
|
||||
const { editOrReply } = require('#utils/message')
|
||||
const { STATICS } = require('#utils/statics')
|
||||
|
||||
const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants');
|
||||
|
||||
// TODO: Move this to a numbers utility
|
||||
// https://www.html-code-generator.com/javascript/shorten-long-numbers
|
||||
const intToString = num => {
|
||||
|
@ -106,8 +109,6 @@ function createYoutubePage(context, result){
|
|||
return res;
|
||||
}
|
||||
|
||||
const { ApplicationCommandOptionTypes, InteractionCallbackTypes } = require('detritus-client/lib/constants');
|
||||
|
||||
module.exports = {
|
||||
name: 'youtube',
|
||||
description: 'Search for videos on YouTube.',
|
||||
|
@ -126,8 +127,12 @@ module.exports = {
|
|||
type: ApplicationCommandOptionTypes.STRING,
|
||||
required: true
|
||||
},
|
||||
{name: 'type', default: 'all', type: 'string', help: `Video Category`},
|
||||
|
||||
{
|
||||
name: 'type',
|
||||
default: 'all',
|
||||
type: 'string',
|
||||
help: `Video Category`
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
description: 'Type of videos to search.',
|
||||
|
@ -166,10 +171,17 @@ module.exports = {
|
|||
name: "News"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'incognito',
|
||||
description: 'Makes the response only visible to you.',
|
||||
type: ApplicationCommandOptionTypes.BOOLEAN,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
],
|
||||
run: async (context, args) => {
|
||||
await context.respond({data: {}, type: InteractionCallbackTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE})
|
||||
await acknowledge(context, args.incognito);
|
||||
|
||||
try{
|
||||
if(!args.type) args.type="all"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue