7 Commits

3 changed files with 15 additions and 5 deletions

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
@@ -13,7 +13,7 @@ A status bot and other features for protojx.
| 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

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);
}); });