-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·86 lines (75 loc) · 2.53 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env node
// Require the necessary discord.js classes
const { Client, Intents, MessageActionRow, MessageButton, MessageEmbed } = require('discord.js');
const { token } = require('./config.json');
const { exec } = require('child_process');
// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
const wait = require('util').promisify(setTimeout);
// When the client is ready, run this code (only once)
client.once('ready', () => {
console.log('GoatBot loaded and ready to oof!');
});
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'control') {
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('goatdays_start')
.setLabel('Start Goatdays')
.setStyle('PRIMARY'),
new MessageButton()
.setCustomId('goatdays_stop')
.setLabel('Stop Goatdays')
.setStyle('DANGER'),
);
const embed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Start/Stop 7 Days to Die:')
.setURL('https://goattech.net/bots')
.setDescription('Scam da traders get the shmackers:');
await interaction.reply({
content: `yes melt my cpu wawaweewa`,
ephemeral: false,
components: [row],
embeds: [embed],
});
}
if (interaction.commandName === 'info') {
await interaction.reply('no u');
}
});
client.on('interactionCreate', async interaction => {
if (!interaction.isButton()) return;
if (interaction.customId === "goatdays_start") {
if (exec('docker ps | grep sdtd')) {
await interaction.reply('Server already running, get out there and scam!');
await wait(300000);
await interaction.deleteReply();
}
else {
await interaction.reply('Starting Goatdays, may you scam the traders and chug yucca smoothies');
console.log('goatdays start clicked!');
exec('cd $HOME/goatdays/alpha21 && docker compose up -d');
await wait(300000);
await interaction.deleteReply();
}
}
if (interaction.customId === "goatdays_stop") {
if (exec('docker ps | grep sdtd')) {
await interaction.reply('Stopping Goatdays, Trader Joel rejoices');
console.log('goatdays stop clicked!');
exec('cd $HOME/goatdays/alpha21 && docker compose stop');
await wait(300000);
await interaction.deleteReply();
}
else {
await interaction.reply('Server already stopped, come back to scam soon!');
await wait(300000);
await interaction.deleteReply();
}
}
});
// Login to Discord with your client's token
client.login(token);