1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-18 04:40:59 -05:00

Compare commits

..

No commits in common. "8b541cbed30c290d4eedb8f63fad29579c8813dd" and "4fb097fa70c20d83f55351455264004101f1f800" have entirely different histories.

9 changed files with 73 additions and 17 deletions

View File

@ -1,6 +1,6 @@
# Pointless stuff # Pointless stuff
Dockerfile Dockerfile
docker-compose.*.yml docker-compose.yml
.ncurc.json .ncurc.json
.env .env
.mailmap .mailmap
@ -9,6 +9,8 @@ docker-compose.*.yml
.github .github
postgres-replica-stuff postgres-replica-stuff
README.md README.md
ufwReject.sh
# Startup files # Startup files
startDocker.sh startWithYarn.cjs
botStartup.bat

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.env .env
ips.txt
# Yarn stuff # Yarn stuff
.yarn .yarn
# TypeScript stuff # TypeScript stuff

20
.pnp.cjs generated
View File

@ -29,7 +29,7 @@ const RAW_RUNTIME_STATE =
["@napi-rs/canvas", "npm:0.1.45"],\ ["@napi-rs/canvas", "npm:0.1.45"],\
["@octokit/rest", "npm:20.0.2"],\ ["@octokit/rest", "npm:20.0.2"],\
["@sequelize/core", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:7.0.0-alpha.37"],\ ["@sequelize/core", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:7.0.0-alpha.37"],\
["@toast/tokenservice-client", "npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz"],\ ["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\
["@types/ms", "npm:0.7.34"],\ ["@types/ms", "npm:0.7.34"],\
["@types/node", "npm:20.11.17"],\ ["@types/node", "npm:20.11.17"],\
["@types/node-cron", "npm:3.0.11"],\ ["@types/node-cron", "npm:3.0.11"],\
@ -708,11 +708,11 @@ const RAW_RUNTIME_STATE =
}]\ }]\
]],\ ]],\
["@toast/tokenservice-client", [\ ["@toast/tokenservice-client", [\
["npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz", {\ ["npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz", {\
"packageLocation": "./.yarn/cache/@toast-tokenservice-client-npm-1.0.12-11df688697-64112744b4.zip/node_modules/@toast/tokenservice-client/",\ "packageLocation": "./.yarn/cache/@toast-tokenservice-client-npm-1.0.11-c95d3498fc-c910af2b01.zip/node_modules/@toast/tokenservice-client/",\
"packageDependencies": [\ "packageDependencies": [\
["@toast/tokenservice-client", "npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz"],\ ["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\
["undici", "npm:6.6.2"]\ ["undici", "npm:6.5.0"]\
],\ ],\
"linkType": "HARD"\ "linkType": "HARD"\
}]\ }]\
@ -858,7 +858,7 @@ const RAW_RUNTIME_STATE =
["@napi-rs/canvas", "npm:0.1.45"],\ ["@napi-rs/canvas", "npm:0.1.45"],\
["@octokit/rest", "npm:20.0.2"],\ ["@octokit/rest", "npm:20.0.2"],\
["@sequelize/core", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:7.0.0-alpha.37"],\ ["@sequelize/core", "virtual:20c353e2d6536e37339997f03975c6a660f4d296e664d291bd43620c6162cca8eb5ef90b0998dc9db75ff6862e5da587d0530bae26805f5fadc8f17aaa4ff794#npm:7.0.0-alpha.37"],\
["@toast/tokenservice-client", "npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz"],\ ["@toast/tokenservice-client", "npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"],\
["@types/ms", "npm:0.7.34"],\ ["@types/ms", "npm:0.7.34"],\
["@types/node", "npm:20.11.17"],\ ["@types/node", "npm:20.11.17"],\
["@types/node-cron", "npm:3.0.11"],\ ["@types/node-cron", "npm:3.0.11"],\
@ -1604,6 +1604,14 @@ const RAW_RUNTIME_STATE =
],\ ],\
"linkType": "HARD"\ "linkType": "HARD"\
}],\ }],\
["npm:6.5.0", {\
"packageLocation": "./.yarn/cache/undici-npm-6.5.0-5598def435-0ad9289bd8.zip/node_modules/undici/",\
"packageDependencies": [\
["undici", "npm:6.5.0"],\
["@fastify/busboy", "npm:2.0.0"]\
],\
"linkType": "HARD"\
}],\
["npm:6.6.2", {\ ["npm:6.6.2", {\
"packageLocation": "./.yarn/cache/undici-npm-6.6.2-a0bd6785a6-e08ac9c279.zip/node_modules/undici/",\ "packageLocation": "./.yarn/cache/undici-npm-6.6.2-a0bd6785a6-e08ac9c279.zip/node_modules/undici/",\
"packageDependencies": [\ "packageDependencies": [\

1
botStartup.bat Normal file
View File

@ -0,0 +1 @@
pm2 start startWithYarn.cjs --name Daggerbot

View File

@ -35,7 +35,7 @@
"@napi-rs/canvas": "0.1.45", "@napi-rs/canvas": "0.1.45",
"@octokit/rest": "20.0.2", "@octokit/rest": "20.0.2",
"@sequelize/core": "7.0.0-alpha.37", "@sequelize/core": "7.0.0-alpha.37",
"@toast/tokenservice-client": "1.0.12", "@toast/tokenservice-client": "1.0.11",
"ansi-colors": "4.1.3", "ansi-colors": "4.1.3",
"dayjs": "1.11.10", "dayjs": "1.11.10",
"discord.js": "14.14.1", "discord.js": "14.14.1",

View File

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
docker compose -f docker-compose.bot.yml down && \
docker compose -f docker-compose.bot.yml build && \ docker compose -f docker-compose.bot.yml build && \
docker compose -f docker-compose.bot.yml up -d --remove-orphans docker compose -f docker-compose.bot.yml up -d
exit 0 exit 0

1
startWithYarn.cjs Normal file
View File

@ -0,0 +1 @@
require('node:child_process').spawn('yarn node dist/index.js', {stdio: [null,process.stdout,process.stderr,null], windowsHide: true, shell: true})

35
ufwReject.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root or sudo"
exit 1
fi
# Store the IP addresses in a file
IP_ADDRESSES_STORE="ips.txt"
# Scan the kernel log for IP addresses and store them in a file
dmesg | grep 'SRC=' | awk -F'SRC=' '{ print $2 }' | awk '{ print $1 }' | sort | uniq | head -n 5000 > "$IP_ADDRESSES_STORE"
# Initialize a counter for new IPs
new_ips=0
# Store the output of ufw status in a variable
ufw_status=$(ufw status)
# Populate the UFW reject rule with the IP addresses collected from the kernel log
while IFS= read -r ip
do
ip_prefix="${ip%.*}"
# Check if the IP is already in the UFW rules
if ! echo "$ufw_status" | grep -q "$ip" && [ "$ip_prefix" != "${TOAST_IP%.*}" ]
then
ufw reject from $ip
# Increment the counter
((new_ips++))
fi
done < "$IP_ADDRESSES_STORE"
echo "Done populating UFW reject rule"
echo "$new_ips IP addresses were added"
exit 0

View File

@ -500,12 +500,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@toast/tokenservice-client@npm:1.0.12": "@toast/tokenservice-client@npm:1.0.11":
version: 1.0.12 version: 1.0.11
resolution: "@toast/tokenservice-client@npm:1.0.12::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.12%2Ftokenservice-client-1.0.12.tgz" resolution: "@toast/tokenservice-client@npm:1.0.11::__archiveUrl=https%3A%2F%2Fgit.toast-server.net%2Fapi%2Fpackages%2Ftoast%2Fnpm%2F%2540toast%252Ftokenservice-client%2F-%2F1.0.11%2Ftokenservice-client-1.0.11.tgz"
dependencies: dependencies:
undici: "npm:6.6.2" undici: "npm:6.5.0"
checksum: 10/64112744b4bfefb9018f8125e5e54653ff8af3bff493ae1767bd6db0c123a9052dbfa8ea0a3e2f4d8db3ebfb6c2b6823104f288721ba9304c04734f64aeb46c9 checksum: 10/c910af2b01876ca53de3078cf6b20c3cd8619ed807c3ce573074bc886a8690e6edc43f961088acf4bc2a7e925e8a0cb0e35df930b5923b20ecbbad6fd9bf4c81
languageName: node languageName: node
linkType: hard linkType: hard
@ -626,7 +626,7 @@ __metadata:
"@napi-rs/canvas": "npm:0.1.45" "@napi-rs/canvas": "npm:0.1.45"
"@octokit/rest": "npm:20.0.2" "@octokit/rest": "npm:20.0.2"
"@sequelize/core": "npm:7.0.0-alpha.37" "@sequelize/core": "npm:7.0.0-alpha.37"
"@toast/tokenservice-client": "npm:1.0.12" "@toast/tokenservice-client": "npm:1.0.11"
"@types/ms": "npm:0.7.34" "@types/ms": "npm:0.7.34"
"@types/node": "npm:20.11.17" "@types/node": "npm:20.11.17"
"@types/node-cron": "npm:3.0.11" "@types/node-cron": "npm:3.0.11"
@ -1270,6 +1270,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"undici@npm:6.5.0":
version: 6.5.0
resolution: "undici@npm:6.5.0"
dependencies:
"@fastify/busboy": "npm:^2.0.0"
checksum: 10/0ad9289bd8dc8a5ee8cf81a48a629a59c33814702ae706b1d8e7c7fac3cfa85bd6a73943db5d9379f4d420858d239ed3857ec1003e517ddb67eb44fdbc227f3e
languageName: node
linkType: hard
"undici@npm:6.6.2": "undici@npm:6.6.2":
version: 6.6.2 version: 6.6.2
resolution: "undici@npm:6.6.2" resolution: "undici@npm:6.6.2"