Skip to content

Commit

Permalink
publish ready
Browse files Browse the repository at this point in the history
  • Loading branch information
GiorgioBrux committed Sep 14, 2021
1 parent 6d08aab commit 956ee4c
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 20 deletions.
62 changes: 62 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.0.0",
"description": "",
"main": "src/index.js",
"engines": {
"node": ">=14"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand All @@ -17,8 +20,8 @@
},
"homepage": "https://github.com/GiorgioBrux/nitro-sniper-ui#readme",
"dependencies": {
"socket.io": "^4.2.0",
"on-change": "^4.0.0",
"simple-git": "^2.45.1"
"simple-git": "^2.45.1",
"socket.io": "^4.2.0"
}
}
63 changes: 63 additions & 0 deletions settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"tokens": {
"main": "",
"alts": [""]
},
"mode": "both",
"status": {
"main": "default",
"alts": "default"
},
"nitro": {
"max": 2,
"cooldown": 24
},
"giveaway": {
"enabled": true,
"delay": 30,
"dm": true,
"dmMessage": "Hey, i won the giveaway. Could i redeem my prize?",
"dmDelay": 25,
"blacklistedWords": ["bot", "test", "ban"],
"whitelistOnly": false,
"whitelistedWords": ["nitro"],
"blacklistedServers": [""],
"whitelistServersOnly": false,
"whitelistedServers": [""]
},
"invite": {
"enabled": false,
"delay": {
"min": 10,
"max": 20
},
"members": {
"min": 1500,
"max": 50000
},
"max": 10,
"cooldown": 6,
"onlyAlts": true
},
"webhook": {
"url": "",
"enabled": {
"codeInvalid": false,
"codeAlreadyRedeemed": false,
"codeSuccess": true,
"giveawayEntered": true,
"giveawayWin": true,
"inviteJoin": false,
"inviteFail": false
},
"mentionEveryone": {
"codeInvalid": false,
"codeAlreadyRedeemed": false,
"codeSuccess": true,
"giveawayEntered": false,
"giveawayWin": true,
"inviteJoin": false,
"inviteFail": false
}
}
}
2 changes: 1 addition & 1 deletion slowsniper
2 changes: 1 addition & 1 deletion sniperweb
37 changes: 24 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const slowsniper = require("../slowsniper/src/index");
const { status } = require("./const");
const { Logger } = require("./log");
const { Update } = require("./update");
const fs = require("fs");
const path = require("path");
const settingspath = path.join(__dirname, "..", "settings.json");

global.io = require("socket.io")({
cors: {
Expand Down Expand Up @@ -29,6 +32,16 @@ class SniperRun {
socket.on("updateall", () => {
update.updateall();
});

socket.on("settingupdate", (data) => {
global.settings = data;
try {
fs.writeFileSync(settingspath, JSON.stringify(data));
} catch {}
});
socket.on("settingrequest", () => {
socket.emit("settingback", global.settings);
});
});
}
#config = {
Expand All @@ -53,10 +66,12 @@ class SniperRun {
console.log("Starting sniper...");
this.#config.status = status.STARTING;
await slowsniper.init();
this.#config.status = status.RUNNING;
this.#config.accounts = global.active.length;
this.#config.servers = global.guildCount;
this.#config.uptime = new Date().toISOString();
if (global.active.length !== 0) {
this.#config.status = status.RUNNING;
this.#config.accounts = global.active.length;
this.#config.servers = global.guildCount;
this.#config.uptime = new Date().toISOString();
}
}

async stopSniper() {
Expand Down Expand Up @@ -89,15 +104,11 @@ class SniperRun {
}

async function init() {
process.env.settings = `{
tokens: {
main: 'ODg2MzE3MTE3MzQ2MDU0MjA1.YT0Agg.uFRnaSX3mDyrqBw5zWuxnbhqu54',
alts: [
'',
],
},
mode: 'main'
}`;
try {
await fs.readFile(settingspath, "utf-8", (err, data) => {
global.settings = JSON.parse(data);
});
} catch {}

global.sniper = new SniperRun();
global.weblogger = new Logger();
Expand Down
6 changes: 3 additions & 3 deletions src/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class Update {
sniper: false,
};

const controllerstatus = await this.git.status();
const controllerstatus = await this.git.fetch().status();

const gitwebsite = simpleGit(process.cwd() + "/sniperweb");
const gitsniper = simpleGit(process.cwd() + "/slowsniper");

const websitestatus = await gitwebsite.status();
const sniperstatus = await gitsniper.status();
const websitestatus = await gitwebsite.fetch().status();
const sniperstatus = await gitsniper.fetch().status();

if (controllerstatus.behind > 0) updates.controller = true;
if (websitestatus.behind > 0) updates.website = true;
Expand Down

0 comments on commit 956ee4c

Please sign in to comment.