Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
fix: heroku suspension | closes #29
Browse files Browse the repository at this point in the history
  • Loading branch information
eternal committed Feb 20, 2021
1 parent fdaeae3 commit cd5431f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 41 deletions.
34 changes: 8 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,6 @@
- Minimum delay before sniping invite
- Maximum delay before sniping invite

## Installation
#### Heroku
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/slow/nitro-sniper/tree/main)

- Resources > Turn off the `web` toggle and turn on the `worker` toggle.
- `More` dropdown > View Logs

#### Local

- Make sure [Node](https://nodejs.org/en/) and [Git](https://git-scm.com/downloads) are installed on your system.
- Open a command prompt/terminal
- Run `cd %userprofile%\Downloads`
- Run `git clone https://github.com/slow/nitro-sniper nitro-sniper`
- Run `cd nitro-sniper`
- Run `npm install`
- Edit `.env` with the configuration you wish to use
- Run `node .`

## Default Configuration
```js
{
Expand Down Expand Up @@ -128,13 +110,13 @@
}
```

[How to obtain your token](https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs#how-to-get-a-user-token)
#### How to obtain your token
https://github.com/Tyrrrz/DiscordChatExporter/wiki/Obtaining-Token-and-Channel-IDs#how-to-get-a-user-token

## Tips
- The less the latency to discord servers, the better; You could be competing with other snipers. <br>
- High bandwidth hosting would benefit the sniper.
- There's a really high risk you might get terminated using this. <br>
- Do not mention you have this anywhere. <br>
- This is theoretically stealing money from discord.
# Tips
- Try to get a low latency to discord servers as there can be competition with other snipers.
- This is technically a self-bot: mentioning this in a discord chat is enough to make your account reportable to Trust & Safety.
- Running more than one instance or different snipers is an easy way to get your account deactivated.
- Before using, consider the moral implications of stealing gifts from communities you have nothing to do with.

> If you like my project, please consider starring the repo :)
> If you like my project, please consider starring the repo :)
13 changes: 1 addition & 12 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { Util: djsUtil } = require('discord.js');

async function init() {
// Requires
const Constants = require('./lib/Constants');
const Webhook = require('./lib/Webhook');
const Logger = require('./lib/Logger');
Expand All @@ -10,7 +9,6 @@ async function init() {
const chalk = require('chalk');
const phin = require('phin');

// Call dotenv to recognize env vars
require('dotenv').config();

console.log(chalk.green(`
Expand All @@ -36,41 +34,33 @@ async function init() {
╙╙▀▀▀▓▓▓▓▀▀▀╙╙
`));

// Define globals
global.active = [];
global.webhook = null;
global.constants = Constants;
global.util = Util;
global.logger = new Logger({ debug: false });
global.pSourceId = null;

// Try to parse settings
try {
global.settings = JSON.parse(process.env.settings);
} catch {
return logger.critical(constants.invalidConfig);
}

// Define settings with defaults
global.settings = djsUtil.mergeDefault(constants.defaultSettings, settings);

if (!settings.mode) return logger.critical(constants.noMode);
if (!Object.keys(modes).includes(settings.mode)) return logger.critical(constants.invalidMode);

// Init selected mode
logger.debug(constants.initSniper);
await modes[settings.mode]();

if (!active.length) return logger.critical(constants.invalidTokens);

// Counters
let guildCount = active
.map((s) => s.guilds.cache.size)
.reduce((a, b) => a + b, 0);

let sniperCount = active.length;

// Get payment method
let res = await phin({
url: constants.paymentSourceURL,
method: 'GET',
Expand All @@ -89,14 +79,13 @@ async function init() {
logger.warn(constants.paymentMethodFail(res.body));
}

// Init webhook
if (settings.webhook?.url) {
const webhookToken = /[^/]*$/.exec(settings.webhook.url)[0];
const webhookId = settings.webhook.url.replace(/^.*\/(?=[^\/]*\/[^\/]*$)|\/[^\/]*$/g, '');
global.webhook = new Webhook(webhookId, webhookToken);
}

return logger.success(constants.ready(sniperCount, guildCount));
return logger.success(constants.ready(active.length, guildCount));
}

init();
5 changes: 2 additions & 3 deletions src/lib/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ module.exports = {
xSuperProperties: 'eyJvcyI6IldpbmRvd3MiLCJicm93c2VyIjoiRGlzY29yZCBDbGllbnQiLCJyZWxlYXNlX2NoYW5uZWwiOiJjYW5hcnkiLCJjbGllbnRfdmVyc2lvbiI6IjEuMC4yMSIsIm9zX3ZlcnNpb24iOiIxMC4wLjE5MDQyIiwib3NfYXJjaCI6Ing2NCIsInN5c3RlbV9sb2NhbGUiOiJlbi1VUyIsImNsaWVudF9idWlsZF9udW1iZXIiOjc1NjU3LCJjbGllbnRfZXZlbnRfc291cmNlIjpudWxsfQ==',
xContextProperties: 'eyJsb2NhdGlvbiI6Ikludml0ZSBCdXR0b24gRW1iZWQiLCJsb2NhdGlvbl9ndWlsZF9pZCI6bnVsbCwibG9jYXRpb25fY2hhbm5lbF9pZCI6IjgwNzgyMTYwMDM1ODc5MzI1NiIsImxvY2F0aW9uX2NoYW5uZWxfdHlwZSI6MSwibG9jYXRpb25fbWVzc2FnZV9pZCI6IjgwNzgyMTY5ODUwMTA1MDQzOSJ9',
webhookCantReach: 'Unable to reach your webhook.',
invalidConfig: 'Invalid settings object, if you require more help visit https://github.com/slow/nitro-sniper for the default configuration. Exiting process...',
invalidConfig: 'Invalid settings object, if you require more help visit https://github.com/slow/nitro-sniper#default-configuration for an example. Exiting process...',
noMode: 'No sniper mode provided in settings, exiting process...',
invalidMode: 'Invalid mode provided, visit https://github.com/slow/nitro-sniper for a list of modes. Exiting process...',
invalidMode: 'Invalid mode provided, visit https://github.com/slow/nitro-sniper#default-configuration for a list of modes. Exiting process...',
noMain: 'No main account token provided, exiting process...',
noAlts: 'No alt tokens were provided, exiting process...',
invalidTokens: 'All tokens provided were invalid, exiting process...',
Expand All @@ -142,7 +142,6 @@ module.exports = {
snipedCode: (code, type, from, author, end) => `Success | Code: ${chalk.bold(code)} | ${type} | ${from} | ${author} | ${end}`,
duplicateFound: (code, location, author) => `Avoiding Duplicate | Code: ${chalk.bold(code)} | ${location} | ${author}`,
webhookTypes: ['codeInvalid', 'codeAlreadyRedeemed', 'codeSuccess', 'giveawayEntered', 'giveawayWin', 'inviteJoin'],
initSniper: 'Initializing sniper...',
fields: {
codeFail: (time, code, location) => [
{ key: 'Time Taken', value: time },
Expand Down

0 comments on commit cd5431f

Please sign in to comment.