This repository was archived by the owner on Sep 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
68 lines (65 loc) · 2.07 KB
/
run.sh
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
#!/bin/bash
if [ -d "./Bot" ]
then echo "Error: Directory ./Bot exists"
echo "Overwrite? [ y / n]"
read yesno
if [ $yesno = "y" ]
then rm -r ./Bot
echo "Please Run this again to redo the setup!"
else echo "Exiting..."
fi
else
echo "Directory ./Bot does not exist. Creating it now..."
mkdir Bot && cd Bot
touch index.js && touch config.json
echo "Add your Bot Token now..."
read -s Token
echo "Add your OwnerID now..."
read OwnerID
echo "Add your Prefix now."
read Prefix
echo "const Discord = require('discord.js');" >> index.js
echo "const client = new Discord.Client()" >> index.js
echo "const config = require('./config.json');" >> index.js
echo "const prefix = config.prefix;" >> index.js
echo " " >> index.js
echo "client.on('ready', () =>{" >> index.js
echo " console.log('Ready!');" >> index.js
echo "});" >> index.js
echo "client.on('message', (message) =>{" >>index.js
echo " if (message.author.bot) return;" >> index.js
echo " if (message.content === prefix + 'ping')" >> index.js
echo " message.channel.send('pang');" >> index.js
echo "});" >> index.js
echo "client.login(config.token);" >> index.js
echo "{" >> config.json
echo ' "token": "'$Token'",' >> config.json
echo ' "OwnerID": "'$OwnerID'",' >> config.json
echo ' "prefix": "'$Prefix'"' >> config.json
echo "}" >> config.json
echo "# installing discord.js now with npm"
if which node > /dev/null
then
echo "Node is installed, continuing npm..."
else
echo "Node is Not installed! Installing..."
apt update && apt upgrade
apt install nodejs -y
fi
if [ -f "../package.json" ]
then mv ../package.json . && npm install
else npm init -y > /dev/null && npm install discord.js
echo '# Successfully created basic bot...'
if [ -f "../run.sh" ]
then echo "File ./run.sh still exists."
echo "Delete? [ y / n]"
read yaynay
if [ $yaynay = "y" ]
then echo "Deleted run.sh & Starting!"
rm -r ./run.sh && node index.js
else echo "Keeping run.sh & Starting Bot!"
node ./index.js
fi
fi
fi
fi