Merge pull request 'v3.4.3-dev' (#29) from v3.4.3-dev into main
Reviewed-on: #29
This commit is contained in:
commit
e389d5caae
@ -1,10 +1,16 @@
|
|||||||
name: NodBot PE Dockerization
|
name: NodBot PE Dockerization
|
||||||
|
######################################################
|
||||||
|
# Creates a new Docker image of nodbot-dev, pushes #
|
||||||
|
# it to DockerHub, and restarts the container. #
|
||||||
|
######################################################
|
||||||
|
|
||||||
|
# Run when a new tag for dev is pushed
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*-dev*'
|
- 'v*-dev*'
|
||||||
|
|
||||||
|
# Pull DockerHub credentials from secrets
|
||||||
env:
|
env:
|
||||||
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
|
||||||
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
|
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
|
||||||
@ -13,21 +19,17 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
|
- name: Clean up old environment
|
||||||
|
run: |
|
||||||
|
rm -rf /var/lib/act_runner/nodbot
|
||||||
|
rm -rf /var/lib/act_runner/nodbot-dev
|
||||||
- name: Pull latest from Git
|
- name: Pull latest from Git
|
||||||
run: |
|
run: |
|
||||||
|
echo "Ref: ${{ gitea.ref_name }}"
|
||||||
echo "Branch: tags/${{ gitea.ref_name }}"
|
echo "Branch: tags/${{ gitea.ref_name }}"
|
||||||
pwd
|
cd /var/lib/act_runner
|
||||||
whoami
|
git clone https://git.vfsh.dev/voidf1sh/nodbot
|
||||||
mkdir -p /var/lib/act_runner/
|
cd nodbot
|
||||||
cd /var/lib/act_runner/
|
|
||||||
if [ ! -d "nodbot" ]; then
|
|
||||||
git clone https://git.vfsh.dev/voidf1sh/nodbot
|
|
||||||
cd nodbot
|
|
||||||
else
|
|
||||||
cd nodbot
|
|
||||||
git checkout main
|
|
||||||
git pull
|
|
||||||
fi
|
|
||||||
git checkout tags/${{ gitea.ref_name }}
|
git checkout tags/${{ gitea.ref_name }}
|
||||||
- name: Build the Docker image
|
- name: Build the Docker image
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
## v3.4.x
|
## v3.4.x
|
||||||
|
#### v3.4.3 (#29)
|
||||||
|
* Fix `.gif` replies to redirect to the original replyee (#26)
|
||||||
|
|
||||||
#### v3.4.2 (#28)
|
#### v3.4.2 (#28)
|
||||||
* Added `.drink` and aliases
|
* Added `.drink` and aliases
|
||||||
|
* Changed `.joint` responses to be standalone instead of replies
|
||||||
|
|
||||||
#### v3.4.1 (#27)
|
#### v3.4.1 (#27)
|
||||||
* Adding command to change nicknames
|
* Adding command to change nicknames
|
||||||
|
|||||||
38
_list-guilds.js
Normal file
38
_list-guilds.js
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Quick and dirty script to list out what guilds the bot is in and optionally leave some.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const guildsToLeave = ['1224396616555823124'];
|
||||||
|
|
||||||
|
const dotenv = require('dotenv').config();
|
||||||
|
const token = process.env.TOKEN;
|
||||||
|
const Discord = require('discord.js');
|
||||||
|
|
||||||
|
const client = new Discord.Client({
|
||||||
|
intents: [
|
||||||
|
'GUILDS'
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('ready', async () => {
|
||||||
|
const guildChecks = [];
|
||||||
|
console.log(`Logged in as ${client.user.tag}`);
|
||||||
|
console.log('Guilds:');
|
||||||
|
client.guilds.cache.forEach((guild) => {
|
||||||
|
const p = new Promise((resolve, reject) => {
|
||||||
|
console.log(` - ${guild.name} (${guild.id})`);
|
||||||
|
if (guildsToLeave.includes(guild.id)) {
|
||||||
|
console.log(` Leaving ${guild.name}`);
|
||||||
|
guild.leave().then(resolve).catch(reject);
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
guildChecks.push(p);
|
||||||
|
});
|
||||||
|
await Promise.all(guildChecks);
|
||||||
|
console.log('All guilds checked.');
|
||||||
|
client.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
client.login(token);
|
||||||
@ -3,5 +3,6 @@
|
|||||||
"validCommands": [],
|
"validCommands": [],
|
||||||
"roaches": [],
|
"roaches": [],
|
||||||
"icaoIds": [],
|
"icaoIds": [],
|
||||||
"datisICAOs": []
|
"datisICAOs": [],
|
||||||
|
"bannedServers": ["1224396616555823124"]
|
||||||
}
|
}
|
||||||
@ -22,14 +22,28 @@ module.exports = {
|
|||||||
`&key=${process.env.tenorAPIKey}` +
|
`&key=${process.env.tenorAPIKey}` +
|
||||||
'&limit=1' +
|
'&limit=1' +
|
||||||
`&contentfilter=off`
|
`&contentfilter=off`
|
||||||
).then(res => {
|
).then(async (res) => {
|
||||||
if (process.env.isDev) console.log(res.data.results);
|
if (process.env.isDev) console.log(res.data.results);
|
||||||
if (res.data.results[0] == undefined) {
|
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.data.results[0].url;
|
commandData.embed_url = res.data.results[0].url;
|
||||||
message.reply(commandData.embed_url);
|
|
||||||
|
// Handle when the invoking message is a reply to someone else
|
||||||
|
if (message.reference) {
|
||||||
|
// Fetch the referenced message from the channels' MessageManager
|
||||||
|
await message.channel.messages.fetch(message.reference.messageId).then(async (refMsg) => {
|
||||||
|
// Send the reply to the referenced message
|
||||||
|
await refMsg.reply(commandData.embed_url);
|
||||||
|
}).catch(async (e) => {
|
||||||
|
// Failed fetching the message from the channel, fallback to regular send
|
||||||
|
console.error(e);
|
||||||
|
await message.reply(commandData.embed_url);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await message.reply(commandData.embed_url);
|
||||||
|
}
|
||||||
}).catch(err => console.error(err));
|
}).catch(err => console.error(err));
|
||||||
// tenor.Search.Query(commandData.args, "1").then(res => {
|
// tenor.Search.Query(commandData.args, "1").then(res => {
|
||||||
// if (res[0] == undefined) {
|
// if (res[0] == undefined) {
|
||||||
|
|||||||
23
functions.js
23
functions.js
@ -671,6 +671,29 @@ const functions = {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
checkBannedServers(client, statusChannel) {
|
||||||
|
if ( !config.bannedServers || !statusChannel ) return;
|
||||||
|
const guildChecks = [];
|
||||||
|
console.log('Guild Check:');
|
||||||
|
client.guilds.cache.forEach((guild) => {
|
||||||
|
const p = new Promise((resolve, reject) => {
|
||||||
|
console.log(` - ${guild.name} (${guild.id})`);
|
||||||
|
if (config.bannedServers.includes(guild.id)) {
|
||||||
|
console.log(` Leaving banned server: ${guild.name}`);
|
||||||
|
statusChannel.send(`<@${process.env.ownerId}> Leaving banned server: ${guild.name}`);
|
||||||
|
guild.leave().then(resolve).catch(reject);
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
guildChecks.push(p);
|
||||||
|
});
|
||||||
|
Promise.all(guildChecks).then(() => {
|
||||||
|
console.log('All guilds checked.');
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
autoresponses: { // Specific responses for certain keywords in sent messages
|
autoresponses: { // Specific responses for certain keywords in sent messages
|
||||||
checkForAll(messageContent) {
|
checkForAll(messageContent) {
|
||||||
let responses = [];
|
let responses = [];
|
||||||
|
|||||||
20
main.js
20
main.js
@ -31,6 +31,7 @@ const { GifData, CommandData } = require('./CustomModules/NodBot.js');
|
|||||||
const ButtonHandlers = require('./CustomModules/ButtonHandlers.js');
|
const ButtonHandlers = require('./CustomModules/ButtonHandlers.js');
|
||||||
const InteractionStorage = require('./CustomModules/InteractionStorage.js');
|
const InteractionStorage = require('./CustomModules/InteractionStorage.js');
|
||||||
const isDev = process.env.isDev;
|
const isDev = process.env.isDev;
|
||||||
|
let statusChannel;
|
||||||
|
|
||||||
client.once('ready', async () => {
|
client.once('ready', async () => {
|
||||||
fn.collections.interactionStorage(client);
|
fn.collections.interactionStorage(client);
|
||||||
@ -48,9 +49,10 @@ client.once('ready', async () => {
|
|||||||
await fn.avWx.metar.getAllICAOs();
|
await fn.avWx.metar.getAllICAOs();
|
||||||
await fn.avWx.datis.getAllICAOs();
|
await fn.avWx.datis.getAllICAOs();
|
||||||
// console.log(JSON.stringify(icaoArray));
|
// console.log(JSON.stringify(icaoArray));
|
||||||
client.channels.fetch(statusChannelId).then(channel => {
|
statusChannel = await client.channels.fetch(statusChannelId).catch(e => console.error(e));
|
||||||
channel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`);
|
await statusChannel.send(`${new Date().toISOString()} -- <@${process.env.ownerId}>\nStartup Sequence Complete`).catch(e => console.error(e));
|
||||||
});
|
// Check for banned servers
|
||||||
|
fn.checkBannedServers(client, statusChannel);
|
||||||
});
|
});
|
||||||
|
|
||||||
// slash-commands
|
// slash-commands
|
||||||
@ -146,4 +148,16 @@ client.on('messageCreate', message => {
|
|||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Guild Joins and Leaves:
|
||||||
|
client.on('guildCreate', guild => {
|
||||||
|
statusChannel.send(`I've been added to a new guild: ${guild.name} (${guild.id})`)
|
||||||
|
.catch(e => console.error(e));
|
||||||
|
fn.checkBannedServers(client, statusChannel);
|
||||||
|
});
|
||||||
|
|
||||||
|
client.on('guildDelete', guild => {
|
||||||
|
statusChannel.send(`I've been removed from a guild: ${guild.name} (${guild.id})`)
|
||||||
|
.catch(e => console.error(e));
|
||||||
|
});
|
||||||
|
|
||||||
client.login(token);
|
client.login(token);
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodbot",
|
"name": "nodbot",
|
||||||
"version": "3.4.2",
|
"version": "3.4.3",
|
||||||
"description": "Nods and Nod Accessories",
|
"description": "Nods and Nod Accessories",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user