Compare commits

..

No commits in common. "903bb9b4c0edc4ab5f4874858e9468021aa75ded" and "35405f3817c954aeedf8a66fa27e2e9306ecbf39" have entirely different histories.

11 changed files with 0 additions and 1359 deletions

17
.vscode/launch.json vendored
View File

@ -1,17 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\src\\index.js"
}
]
}

View File

@ -1,30 +0,0 @@
{
// Place your custom-scripts workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Banner Comment": {
"scope": "javascript,typescript",
"description": "Banner Comment",
"prefix": "///",
"body": [
"// #############################################################",
"// $1",
"// #############################################################",
"$2"
]
}
}

View File

@ -1,8 +0,0 @@
FROM node:20
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json ./
RUN npm install
COPY . .
CMD ["/bin/sh", "-c", "node src/index.js 2>&1 > /logs/$(date +%Y-%m-%d_%H-%M-%S).txt"]

View File

@ -1,22 +0,0 @@
version: '3.8'
networks:
proxnet:
external: true
services:
proxy:
image: 'v0idf1sh/hookshot'
container_name: hookshot
restart: unless-stopped
networks:
- proxnet
environment:
- TOPGG_WH_ID: "id"
- TOPGG_WH_TOKEN: "token"
- UPTIMEKUMA_WH_ID: "id"
- UPTIMEKUMA_WH_TOKEN: "token"
- TESTING_WH_ID: "id"
- TESTING_WH_TOKEN: "token"
volumes:
- ./logs:/logs # Log files

1085
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
{
"name": "hookshot",
"version": "1.0.0",
"description": "Quick and sloppy intermediary webhook server. Designed to relay messages to Discord from other webhook triggers.",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.vfsh.dev/voidf1sh/hookshot"
},
"keywords": [
"webhook",
"discord"
],
"author": "Skylar Grant",
"license": "MIT",
"dependencies": {
"discord.js": "^14.16.2",
"dotenv": "^16.4.5",
"express": "^4.21.0"
}
}

View File

@ -1,19 +0,0 @@
#!/bin/bash
# Check for root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Create directories if they don't exist
mkdir -p /srv/docker/hookshot/logs
# Copy the docker-compose.yml file
cp docker-compose.yml /srv/docker/hookshot/docker-compose.yml
# Open the docker-compose.yml file for editing
nano /srv/docker/hookshot/docker-compose.yml
# Start the containers
docker-compose -f /srv/docker/hookshot/docker-compose.yml up -d

View File

@ -1,64 +0,0 @@
// #############################################################
// Module Imports
// #############################################################
const { EmbedBuilder, WebhookClient } = require('discord.js');
const config = require('./config.json');
const dotenv = require('dotenv').config();
// #############################################################
// Variables
// #############################################################
const whInfo = {
"topgg": {
id: process.env.TOPGG_WH_ID,
token: process.env.TOPGG_WH_TOKEN
},
"uptimeKuma": {
id: process.env.UPTIMEKUMA_WH_ID,
token: process.env.UPTIMEKUMA_WH_TOKEN
},
"testing": {
id: process.env.TESTING_WH_ID,
token: process.env.TESTING_WH_TOKEN
}
}
module.exports = {
testing() {
// Create a new WebhookClient
const webhookClient = new WebhookClient({ id: whInfo.testing.id, token: whInfo.testing.token });
// Create a new EmbedBuilder
const embed = new EmbedBuilder()
.setTitle('Webhook Test')
.setDescription('This is a test of the WebhookClient')
.setTimestamp();
// Send the Embed
webhookClient.send({
content: 'This is a test of the WebhookClient',
username: config.discord.testing.username,
avatarURL: config.discord.testing.avatarURL,
embeds: [embed]
});
},
topgg(body) {
console.log(body);
// Create a new WebhookClient
const webhookClient = new WebhookClient({ id: whInfo.topgg.id, token: whInfo.topgg.token });
// Create a new EmbedBuilder
const embed = new EmbedBuilder()
.setTitle('Top.gg Vote')
.setDescription(`User ID: ${body.user}`)
.setTimestamp();
// Send the Embed
webhookClient.send({
content: 'A user has voted for the bot on top.gg',
username: config.discord.topgg.username,
avatarURL: config.discord.topgg.avatarURL,
embeds: [embed]
});
}
}

View File

@ -1,22 +0,0 @@
const djs = require('./DjsHandlers.js');
module.exports = {
generic(req, res) {
// Handle generic webhook payload here
console.log('Received generic webhook payload:', req.body);
res.sendStatus(200);
djs.testing();
},
topgg(req, res) {
// Handle top.gg vote webhook payload here
console.log('Received top.gg vote webhook payload:', req.body);
res.sendStatus(200);
djs.topggVote();
},
uptimeKuma(req, res) {
// Handle Uptime Kuma webhook payload here
console.log('Received Uptime Kuma webhook payload:', req.body);
res.sendStatus(200);
djs.uptimeKumaAlert();
}
}

View File

@ -1,16 +0,0 @@
{
"discord": {
"testing": {
"username": "testing",
"avatarUrl": "https://assets.vfsh.dev/shednod.png"
},
"topgg": {
"username": "topgg",
"avatarUrl": "https://assets.vfsh.dev/shednod.png"
},
"uptimeKuma": {
"username": "uptimeKuma",
"avatarUrl": "https://assets.vfsh.dev/shednod.png"
}
}
}

View File

@ -1,52 +0,0 @@
// #############################################################
// Module Imports
// #############################################################
const express = require('express');
const dotenv = require('dotenv');
const handlers = require('./Handlers.js');
// #############################################################
// Variables
// #############################################################
const port = 3000;
const locations = {
"topgg": "/hooks/vote",
"uptimeKuma": "/hooks/uptime"
};
// #############################################################
// Setup
// #############################################################
dotenv.config();
const app = express();
app.use(express.json());
// #############################################################
// Webhook Listeners
// #############################################################
// Genertic Webhook
app.post('/webhook', handlers.generic);
// Top.gg Votes
app.post(locations.topgg, handlers.topgg);
// Uptime Kuma Alerts
app.post(locations.uptimeKuma, handlers.uptimeKuma);
// Genertic Webhook
app.get('/webhook', handlers.generic);
// Top.gg Votes
app.get(locations.topgg, handlers.topgg);
// Uptime Kuma Alerts
app.get(locations.uptimeKuma, handlers.uptimeKuma);
// #############################################################
// Function Calls / Start Listening
// #############################################################
app.listen(port, () => {
console.log(`Webhook server is running on port ${port}`);
});