17 Commits

Author SHA1 Message Date
c99c11c241 feat(status): add new game server notification for RYZEN-GAME 02 2025-11-07 10:32:17 +01:00
df048c1352 fix(status): remove unnecessary quotes from host and name properties 2025-11-04 18:13:17 +01:00
290e8b982a feat(status): enhance website status message with globe icon and separator 2025-11-03 18:32:35 +01:00
8bfeb1c43c fix(status): update status message to include website link in notifications 2025-11-03 18:27:35 +01:00
e2a8255d5a fix(docker): comment out npm run register command in Dockerfile 2025-11-03 18:17:58 +01:00
85ec27cb2b fix(docker): correct npm command to run register in Dockerfile 2025-11-03 18:09:38 +01:00
e2c896c6f1 fix(readme): update deployment workflow status to in production 2025-11-03 18:06:00 +01:00
3ff4278217 feat(deploy): add GitHub Actions workflow for deployment to VPS 2025-11-03 18:05:47 +01:00
7b80aca9e1 fix(status): update timestamp format in notifications to include full date and time 2025-11-03 14:36:24 +01:00
afd8d1f68a fix(status): integrate dayjs for formatted timestamps in notifications 2025-11-03 14:35:06 +01:00
c571e03495 fix(client): log loaded guild configurations on client ready 2025-11-03 14:24:47 +01:00
a577f99277 fix(live_status): remove ephemeral flag from error message in channel permissions 2025-11-03 13:41:09 +01:00
4b6b2c8575 fix(live_status): change reply to editReply for error handling in channel permissions 2025-11-03 13:40:39 +01:00
e375fb2631 fix(live_status): handle errors when sending messages to the channel 2025-11-03 13:38:51 +01:00
39178d1322 fix(readme): correct project title to "Protojx Manager" 2025-11-03 13:32:09 +01:00
d7b772544f fix(live_status): add default member permissions for command execution 2025-11-03 13:23:33 +01:00
27fc82d371 fix(readme): update status of filter feature to reflect production readiness 2025-11-03 13:21:34 +01:00
8 changed files with 95 additions and 19 deletions

52
.github/workflows/deploy.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
# This is a basic workflow to help you get started with Actions
name: Deploy
# Controls when the workflow will run
on:
push:
tags:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Setup SSH Agent
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add VPS to known_hosts
run: |
ssh-keyscan -p ${{ secrets.VPS_PORT }} -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts
- name: Deploy to VPS
run: |
ssh -p ${{ secrets.VPS_PORT }} ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "
cd /home/${{ secrets.VPS_USER }}/protojx/protojx-manager &&
git pull &&
# Stop and remove old container if exists
docker stop protojx_manager 2>/dev/null || true &&
docker rm protojx_manager 2>/dev/null || true &&
# Build new image
docker buildx build -t protojx_manager . &&
# Run new container
docker run -d \
--name protojx_manager \
--restart unless-stopped \
--network shared \
protojx_manager
"

View File

@@ -7,4 +7,6 @@ COPY . .
RUN apt-get update && apt-get install -y iputils-ping RUN apt-get update && apt-get install -y iputils-ping
RUN npm i RUN npm i
# RUN npm run register
CMD [ "npm", "run", "start" ] CMD [ "npm", "run", "start" ]

View File

@@ -1,4 +1,4 @@
# Protojx Manager Non Official # Protojx Manager
A status bot and other features for protojx. A status bot and other features for protojx.
- Add the bot : https://discord.com/oauth2/authorize?client_id=1432680068085190656 - Add the bot : https://discord.com/oauth2/authorize?client_id=1432680068085190656
@@ -12,8 +12,8 @@ A status bot and other features for protojx.
| Number of services down in the bot's status. | 🌐 | | Number of services down in the bot's status. | 🌐 |
| Notification system in case of downtime. | 🌐 | | Notification system in case of downtime. | 🌐 |
| Ability to create persistent status messages that update automatically. (/live_status) | 🌐 | | Ability to create persistent status messages that update automatically. (/live_status) | 🌐 |
| Deployment workflow on Oracle VPS. | | | Deployment workflow on Oracle VPS. | 🌐 |
| Filter for notifs. | | | Filter for notifs. | 🌐 |
- 🌐 -> In production - 🌐 -> In production
- ✅ -> Done - ✅ -> Done

7
package-lock.json generated
View File

