Merge branch 'main' into dev
This commit is contained in:
commit
6aafb15945
25
.github/workflows/dev_deploy.yaml.bak
vendored
25
.github/workflows/dev_deploy.yaml.bak
vendored
@ -1,25 +0,0 @@
|
|||||||
# name: NodBot Dev Deploy
|
|
||||||
|
|
||||||
# on:
|
|
||||||
# push: # tells github to run this on any push to the dev branch
|
|
||||||
# branches:
|
|
||||||
# - dev
|
|
||||||
|
|
||||||
# jobs:
|
|
||||||
# deploy:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# if: github.ref == 'refs/heads/dev' # we tell Github to only execute this step if we're on our dev branch
|
|
||||||
# steps:
|
|
||||||
# - name: Deploying to Probey
|
|
||||||
# uses: appleboy/ssh-action@master # An action made to control Linux servers
|
|
||||||
# with: # We set all our secrets here for the action, these won't be shown in the action logs
|
|
||||||
# host: ${{ secrets.HOST }}
|
|
||||||
# username: ${{ secrets.USERNAME }}
|
|
||||||
# key: ${{ secrets.KEY }}
|
|
||||||
# port: ${{ secrets.PORT }}
|
|
||||||
# script: |
|
|
||||||
# cd nodbot-dev # we move into our app's folder
|
|
||||||
# git pull # we pull any changes from git
|
|
||||||
# npm prune # we remove any unused dependencies
|
|
||||||
# npm install # we install any missing dependencies
|
|
||||||
# pm2 reload nodbot-dev # we reload the app via PM2
|
|
26
.github/workflows/docker-image.yml
vendored
Normal file
26
.github/workflows/docker-image.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
name: Docker Image CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
||||||
|
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Build the Docker image
|
||||||
|
run: docker build . --file Dockerfile --tag v0idf1sh/nodbot
|
||||||
|
- name: Log into Docker Hub
|
||||||
|
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
|
||||||
|
- name: Push image to Docker Hub
|
||||||
|
run: docker push v0idf1sh/nodbot
|
25
.github/workflows/prod_deploy.yaml.bak
vendored
25
.github/workflows/prod_deploy.yaml.bak
vendored
@ -1,25 +0,0 @@
|
|||||||
# name: NodBot Production Deploy
|
|
||||||
|
|
||||||
# on:
|
|
||||||
# push: # tells github to run this on any push to the dev branch
|
|
||||||
# branches:
|
|
||||||
# - main
|
|
||||||
|
|
||||||
# jobs:
|
|
||||||
# deploy:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# if: github.ref == 'refs/heads/main' # we tell Github to only execute this step if we're on our main branch
|
|
||||||
# steps:
|
|
||||||
# - name: Deploying to Probey
|
|
||||||
# uses: appleboy/ssh-action@master # An action made to control Linux servers
|
|
||||||
# with: # We set all our secrets here for the action, these won't be shown in the action logs
|
|
||||||
# host: ${{ secrets.HOST }}
|
|
||||||
# username: ${{ secrets.USERNAME }}
|
|
||||||
# key: ${{ secrets.KEY }}
|
|
||||||
# port: ${{ secrets.PORT }}
|
|
||||||
# script: |
|
|
||||||
# cd nodbot # we move into our app's folder
|
|
||||||
# git pull # we pull any changes from git
|
|
||||||
# npm prune # we remove any unused dependencies
|
|
||||||
# npm install # we install any missing dependencies
|
|
||||||
# pm2 reload nodbot # we reload the app via PM2
|
|
@ -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;
|
||||||
|
@ -332,7 +332,7 @@ const functions = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Rating',
|
name: 'Rating',
|
||||||
value: `${strainInfo.rating}⭐️`,
|
value: `${strainInfo.rating}⭐️s`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -449,7 +449,6 @@ const functions = {
|
|||||||
const { strainName } = commandData;
|
const { strainName } = commandData;
|
||||||
const query = `SELECT id, strain, type, effects, description, flavor, rating FROM strains WHERE strain = ${db.escape(strainName)}`;
|
const query = `SELECT id, strain, type, effects, description, flavor, rating FROM strains WHERE strain = ${db.escape(strainName)}`;
|
||||||
db.query(query, (err, rows, fields) => {
|
db.query(query, (err, rows, fields) => {
|
||||||
if (err) throw err;
|
|
||||||
if (rows != undefined) {
|
if (rows != undefined) {
|
||||||
commandData.strainInfo = {
|
commandData.strainInfo = {
|
||||||
id: `${rows[0].id}`,
|
id: `${rows[0].id}`,
|
||||||
|
2
main.js
2
main.js
@ -40,7 +40,7 @@ client.once('ready', () => {
|
|||||||
fn.download.strains(client);
|
fn.download.strains(client);
|
||||||
console.log('Ready!');
|
console.log('Ready!');
|
||||||
client.channels.fetch(statusChannelId).then(channel => {
|
client.channels.fetch(statusChannelId).then(channel => {
|
||||||
channel.send(`I'm ready! ${new Date().toISOString()}`);
|
channel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
"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",
|
||||||
"fuzzy-search": "^3.2.1",
|
"fuzzy-search": "^3.2.1",
|
||||||
"mysql": "^2.18.1",
|
"mysql": "^2.18.1",
|
||||||
"tenorjs": "^1.0.8"
|
"tenorjs": "^1.0.10"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x"
|
"node": "16.x"
|
||||||
|
Loading…
Reference in New Issue
Block a user