Remove TenorJS completely
All checks were successful
NodBot PE Dockerization / build (push) Successful in 1m7s

This commit is contained in:
Skylar Grant 2026-09-21 20:32:06 -04:00
parent f147761d35
commit c342f4741a
6 changed files with 28 additions and 68 deletions

View File

@ -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=<mySQL port (3306)>
dbUser=<mySQL username>
dbPass=<mySQL user password>
dbName=<mySQL table name>
giphyAPIKey=<Tenor API Key>
giphyAPIKey=<GIPHY API Key>
ownerId=<your Discord user ID>
statusChannelId=<Discord channel ID of channel used for status messages>
clientId=<Discord user ID of your bot>

View File

@ -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());

View File

@ -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"

View File

@ -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');

View File

@ -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":

View File

@ -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');