Compare commits
4 Commits
f6adafe735
...
fcfb3e290f
| Author | SHA1 | Date | |
|---|---|---|---|
| fcfb3e290f | |||
| 1bf5e9d64f | |||
| 219d3e55e7 | |||
| 4f696e8b21 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
node_modules
|
node_modules
|
||||||
token
|
token
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
log
|
||||||
@@ -32,7 +32,8 @@ Download and install [Node.js](https://nodejs.org/en/)
|
|||||||
<summary><b>Mac/Linux Screen</b></summary>
|
<summary><b>Mac/Linux Screen</b></summary>
|
||||||
<br>
|
<br>
|
||||||
<p>Screen allows the bot to run in the background without a terminal present</p>
|
<p>Screen allows the bot to run in the background without a terminal present</p>
|
||||||
<p>Installing</p>
|
<p><a href="https://linuxize.com/post/how-to-use-linux-screen/">Tutorial for usage</a>, check if it's installed already before installing</p>
|
||||||
|
<p><b>Installing</b></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p>Mac</p>
|
<p>Mac</p>
|
||||||
@@ -54,7 +55,8 @@ Download and install [Node.js](https://nodejs.org/en/)
|
|||||||
<summary><b>Mac/Linux Tmux</b></summary>
|
<summary><b>Mac/Linux Tmux</b></summary>
|
||||||
<br>
|
<br>
|
||||||
<p>Tmux allows the bot to run in the background without a terminal present</p>
|
<p>Tmux allows the bot to run in the background without a terminal present</p>
|
||||||
<p>Installing</p>
|
<p><a href="https://linuxize.com/post/getting-started-with-tmux/">Tutorial for usage</a>, check if it's installed already before installing</p>
|
||||||
|
<p><b>Installing</b></p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p>Mac</p>
|
<p>Mac</p>
|
||||||
|
|||||||
1
dist/index.js
vendored
1
dist/index.js
vendored
@@ -34,6 +34,7 @@ const api_1 = require("./api");
|
|||||||
const discord_1 = require("./discord");
|
const discord_1 = require("./discord");
|
||||||
const queue_1 = require("./queue");
|
const queue_1 = require("./queue");
|
||||||
const CLIENT = new discord_js_1.Client({ intents: [discord_js_1.Intents.FLAGS.GUILDS] });
|
const CLIENT = new discord_js_1.Client({ intents: [discord_js_1.Intents.FLAGS.GUILDS] });
|
||||||
|
console.log(new Date().toISOString() + '\n\n');
|
||||||
if (!fs.existsSync('./token')) {
|
if (!fs.existsSync('./token')) {
|
||||||
fs.writeFileSync('./token', '');
|
fs.writeFileSync('./token', '');
|
||||||
console.error('Missing Discord Token, please enter the bot token into the token file');
|
console.error('Missing Discord Token, please enter the bot token into the token file');
|
||||||
|
|||||||
79
package.json
79
package.json
@@ -1,43 +1,44 @@
|
|||||||
{
|
{
|
||||||
"name": "1800queue",
|
"name": "1800queue",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"start": "node .",
|
"start": "node .",
|
||||||
"watch": "npm-watch",
|
"watch": "npm-watch",
|
||||||
"dev": "npm-watch"
|
"dev": "npm-watch",
|
||||||
},
|
"getname": "echo $npm_package_name"
|
||||||
"watch": {
|
|
||||||
"build": {
|
|
||||||
"patterns": [
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"extensions": "ts",
|
|
||||||
"legacyWatch": true
|
|
||||||
},
|
},
|
||||||
"start": {
|
"watch": {
|
||||||
"patterns": [
|
"build": {
|
||||||
"dist"
|
"patterns": [
|
||||||
],
|
"src"
|
||||||
"extensions": "js",
|
],
|
||||||
"legacyWatch": true,
|
"extensions": "ts",
|
||||||
"runOnChangeOnly": true
|
"legacyWatch": true
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"patterns": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"extensions": "js",
|
||||||
|
"legacyWatch": true,
|
||||||
|
"runOnChangeOnly": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^17.0.13",
|
||||||
|
"npm-watch": "^0.11.0",
|
||||||
|
"ts-node": "^10.4.0",
|
||||||
|
"typescript": "^4.5.5"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@discordjs/rest": "^0.3.0",
|
||||||
|
"cheerio": "^1.0.0-rc.10",
|
||||||
|
"discord-api-types": "^0.26.1",
|
||||||
|
"discord.js": "^13.6.0"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"author": "",
|
|
||||||
"license": "MIT",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^17.0.13",
|
|
||||||
"npm-watch": "^0.11.0",
|
|
||||||
"ts-node": "^10.4.0",
|
|
||||||
"typescript": "^4.5.5"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@discordjs/rest": "^0.3.0",
|
|
||||||
"cheerio": "^1.0.0-rc.10",
|
|
||||||
"discord-api-types": "^0.26.1",
|
|
||||||
"discord.js": "^13.6.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
|
|
||||||
#change to ccurrent directory
|
#change to ccurrent directory
|
||||||
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#change to ccurrent directory
|
#change to current directory
|
||||||
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
@@ -27,14 +27,16 @@ echo $num > log/number
|
|||||||
#watchdog
|
#watchdog
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
|
|
||||||
#increment log file number
|
#increment log file number
|
||||||
num=$(( num + 1 ))
|
num=$(( num + 1 ))
|
||||||
echo $num > log/number
|
echo $num > log/number
|
||||||
|
|
||||||
#run
|
#run
|
||||||
npm start >> log/$num.out 2> log/$num.err
|
npm start 2> log/$num.err | tee log/$num.out
|
||||||
|
|
||||||
#give chance to close program
|
#give chance to close program
|
||||||
sleep 5
|
|
||||||
printf "\n\n\n${C1}press ${C2}Control+C${C1} to close${NC}\n\n\n"
|
printf "\n\n\n${C1}press ${C2}Control+C${C1} to close${NC}\n\n\n"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
done
|
done
|
||||||
12
scripts/mac-linux/start_screen
Executable file
12
scripts/mac-linux/start_screen
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#change to ccurrent directory
|
||||||
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
||||||
|
|
||||||
|
#start
|
||||||
|
if [[ $(screen -ls | grep $(npm run getname -s)) ]]; then
|
||||||
|
echo "Session already exists"
|
||||||
|
else
|
||||||
|
screen -S $(npm run getname -s) -d -m ./start
|
||||||
|
echo "Created session"
|
||||||
|
fi
|
||||||
12
scripts/mac-linux/start_tmux
Executable file
12
scripts/mac-linux/start_tmux
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#change to ccurrent directory
|
||||||
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
||||||
|
|
||||||
|
#start
|
||||||
|
if [[ $(tmux ls | grep $(npm run getname -s)) ]]; then
|
||||||
|
echo "Session already exists"
|
||||||
|
else
|
||||||
|
tmux new-session -d -s $(npm run getname -s) ./start
|
||||||
|
echo "Created session"
|
||||||
|
fi
|
||||||
7
scripts/windows/install.bat
Normal file
7
scripts/windows/install.bat
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
@REM change to ccurrent directory
|
||||||
|
cd %~f0\..\..\..\
|
||||||
|
|
||||||
|
@REM run
|
||||||
|
npm install
|
||||||
29
scripts/windows/start.bat
Normal file
29
scripts/windows/start.bat
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
@Rem change to current directory
|
||||||
|
cd %~f0\..\..\..\
|
||||||
|
|
||||||
|
@Rem make log folder
|
||||||
|
if not exist log mkdir log
|
||||||
|
|
||||||
|
@Rem current file number
|
||||||
|
set /A num=0
|
||||||
|
if exist log\number set /p num=<log\number
|
||||||
|
|
||||||
|
echo %num > log\number
|
||||||
|
|
||||||
|
@Rem watchdog
|
||||||
|
:watchdog
|
||||||
|
|
||||||
|
@Rem increment log file number
|
||||||
|
set /A num=num+1
|
||||||
|
echo %num > log\number
|
||||||
|
|
||||||
|
@Rem run
|
||||||
|
powershell "npm start 2> log\%num%.err | tee log\%num%.out"
|
||||||
|
|
||||||
|
|
||||||
|
@Rem give chance to close program
|
||||||
|
timeout /t 5 /nobreak
|
||||||
|
|
||||||
|
goto watchdog
|
||||||
@@ -6,6 +6,8 @@ import { registerCommands } from './discord';
|
|||||||
import { createQueue, joinQueue, queueInfo } from './queue';
|
import { createQueue, joinQueue, queueInfo } from './queue';
|
||||||
const CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] });
|
const CLIENT = new Client({ intents: [Intents.FLAGS.GUILDS] });
|
||||||
|
|
||||||
|
console.log(new Date().toISOString()+'\n\n');
|
||||||
|
|
||||||
if (!fs.existsSync('./token')) {
|
if (!fs.existsSync('./token')) {
|
||||||
fs.writeFileSync('./token', '');
|
fs.writeFileSync('./token', '');
|
||||||
console.error('Missing Discord Token, please enter the bot token into the token file');
|
console.error('Missing Discord Token, please enter the bot token into the token file');
|
||||||
|
|||||||
Reference in New Issue
Block a user