Merge branch '3.0.1-dev'

This commit is contained in:
Skylar Grant 2022-12-02 14:27:46 -05:00
commit d0899b42ab
3 changed files with 33 additions and 18 deletions

View File

@ -2,9 +2,9 @@ name: Docker Image CI
on: on:
push: push:
branches: [ "main" ] branches: [ "3.0.1-dev" ]
pull_request: pull_request:
branches: [ "main" ] branches: [ "3.0.1-dev" ]
env: env:
DHUB_UNAME: ${{ secrets.DHUB_UNAME }} DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
@ -19,7 +19,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Build the Docker image - name: Build the Docker image
run: docker build . --file Dockerfile --tag v0idf1sh/nodbot run: docker build . --file Dockerfile --tag v0idf1sh/nodbot-dev
- name: Log into Docker Hub - name: Log into Docker Hub
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
- name: Push image to Docker Hub - name: Push image to Docker Hub

View File

@ -1,31 +1,46 @@
const fn = require('../functions'); const fn = require('../functions');
const tenor = require('tenorjs').client({ const axios = require('axios');
"Key": process.env.tenorAPIKey, // https://tenor.com/developer/keyregistration const dotenv = require('dotenv').config();
"Filter": "off", // "off", "low", "medium", "high", not case sensitive
"Locale": "en_US", // Your locale here, case-sensitivity depends on input // TODO: Tenor has changed API versions, switch from TenorJS (unmaintained) to axios for
"MediaFilter": "minimal", // either minimal or basic, not case sensitive // general API usage. See: https://github.com/Jinzulen/TenorJS/issues/12
"DateFormat": "D/MM/YYYY - H:mm:ss A" // Change this accordingly // see also: https://developers.google.com/tenor/guides/migrate-from-v1
});
module.exports = { module.exports = {
name: 'gif', name: 'gif',
description: 'Send a GIF', description: 'Send a GIF',
usage: '<GIF name or Search Query>.gif', usage: '<GIF name or Search Query>.gif',
execute(message, commandData) { async execute(message, commandData) {
// if (message.deletable) message.delete(); // if (message.deletable) message.delete();
const client = message.client; const client = message.client;
if (!client.gifs.has(commandData.args)) { if (!client.gifs.has(commandData.args)) {
tenor.Search.Query(commandData.args, 1).then(res => { if (process.env.isDev) console.log('https://tenor.googleapis.com/v2/search?' + `&q=${commandData.args}` + `&key=${process.env.tenorAPIKey}` + '&limit=1&contentfilter=off');
if (res[0] == undefined) { const q = await axios.get(
'https://tenor.googleapis.com/v2/search?' +
`&q=${commandData.args}` +
`&key=${process.env.tenorAPIKey}` +
'&limit=1' +
`&contentfilter=off`
).then(res => {
if (process.env.isDev) console.log(res.data.results);
if (res.data.results[0] == undefined) {
message.reply('Sorry I was unable to find a GIF of ' + commandData.args); message.reply('Sorry I was unable to find a GIF of ' + commandData.args);
return; return;
}; };
commandData.embed_url = res[0].media[0].gif.url; commandData.embed_url = res.data.results[0].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); message.reply(commandData.embed_url);
}).catch(err => console.error(err)); }).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 { } else {
// message.reply(commandData.args + ' requested by ' + message.author.username + '\n' + client.gifs.get(commandData.args).embed_url); // message.reply(commandData.args + ' requested by ' + message.author.username + '\n' + client.gifs.get(commandData.args).embed_url);
commandData.embed_url = client.gifs.get(commandData.args).embed_url; commandData.embed_url = client.gifs.get(commandData.args).embed_url;

View File

@ -6,7 +6,7 @@
"dependencies": { "dependencies": {
"@discordjs/builders": "^0.6.0", "@discordjs/builders": "^0.6.0",
"@discordjs/rest": "^0.1.0-canary.0", "@discordjs/rest": "^0.1.0-canary.0",
"axios": "^0.21.1", "axios": "^0.21.4",
"discord-api-types": "^0.22.0", "discord-api-types": "^0.22.0",
"discord.js": "^13.1.0", "discord.js": "^13.1.0",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",