From ad5c680f86b706ea403a2875cc94af2e1a136ec9 Mon Sep 17 00:00:00 2001 From: bignutty <3515180-bignutty@users.noreply.gitlab.com> Date: Sun, 8 Dec 2024 15:12:19 +0100 Subject: [PATCH] use proper constants for contexts and types --- commands/interaction/context/audio.js | 10 +++--- commands/interaction/context/ocr.js | 12 +++---- commands/interaction/context/reverse-image.js | 10 +++--- commands/interaction/context/transcribe.js | 10 +++--- commands/interaction/context/translate.js | 10 +++--- commands/interaction/slash/fun/otter.js | 10 +++--- commands/interaction/slash/info/avatar.js | 10 +++--- commands/interaction/slash/info/user.js | 10 +++--- .../interaction/slash/search/google-images.js | 10 +++--- commands/interaction/slash/search/google.js | 10 +++--- commands/interaction/slash/search/lyrics.js | 10 +++--- commands/interaction/slash/search/maps.js | 10 +++--- .../slash/search/urbandictionary.js | 10 +++--- .../interaction/slash/search/wolfram-alpha.js | 10 +++--- commands/interaction/slash/search/xkcd.js | 10 +++--- commands/interaction/slash/search/youtube.js | 10 +++--- .../interaction/slash/utils/dictionary.js | 10 +++--- commands/interaction/slash/utils/emoji.js | 10 +++--- .../interaction/slash/utils/emojipedia.js | 31 +++---------------- .../slash/utils/music-platforms.js | 10 +++--- commands/interaction/slash/utils/ocr.js | 10 +++--- .../interaction/slash/utils/reverse-image.js | 10 +++--- .../interaction/slash/utils/screenshot.js | 10 +++--- commands/interaction/slash/utils/translate.js | 10 +++--- commands/interaction/slash/utils/weather.js | 1 - 25 files changed, 121 insertions(+), 143 deletions(-) diff --git a/commands/interaction/context/audio.js b/commands/interaction/context/audio.js index 73400c8..5af4aa3 100644 --- a/commands/interaction/context/audio.js +++ b/commands/interaction/context/audio.js @@ -4,7 +4,7 @@ const { createEmbed } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); const { editOrReply } = require('#utils/message'); -const { ApplicationCommandTypes } = require("detritus-client/lib/constants");; +const { ApplicationCommandTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants");; const superagent = require('superagent') @@ -14,12 +14,12 @@ module.exports = { name: 'Music Platforms', type: ApplicationCommandTypes.MESSAGE, contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], run: async (context, args) => { try{ diff --git a/commands/interaction/context/ocr.js b/commands/interaction/context/ocr.js index 0adc993..0029a06 100644 --- a/commands/interaction/context/ocr.js +++ b/commands/interaction/context/ocr.js @@ -6,21 +6,21 @@ const { createEmbed } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); const { codeblock, pill, icon } = require('#utils/markdown'); const { editOrReply } = require('#utils/message'); -const { STATICS, STATIC_ICONS, STATIC_ACTIONS } = require('#utils/statics'); +const { STATICS, STATIC_ACTIONS } = require('#utils/statics'); -const { ApplicationCommandTypes, MessageFlags } = require("detritus-client/lib/constants"); +const { ApplicationCommandTypes, MessageFlags, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); const { Components } = require('detritus-client/lib/utils'); module.exports = { name: 'OCR', type: ApplicationCommandTypes.MESSAGE, contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], run: async (context, args) => { try{ diff --git a/commands/interaction/context/reverse-image.js b/commands/interaction/context/reverse-image.js index 08000e6..9f0ad4e 100644 --- a/commands/interaction/context/reverse-image.js +++ b/commands/interaction/context/reverse-image.js @@ -8,7 +8,7 @@ const { acknowledge } = require('#utils/interactions'); const { editOrReply } = require('#utils/message') const { STATICS } = require('#utils/statics') -const { ApplicationCommandTypes } = require("detritus-client/lib/constants"); +const { ApplicationCommandTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); // TODO: create a favicon() util function createReverseImageSearchResultPage(context, result, source) { @@ -38,12 +38,12 @@ module.exports = { name: 'Reverse Image Search', type: ApplicationCommandTypes.MESSAGE, contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], run: async (context, args) => { try{ diff --git a/commands/interaction/context/transcribe.js b/commands/interaction/context/transcribe.js index 918b3c3..75130c1 100644 --- a/commands/interaction/context/transcribe.js +++ b/commands/interaction/context/transcribe.js @@ -6,7 +6,7 @@ const { editOrReply } = require('#utils/message'); const { codeblock } = require('#utils/markdown'); const { STATICS } = require('#utils/statics'); -const { ApplicationCommandTypes, MessageFlags } = require("detritus-client/lib/constants"); +const { ApplicationCommandTypes, MessageFlags, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); const { PERMISSION_GROUPS } = require('#constants'); ; @@ -14,12 +14,12 @@ module.exports = { name: 'Transcribe Voice Message', type: ApplicationCommandTypes.MESSAGE, contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], run: async (context, args) => { await acknowledge(context, false, [...PERMISSION_GROUPS.baseline_slash]); diff --git a/commands/interaction/context/translate.js b/commands/interaction/context/translate.js index fe7fad3..3fdde69 100644 --- a/commands/interaction/context/translate.js +++ b/commands/interaction/context/translate.js @@ -7,19 +7,19 @@ const { codeblock, icon, pill } = require('#utils/markdown'); const { editOrReply } = require('#utils/message'); const { STATICS } = require('#utils/statics'); -const { ApplicationCommandTypes, InteractionCallbackTypes } = require("detritus-client/lib/constants"); +const { ApplicationCommandTypes, InteractionCallbackTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); const { Components } = require('detritus-client/lib/utils'); module.exports = { name: 'Translate Message', type: ApplicationCommandTypes.MESSAGE, contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], run: async (context, args) => { await acknowledge(context, false, [...PERMISSION_GROUPS.baseline_slash]); diff --git a/commands/interaction/slash/fun/otter.js b/commands/interaction/slash/fun/otter.js index 21284d9..3180762 100644 --- a/commands/interaction/slash/fun/otter.js +++ b/commands/interaction/slash/fun/otter.js @@ -5,18 +5,18 @@ const { createEmbed } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); const { editOrReply } = require('#utils/message') -const { ApplicationCommandOptionTypes } = require("detritus-client/lib/constants"); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); module.exports = { description: 'Shows a random otter picture.', name: 'otter', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/info/avatar.js b/commands/interaction/slash/info/avatar.js index 9c46221..a9c0626 100644 --- a/commands/interaction/slash/info/avatar.js +++ b/commands/interaction/slash/info/avatar.js @@ -4,18 +4,18 @@ const { acknowledge } = require('#utils/interactions'); const { editOrReply } = require('#utils/message'); const { getUserAvatar } = require('#utils/users'); -const { ApplicationCommandOptionTypes } = require("detritus-client/lib/constants"); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); module.exports = { description: 'Get someones avatar.', name: 'avatar', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/info/user.js b/commands/interaction/slash/info/user.js index 107d107..86f4b25 100644 --- a/commands/interaction/slash/info/user.js +++ b/commands/interaction/slash/info/user.js @@ -6,18 +6,18 @@ const { smallIconPill, highlight, smallPill, icon, timestamp } = require('#utils const { editOrReply } = require('#utils/message'); const { renderBadges, getUserAvatar } = require('#utils/users'); -const { ApplicationCommandOptionTypes, UserFlags } = require("detritus-client/lib/constants"); +const { ApplicationCommandOptionTypes, UserFlags, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); module.exports = { description: 'Displays information about a user', name: 'user', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/search/google-images.js b/commands/interaction/slash/search/google-images.js index ed70eb1..b2cba0a 100644 --- a/commands/interaction/slash/search/google-images.js +++ b/commands/interaction/slash/search/google-images.js @@ -7,7 +7,7 @@ const { acknowledge } = require('#utils/interactions'); const { editOrReply } = require('#utils/message') const { STATICS } = require('#utils/statics') -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); // TODO: create a favicon() util function createImageResultPage(context, result) { @@ -35,12 +35,12 @@ module.exports = { aliases: ['i', 'img'], description: 'Search the web for images on Google.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/search/google.js b/commands/interaction/slash/search/google.js index ddc6c9e..66ce515 100644 --- a/commands/interaction/slash/search/google.js +++ b/commands/interaction/slash/search/google.js @@ -9,7 +9,7 @@ const { link, citation, icon, smallPill, pill, codeblock } = require('#utils/mar const { editOrReply } = require('#utils/message') const { STATICS } = require('#utils/statics') -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); function renderFooter(context, doodle){ if(doodle.super_g) return { @@ -238,12 +238,12 @@ module.exports = { name: 'google', description: 'Search Google for websites.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/search/lyrics.js b/commands/interaction/slash/search/lyrics.js index 1a26520..03fe8f3 100644 --- a/commands/interaction/slash/search/lyrics.js +++ b/commands/interaction/slash/search/lyrics.js @@ -8,7 +8,7 @@ const { smallIconPill } = require('#utils/markdown'); const { editOrReply } = require('#utils/message') const { STATICS } = require('#utils/statics') -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); const META_FIELDS = { "Album": "stat_videos", @@ -71,12 +71,12 @@ module.exports = { name: 'lyrics', description: 'Search for song lyrics.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/search/maps.js b/commands/interaction/slash/search/maps.js index 442f60c..0a68cda 100644 --- a/commands/interaction/slash/search/maps.js +++ b/commands/interaction/slash/search/maps.js @@ -6,8 +6,8 @@ const { acknowledge } = require('#utils/interactions'); const { link, icon, iconAsEmojiObject, citation } = require('#utils/markdown'); const { editOrReply } = require('#utils/message') const { STATICS, STATIC_ASSETS } = require('#utils/statics'); -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); const { Components } = require('detritus-client/lib/utils'); function renderPlaceCard(context, place) { @@ -85,12 +85,12 @@ module.exports = { name: 'maps', description: 'Search for places on Google Maps.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/search/urbandictionary.js b/commands/interaction/slash/search/urbandictionary.js index eca3e76..d86bcd2 100644 --- a/commands/interaction/slash/search/urbandictionary.js +++ b/commands/interaction/slash/search/urbandictionary.js @@ -8,7 +8,7 @@ const { link, iconPill } = require('#utils/markdown') const { editOrReply } = require('#utils/message') const { STATICS } = require('#utils/statics') -const { ApplicationCommandOptionTypes } = require("detritus-client/lib/constants"); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); function createUrbanPage(context, result){ let e = createEmbed("default", context, { @@ -41,12 +41,12 @@ module.exports = { name: 'urbandictionary', description: 'Define a word on urban dictionary.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/search/wolfram-alpha.js b/commands/interaction/slash/search/wolfram-alpha.js index b8187fd..8585024 100644 --- a/commands/interaction/slash/search/wolfram-alpha.js +++ b/commands/interaction/slash/search/wolfram-alpha.js @@ -8,7 +8,7 @@ const { citation } = require('#utils/markdown'); const { editOrReply } = require('#utils/message') const { STATICS } = require('#utils/statics') -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); function createWolframPage(context, pod, query, sources) { let res = page(createEmbed("default", context, { @@ -45,12 +45,12 @@ module.exports = { name: 'wolframalpha', description: 'Compute a query via Wolfram|Alpha.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/search/xkcd.js b/commands/interaction/slash/search/xkcd.js index cc0b3b6..681c0be 100644 --- a/commands/interaction/slash/search/xkcd.js +++ b/commands/interaction/slash/search/xkcd.js @@ -5,7 +5,7 @@ const { createEmbed, formatPaginationEmbeds, page } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); const { editOrReply } = require('#utils/message') -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); const superagent = require('superagent') @@ -13,12 +13,12 @@ module.exports = { name: 'xkcd', description: 'Search for XKCD comics.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/search/youtube.js b/commands/interaction/slash/search/youtube.js index 91f3265..0b4c557 100644 --- a/commands/interaction/slash/search/youtube.js +++ b/commands/interaction/slash/search/youtube.js @@ -8,7 +8,7 @@ const { link, iconPill, timestamp } = require('#utils/markdown') const { editOrReply } = require('#utils/message') const { STATICS } = require('#utils/statics') -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); // TODO: Move this to a numbers utility // https://www.html-code-generator.com/javascript/shorten-long-numbers @@ -112,12 +112,12 @@ module.exports = { name: 'youtube', description: 'Search for videos on YouTube.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/dictionary.js b/commands/interaction/slash/utils/dictionary.js index b8eda83..62daed1 100644 --- a/commands/interaction/slash/utils/dictionary.js +++ b/commands/interaction/slash/utils/dictionary.js @@ -7,7 +7,7 @@ const { acknowledge } = require('#utils/interactions'); const { link, iconPill, smallPill, icon, iconLinkPill, pill } = require('#utils/markdown') const { editOrReply } = require('#utils/message') -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); const LABELS = { "offensive": `${iconPill("warning", "Offensive")}` @@ -53,12 +53,12 @@ module.exports = { name: 'dictionary', description: 'Define a word from the dictionary.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/emoji.js b/commands/interaction/slash/utils/emoji.js index f8b0a45..8e751e1 100644 --- a/commands/interaction/slash/utils/emoji.js +++ b/commands/interaction/slash/utils/emoji.js @@ -9,7 +9,7 @@ const { STATICS, STATIC_ASSETS } = require("#utils/statics"); const { ingest } = require("#logging"); const { Utils } = require("detritus-client"); -const { InteractionCallbackTypes, ApplicationCommandOptionTypes, DiscordRegexNames } = require("detritus-client/lib/constants"); +const { InteractionCallbackTypes, ApplicationCommandOptionTypes, DiscordRegexNames, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); const { Components, Snowflake } = require("detritus-client/lib/utils"); const { PERMISSION_GROUPS } = require("#constants"); @@ -42,12 +42,12 @@ module.exports = { use_custom_ingest: true }, contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/emojipedia.js b/commands/interaction/slash/utils/emojipedia.js index fc79c68..41f1b4b 100644 --- a/commands/interaction/slash/utils/emojipedia.js +++ b/commands/interaction/slash/utils/emojipedia.js @@ -6,43 +6,22 @@ const { editOrReply } = require("#utils/message"); const { STATICS, STATIC_ASSETS } = require("#utils/statics"); const { Components } = require("detritus-client/lib/utils"); -const { InteractionCallbackTypes, MessageComponentButtonStyles, ApplicationCommandOptionTypes } = require("detritus-client/lib/constants"); +const { InteractionCallbackTypes, MessageComponentButtonStyles, ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); const { acknowledge } = require("#utils/interactions"); const { PERMISSION_GROUPS } = require("#constants"); const onlyEmoji = require('emoji-aware').onlyEmoji; -function toCodePoint(unicodeSurrogates, sep) { - var - r = [], - c = 0, - p = 0, - i = 0; - while (i < unicodeSurrogates.length) { - c = unicodeSurrogates.charCodeAt(i++); - if (p) { - r.push((0x10000 + ((p - 0xD800) << 10) + (c - 0xDC00)).toString(16)); - p = 0; - } else if (0xD800 <= c && c <= 0xDBFF) { - p = c; - } else { - r.push(c.toString(16)); - } - } - return r.join(sep || '-'); -} - - module.exports = { name: 'emojipedia', description: 'Shows detailed information about an emoji.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/music-platforms.js b/commands/interaction/slash/utils/music-platforms.js index 23f10ba..2728e88 100644 --- a/commands/interaction/slash/utils/music-platforms.js +++ b/commands/interaction/slash/utils/music-platforms.js @@ -4,7 +4,7 @@ const { createEmbed } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); const { editOrReply } = require('#utils/message'); -const { ApplicationCommandOptionTypes } = require("detritus-client/lib/constants");; +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants");; const superagent = require('superagent') @@ -14,12 +14,12 @@ module.exports = { name: 'music-platforms', description: 'Get links for a song across all streaming platforms.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/ocr.js b/commands/interaction/slash/utils/ocr.js index e700128..a6f8c8d 100644 --- a/commands/interaction/slash/utils/ocr.js +++ b/commands/interaction/slash/utils/ocr.js @@ -8,18 +8,18 @@ const { codeblock, stringwrap } = require("#utils/markdown"); const { editOrReply } = require("#utils/message"); const { STATICS } = require("#utils/statics"); -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); module.exports = { name: 'ocr', description: 'Reads text contents from an image.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/reverse-image.js b/commands/interaction/slash/utils/reverse-image.js index 007a98b..469d0ef 100644 --- a/commands/interaction/slash/utils/reverse-image.js +++ b/commands/interaction/slash/utils/reverse-image.js @@ -7,7 +7,7 @@ const { createEmbed, formatPaginationEmbeds, page } = require("#utils/embed"); const { acknowledge } = require("#utils/interactions"); const { editOrReply } = require("#utils/message"); -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); // TODO: create a favicon() util function createReverseImageSearchResultPage(context, result, source) { @@ -33,12 +33,12 @@ module.exports = { name: 'reverse-image-search', description: 'Searches for image matches on the internet.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/screenshot.js b/commands/interaction/slash/utils/screenshot.js index c8b7c3e..4dfe0d2 100644 --- a/commands/interaction/slash/utils/screenshot.js +++ b/commands/interaction/slash/utils/screenshot.js @@ -5,18 +5,18 @@ const { createEmbed } = require("#utils/embed"); const { acknowledge } = require("#utils/interactions"); const { editOrReply } = require("#utils/message"); -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); module.exports = { name: 'screenshot', description: 'Create a screenshot of a website.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/translate.js b/commands/interaction/slash/utils/translate.js index 2b16e65..7d6256e 100644 --- a/commands/interaction/slash/utils/translate.js +++ b/commands/interaction/slash/utils/translate.js @@ -9,19 +9,19 @@ const { isSupported, getCodeFromAny } = require('#utils/translate'); const { translateLanguage } = require('#parameters').autocomplete; -const { ApplicationCommandOptionTypes } = require('detritus-client/lib/constants'); +const { ApplicationCommandOptionTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require('detritus-client/lib/constants'); const { acknowledge } = require('#utils/interactions'); module.exports = { name: 'translate', description: 'Translate text from and to other languages.', contexts: [ - 0, - 1, - 2 + InteractionContextTypes.GUILD, + InteractionContextTypes.PRIVATE_CHANNEL, + InteractionContextTypes.BOT_DM ], integrationTypes: [ - 1 + ApplicationIntegrationTypes.USER_INSTALL ], options: [ { diff --git a/commands/interaction/slash/utils/weather.js b/commands/interaction/slash/utils/weather.js index 27cc363..e64ef81 100644 --- a/commands/interaction/slash/utils/weather.js +++ b/commands/interaction/slash/utils/weather.js @@ -100,7 +100,6 @@ module.exports = { InteractionContextTypes.BOT_DM ], integrationTypes: [ - ApplicationIntegrationTypes.GUILD_INSTALL, ApplicationIntegrationTypes.USER_INSTALL ], options: [