From c342f4741a7c3fb28f5c1f3c9f559694c7beefb9 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Mon, 21 Sep 2026 20:32:06 -0400 Subject: [PATCH] Remove TenorJS completely --- README.md | 6 ++--- dot-commands/gif.js | 15 ----------- package.json | 3 +-- slash-commands/edit.js | 8 ------ slash-commands/save.js | 56 ++++++++++++++++++------------------------ slash-commands/view.js | 8 ------ 6 files changed, 28 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index 597b5b4..a183c1f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # About Nodbot -Nodbot is a content saving and serving Discord bot. Nodbot is able to search Tenor for GIFs, save custom copypastas, and look up marijuana strain information. Nodbot is in semi-active development by voidf1sh. It's buggy as hell and very shoddily built. Don't use it. +Nodbot is a content saving and serving Discord bot. Nodbot is able to search GIPHY for GIFs, save custom copypastas, and look up marijuana strain information. Nodbot is in semi-active development by voidf1sh. It's buggy as hell and very shoddily built. Don't use it. # Nodbot Help @@ -16,7 +16,7 @@ Use the `/help` command to see the bot's help message. 1. Create an application at the [Discord Developer Portal](https://discord.com/developers/applications) 2. Convert the application into a Bot 3. Note down the token provided and keep this safe. You cannot view this token again, only regenerate a new one. -4. Create a Tenor account and obtain an API key. +4. Create a GIPHY account and obtain an API key. 5. Install and configure MySQL or MariaDB with a user for the bot and a datbase * Create the table structure as outlined below (* Nodbot will soon create its own table structure) 6. Configure your environment variables as outlined below. @@ -84,7 +84,7 @@ dbPort= dbUser= dbPass= dbName= -giphyAPIKey= +giphyAPIKey= ownerId= statusChannelId= clientId= diff --git a/dot-commands/gif.js b/dot-commands/gif.js index 3e90a90..2666529 100644 --- a/dot-commands/gif.js +++ b/dot-commands/gif.js @@ -2,10 +2,6 @@ const fn = require('../functions'); const axios = require('axios'); const dotenv = require('dotenv').config(); -// TODO: Tenor has changed API versions, switch from TenorJS (unmaintained) to axios for -// general API usage. See: https://github.com/Jinzulen/TenorJS/issues/12 -// see also: https://developers.google.com/tenor/guides/migrate-from-v1 - module.exports = { name: 'gif', description: 'Send a GIF', @@ -46,17 +42,6 @@ module.exports = { await message.reply(commandData.embed_url); } }).catch(err => console.error(err)); - // tenor.Search.Query(commandData.args, "1").then(res => { - // if (res[0] == undefined) { - // message.reply('Sorry I was unable to find a GIF of ' + commandData.args); - // return; - // }; - // commandData.embed_url = res[0].media[0].gif.url; - // // message.reply(fn.embeds.gif(commandData)); - // // message.channel.send(`> ${commandData.author} - ${commandData.args}.gif`); - // // message.channel.send(commandData.embed_url); - // message.reply(commandData.embed_url); - // }).catch(err => console.error(err)); } else { // message.reply(commandData.args + ' requested by ' + message.author.username + '\n' + client.gifs.get(commandData.args).embed_url); const gifData = client.gifs.get(commandData.args.toLowerCase()); diff --git a/package.json b/package.json index 5b09a5c..9650768 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,7 @@ "dotenv": "^10.0.0", "fuzzy-search": "^3.2.1", "mysql": "^2.18.1", - "openai": "^4.12.0", - "tenorjs": "^1.0.10" + "openai": "^4.12.0" }, "engines": { "node": "18.x" diff --git a/slash-commands/edit.js b/slash-commands/edit.js index 18671ec..34171c2 100644 --- a/slash-commands/edit.js +++ b/slash-commands/edit.js @@ -1,11 +1,3 @@ -const tenor = require('tenorjs').client({ - 'Key': process.env.giphyAPIKey, // https://tenor.com/developer/keyregistration - 'Filter': 'off', // "off", "low", "medium", "high", not case sensitive - 'Locale': 'en_US', - 'MediaFilter': 'minimal', - 'DateFormat': 'D/MM/YYYY - H:mm:ss A', -}); - const { SlashCommandBuilder } = require('@discordjs/builders'); const { MessageActionRow, MessageButton } = require('discord.js'); const { GifData, PastaData } = require('../CustomModules/NodBot'); diff --git a/slash-commands/save.js b/slash-commands/save.js index c5406d2..726c9de 100644 --- a/slash-commands/save.js +++ b/slash-commands/save.js @@ -1,11 +1,3 @@ -const tenor = require('tenorjs').client({ - 'Key': process.env.giphyAPIKey, // https://tenor.com/developer/keyregistration - 'Filter': 'off', // "off", "low", "medium", "high", not case sensitive - 'Locale': 'en_US', - 'MediaFilter': 'minimal', - 'DateFormat': 'D/MM/YYYY - H:mm:ss A', -}); - const { SlashCommandBuilder } = require('@discordjs/builders'); const { Collection } = require('discord.js'); const fn = require('../functions.js'); @@ -24,7 +16,7 @@ module.exports = { .addSubcommand(subcommand => subcommand .setName('gifsearch') - .setDescription('Search Tenor for a GIF.') + .setDescription('Search GIPHY for a GIF.') .addStringOption(option => option .setName('query') @@ -154,34 +146,34 @@ module.exports = { iStorage.gifName = gifName; iStorage.query = query; - + interaction.editReply("Fuck off this is broken, come back later."); // Search Tenor for the GIF - tenor.Search.Query(query, '20').then(res => { + // tenor.Search.Query(query, '20').then(res => { - strings.temp.gifs = []; - strings.temp.gifIndex = 0; - strings.temp.gifLimit = res.length - 1; - strings.temp.gifUserId = interaction.user.id; + // strings.temp.gifs = []; + // strings.temp.gifIndex = 0; + // strings.temp.gifLimit = res.length - 1; + // strings.temp.gifUserId = interaction.user.id; - if (res[0] == undefined) { - interaction.editReply('Sorry I was unable to find a GIF of ' + query); - return; - } - for (const row of res) { - iStorage.gifsCollection.set(row.id, row); - } + // if (res[0] == undefined) { + // interaction.editReply('Sorry I was unable to find a GIF of ' + query); + // return; + // } + // for (const row of res) { + // iStorage.gifsCollection.set(row.id, row); + // } - // Generate the initial action row - const actionRow = customEmbeds.actionRows.gifSearchAR('first'); - // Get the index built - const gifPage = Indexer(iStorage.gifsCollection, 0, 1); - gifPage.query = query; - gifPage.gifName = gifName; - // Generate the embed - const gifEmbed = Embeds.core.gifSearch({ author: interaction.user.username }, gifPage); - interaction.editReply({ embeds: [gifEmbed], components: [actionRow], ephemeral: true }); - }); + // // Generate the initial action row + // const actionRow = customEmbeds.actionRows.gifSearchAR('first'); + // // Get the index built + // const gifPage = Indexer(iStorage.gifsCollection, 0, 1); + // gifPage.query = query; + // gifPage.gifName = gifName; + // // Generate the embed + // const gifEmbed = Embeds.core.gifSearch({ author: interaction.user.username }, gifPage); + // interaction.editReply({ embeds: [gifEmbed], components: [actionRow], ephemeral: true }); + // }); break; // GIF URL case "gifurl": diff --git a/slash-commands/view.js b/slash-commands/view.js index c1b6316..df5fed7 100644 --- a/slash-commands/view.js +++ b/slash-commands/view.js @@ -1,11 +1,3 @@ -const tenor = require('tenorjs').client({ - 'Key': process.env.giphyAPIKey, // https://tenor.com/developer/keyregistration - 'Filter': 'off', // "off", "low", "medium", "high", not case sensitive - 'Locale': 'en_US', - 'MediaFilter': 'minimal', - 'DateFormat': 'D/MM/YYYY - H:mm:ss A', -}); - const { SlashCommandBuilder } = require('@discordjs/builders'); const { Collection } = require('discord.js'); const fn = require('../functions.js');