@@ -11,6 +11,7 @@
"dependencies": { "dependencies": {
"@types/ping": "^0.4.4", "@types/ping": "^0.4.4",
"cron": "^4.3.3", "cron": "^4.3.3",
"dayjs": "^1.11.19",
"discord.js": "^14.24.2", "discord.js": "^14.24.2",
"dotenv": "^17.2.2", "dotenv": "^17.2.2",
"pg": "^8.16.3", "pg": "^8.16.3",
@@ -552,9 +553,9 @@
} }
}, },
"node_modules/dayjs": { "node_modules/dayjs": {
"version": "1.11.18", "version": "1.11.19",
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.18.tgz", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.19.tgz",
"integrity": "sha512-zFBQ7WFRvVRhKcWoUh+ZA1g2HVgUbsZm9sbddh8EC5iv93sui8DVVz1Npvz+r6meo9VKfa8NyLWBsQK1VvIKPA==", "integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/debug": { "node_modules/debug": {

View File

@@ -30,6 +30,7 @@
"dependencies": { "dependencies": {
"@types/ping": "^0.4.4", "@types/ping": "^0.4.4",
"cron": "^4.3.3", "cron": "^4.3.3",
"dayjs": "^1.11.19",
"discord.js": "^14.24.2", "discord.js": "^14.24.2",
"dotenv": "^17.2.2", "dotenv": "^17.2.2",
"pg": "^8.16.3", "pg": "^8.16.3",

View File

@@ -1,4 +1,4 @@
import { ApplicationIntegrationType, ChannelType, ContainerBuilder, MessageFlags, SlashCommandBuilder } from "discord.js"; import { ApplicationIntegrationType, ChannelType, ContainerBuilder, MessageFlags, PermissionFlagsBits, SlashCommandBuilder } from "discord.js";
import { CommandDefinition } from "../../type"; import { CommandDefinition } from "../../type";
import statusService from "../../services/status.service"; import statusService from "../../services/status.service";
import { AppDataSource } from "../../data-source"; import { AppDataSource } from "../../data-source";
@@ -16,7 +16,8 @@ const cmd : CommandDefinition = {
) )
.setIntegrationTypes( .setIntegrationTypes(
ApplicationIntegrationType.GuildInstall ApplicationIntegrationType.GuildInstall
), )
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async execute(interaction) { async execute(interaction) {
await interaction.deferReply({flags: [MessageFlags.Ephemeral]}); await interaction.deferReply({flags: [MessageFlags.Ephemeral]});
@@ -25,7 +26,13 @@ const cmd : CommandDefinition = {
const channel = await interaction.guild?.channels.fetch(channel_options?.id); const channel = await interaction.guild?.channels.fetch(channel_options?.id);
if(channel?.isSendable()) { if(channel?.isSendable()) {
const message = await channel.send({components: [statusService.getUpdatedContainer(true)], flags: [MessageFlags.IsComponentsV2]}); let message;
try {
message = await channel.send({components: [statusService.getUpdatedContainer(true)], flags: [MessageFlags.IsComponentsV2]});
} catch (error) {
await interaction.editReply({content: 'An error has occurred. Please check the permissions for the channel.'});
return;
}
try { try {
const guildRepo = AppDataSource.getRepository(Guild); const guildRepo = AppDataSource.getRepository(Guild);

View File

@@ -86,6 +86,9 @@ client.on(Events.InteractionCreate, async interaction => {
client.once(Events.ClientReady, readyClient => { client.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`); console.log(`Ready! Logged in as ${readyClient.user.tag}`);
client.guilds.cache.forEach((value) => {
console.log(`${value.name} conf loaded !`);
});
statusService.setClient(client); statusService.setClient(client);
}); });

View File

@@ -7,6 +7,7 @@ import { HostsLog } from "../entity/hostslog.entity";
import { Repository } from "typeorm"; import { Repository } from "typeorm";
import { Follow } from "../entity/follow.entity"; import { Follow } from "../entity/follow.entity";
import { Guild } from "../entity/guild.entity"; import { Guild } from "../entity/guild.entity";
import dayjs from "dayjs";
type Nofity = {time: Date, name : string, alive : boolean, type : InfraType, host: string}; type Nofity = {time: Date, name : string, alive : boolean, type : InfraType, host: string};
@@ -14,16 +15,16 @@ export class StatusService {
public hosts: Host[] = [ public hosts: Host[] = [
{ {
'host': 'https://protojx.com', host: 'https://protojx.com',
'name': 'Protojx Website', name: 'Protojx Website',
alive: false, alive: false,
ping_type: 'website', ping_type: 'website',
type: 'website', type: 'website',
notify: false notify: false
}, },
{ {
'host': 'https://manager.protojx.com', host: 'https://manager.protojx.com',
'name': 'Espace Client', name: 'Espace Client',
alive: false, alive: false,
ping_type: 'website', ping_type: 'website',
type: 'website', type: 'website',
@@ -93,6 +94,14 @@ export class StatusService {
type: 'games', type: 'games',
notify: true notify: true
}, },
{
host: '5.178.99.17',
name: 'RYZEN-GAME 02',
alive: false,
ping_type: 'ping',
type: 'games',
notify: true
},
{ {
host: '5.178.99.63', host: '5.178.99.63',
name: 'XEON-GAME 01', name: 'XEON-GAME 01',
@@ -296,15 +305,16 @@ export class StatusService {
(text) => (text) =>
text.setContent('## ' + sectionData.title + '\n' + hostTexts.filter((v) => v.type == sectionData.type).map((v) => v.value).join('\n')) text.setContent('## ' + sectionData.title + '\n' + hostTexts.filter((v) => v.type == sectionData.type).map((v) => v.value).join('\n'))
) )
.setThumbnailAccessory( .setThumbnailAccessory(
(acc) => (acc) =>
acc.setURL(sectionData.thumbnail) acc.setURL(sectionData.thumbnail)
) )
) )
}); });
const now = new Date(); container.addSeparatorComponents((s) => s);
container.addTextDisplayComponents((text) => text.setContent(`${live ? 'Last update : ' : ''}${now.getDate()}-${now.getMonth() + 1}-${now.getFullYear()} ${(now.getHours() + '').padStart(2, "0")}:${(now.getMinutes() + '').padStart(2, "0")} - Receive automatic notifications when there is an outage with /follow !`));
container.addTextDisplayComponents((text) => text.setContent(`:globe_with_meridians: Website Status : https://statut.protojx.com/\n${live ? 'Last update : ' : ''}<t:${dayjs().unix()}:f> - Receive automatic notifications when there is an outage with /follow !`));
return container; return container;
} }