Add a dev workflow
Some checks failed
NodBot Production Dockerization / build (push) Failing after 1s

This commit is contained in:
Skylar Grant 2024-09-29 13:01:25 -04:00
parent 0381272d7d
commit 7f876f4555
3 changed files with 79 additions and 1 deletions

View File

@ -0,0 +1,45 @@
name: NodBot PE Dockerization
on:
push:
tags:
- 'v*-dev*'
env:
DHUB_UNAME: ${{ secrets.DHUB_UNAME }}
DHUB_PWORD: ${{ secrets.DHUB_PWORD }}
jobs:
build:
runs-on: self-hosted
steps:
- name: Pull latest from Git
run: |
echo "Branch: ${{ gitea.ref_name }}"
pwd
whoami
mkdir -p /var/lib/act_runner/
cd /var/lib/act_runner/
if [ ! -d "nodbot" ]; then
git clone https://git.vfsh.dev/voidf1sh/nodbot-dev
cd nodbot-dev
else
cd nodbot-dev
git pull
fi
git checkout ${{ gitea.ref_name }}
- name: Build the Docker image
run: |
cd /var/lib/act_runner/nodbot-dev
docker build . --file Dockerfile --tag v0idf1sh/nodbot-dev
- name: Log into Docker Hub
run: docker login -u $DHUB_UNAME -p $DHUB_PWORD
- name: Push image to Docker Hub
run: |
cd /var/lib/act_runner/nodbot-dev
docker push v0idf1sh/nodbot-dev
- name: Restart the container
run: |
cd /srv/docker/nodbot-dev
docker-compose down
docker-compose up -d

View File

@ -52,6 +52,9 @@ module.exports = {
case 'cancelGif': case 'cancelGif':
module.exports.gifSearchPage(interaction); module.exports.gifSearchPage(interaction);
break; break;
case 'closeRequests':
module.exports.closeRequests(interaction);
break;
default: default:
return; return;
} }
@ -199,5 +202,10 @@ module.exports = {
const gifEmbed = customEmbeds.core.gifSearch({ author: interaction.user.username }, indexedGifs); const gifEmbed = customEmbeds.core.gifSearch({ author: interaction.user.username }, indexedGifs);
// Update the interaction // Update the interaction
interaction.update({ embeds: [gifEmbed], components: [gifSearchAR], ephemeral: true }); interaction.update({ embeds: [gifEmbed], components: [gifSearchAR], ephemeral: true });
},
closeRequests(interaction) {
const closeRequestModal = customEmbeds.modals.closeRequestsModal();
interaction.showModal(closeRequestModal);
interaction.update({ content: 'The requests menu has been closed.', components: [] });
} }
} }

View File

@ -1,4 +1,4 @@
const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js'); const { MessageActionRow, MessageButton, MessageEmbed, TextInputComponent } = require('discord.js');
module.exports = { module.exports = {
actionRows: { actionRows: {
@ -74,6 +74,11 @@ module.exports = {
.setLabel('➡️') .setLabel('➡️')
.setStyle('SECONDARY'); .setStyle('SECONDARY');
const closeButton = new MessageButton()
.setCustomId('closeRequests')
.setLabel('Close Requests')
.setStyle('DANGER');
switch (state) { switch (state) {
case 'first': case 'first':
previousButton.setDisabled(true); previousButton.setDisabled(true);
@ -138,6 +143,26 @@ module.exports = {
.addComponents(previousButton, nextButton); .addComponents(previousButton, nextButton);
} }
}, },
modals: {
closeRequestsModal() {
const requestNumberInput = new TextInputComponent()
.setCustomId('requestNumber')
.setLabel('Request Number')
.setPlaceholder('420')
.setMinLength(1)
.setMaxLength(5)
.setStyle('SHORT')
.setRequired(true);
const actionRow = new MessageActionRow()
.addComponents([requestNumberInput]);
return new Modal()
.setTitle('Close Request')
.setDescription('Please enter the number of the request you would like to close.')
.addComponents([actionRow]);
}
},
core: { core: {
gifSearch(commandData, indexedGifs) { gifSearch(commandData, indexedGifs) {
return new MessageEmbed() return new MessageEmbed()