Add some status stuff
This commit is contained in:
parent
373b6e1926
commit
28b6201a3a
10
index.js
10
index.js
|
@ -20,7 +20,7 @@ const fpbx = new FreepbxManager({
|
||||||
|
|
||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const client = new Discord.Client({
|
const client = new Discord.Client({
|
||||||
intents: [ "GuildMembers", "Guilds", "GuildPresences" ]
|
intents: ["GuildMembers", "Guilds", "GuildPresences"]
|
||||||
});
|
});
|
||||||
|
|
||||||
const colors = require('colors');
|
const colors = require('colors');
|
||||||
|
@ -56,7 +56,11 @@ global.log = log;
|
||||||
|
|
||||||
client.on('ready', async () => {
|
client.on('ready', async () => {
|
||||||
log.success(`Logged in as ${client.user.displayName}`);
|
log.success(`Logged in as ${client.user.displayName}`);
|
||||||
|
await client.setStatus("dnd");
|
||||||
|
await client.setActivity({
|
||||||
|
type: Discord.ActivityType.Custom,
|
||||||
|
name: "Just chillin"
|
||||||
|
})
|
||||||
const commands = require("./commands")
|
const commands = require("./commands")
|
||||||
// Command registration
|
// Command registration
|
||||||
log.info("Registering commands...")
|
log.info("Registering commands...")
|
||||||
|
@ -79,7 +83,7 @@ client.on('ready', async () => {
|
||||||
|
|
||||||
client.on('interactionCreate', async interaction => {
|
client.on('interactionCreate', async interaction => {
|
||||||
if (!interaction.inGuild()) return interaction.reply({ content: "This bot is not designed to be used in DMs.", ephemeral: true });
|
if (!interaction.inGuild()) return interaction.reply({ content: "This bot is not designed to be used in DMs.", ephemeral: true });
|
||||||
switch(interaction.type) {
|
switch (interaction.type) {
|
||||||
case Discord.InteractionType.ApplicationCommand:
|
case Discord.InteractionType.ApplicationCommand:
|
||||||
const command = require(`./interactionHandlers/commands/${interaction.commandName}`);
|
const command = require(`./interactionHandlers/commands/${interaction.commandName}`);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const { exec } = require('child_process');
|
const { exec } = require('child_process');
|
||||||
|
const Discord = require('discord.js');
|
||||||
const pool = global.pool
|
const pool = global.pool
|
||||||
const fpbx = global.fpbx
|
const fpbx = global.fpbx
|
||||||
const client = global.client
|
const client = global.client
|
||||||
|
@ -52,6 +52,12 @@ module.exports.execute = async (interaction) => {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'reboot': // Run `reboot 0`
|
case 'reboot': // Run `reboot 0`
|
||||||
|
await interaction.reply({ content: "Rebooting...", ephemeral: true });
|
||||||
|
await client.setStatus("dnd");
|
||||||
|
await client.setActivity({
|
||||||
|
type: Discord.ActivityType.Custom,
|
||||||
|
name: "Server Rebooting..."
|
||||||
|
})
|
||||||
await client.destroy();
|
await client.destroy();
|
||||||
log.info('Client destroyed.');
|
log.info('Client destroyed.');
|
||||||
pool.end((err) => {
|
pool.end((err) => {
|
||||||
|
@ -61,9 +67,7 @@ module.exports.execute = async (interaction) => {
|
||||||
log.info('Database pool closed.');
|
log.info('Database pool closed.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
runCommand('reboot 0').then((res) => {
|
runCommand('reboot 0');
|
||||||
interaction.reply({ content: "Rebooting...", ephemeral: true });
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue