ajmeese7 / spambot

Discord spambot to level up profiles on other bots.
MIT License
151 stars 99 forks source link

Works fine for some time but gives an error afterwards #38

Closed WeaveAche closed 3 years ago

WeaveAche commented 3 years ago

Hi, the bot works fine for some time (usually about 30 min) and then gives me an error like this-

PS C:\Users\vivek\Desktop\project\spambot> node bot.js --message "hi" --setTime 60000 --prune Ready to level up! There was an error! Did you update the config.json file? If you did, let me know what the error message says in an issue on the repo on GitHub. Error: read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20) { errno: -4077, code: 'ECONNRESET', syscall: 'read', request: <ref 1> ClientRequest { _events: [Object: null prototype] { abort: [Function], response: [Function] }, _eventsCount: 2, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: false, chunkedEncoding: false, shouldKeepAlive: true, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 16, _hasBody: true, _trailer: '', finished: true, _headerSent: true, socket: TLSSocket { _tlsOptions: [Object], _secureEstablished: false, _securePending: false, _newSessionPending: false, _controlReleased: true, secureConnecting: true, _SNICallback: null, servername: null, alpnProtocol: null, authorized: false, authorizationError: null, encrypted: true, _events: [Object: null prototype], _eventsCount: 10, connecting: false, _hadError: true, _parent: null, _host: 'discordapp.com', _readableState: [ReadableState], _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: undefined, _server: null, ssl: null, _requestCert: true, _rejectUnauthorized: true, parser: null, _httpMessage: [Circular 1],

  [Symbol(verified)]: false,
  [Symbol(pendingSession)]: null,
  [Symbol(async_id_symbol)]: 39281,
  [Symbol(kHandle)]: null,
  [Symbol(kSetNoDelay)]: true,
  [Symbol(lastWriteQueueSize)]: 375,
  [Symbol(timeout)]: null,
  [Symbol(kBuffer)]: null,
  [Symbol(kBufferCb)]: null,
  [Symbol(kBufferGen)]: null,
  [Symbol(kCapture)]: false,
  [Symbol(kBytesRead)]: 0,
  [Symbol(kBytesWritten)]: 375,
  [Symbol(connect-options)]: [Object]
},
_header: 'POST /api/v7/channels/769900561943625738/messages HTTP/1.1\r\n' +
  'Host: discordapp.com\r\n' +
  'Authorization: (my user token is here)\r\n' +
  'User-Agent: DiscordBot (https://github.com/discordjs/discord.js, 11.6.4) Node.js/v14.15.1\r\n' +
  'Content-Type: application/json\r\n' +
  'Accept-Encoding: gzip, deflate\r\n' +
  'Connection: keep-alive\r\n' +
  'Content-Length: 16\r\n' +
  '\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: noopPendingOutput],
agent: Agent {
  _events: [Object: null prototype],
  _eventsCount: 2,
  _maxListeners: undefined,
  defaultPort: 443,
  protocol: 'https:',
  options: [Object],
  requests: {},
  sockets: [Object],
  freeSockets: {},
  keepAliveMsecs: 1000,
  keepAlive: true,
  maxSockets: Infinity,
  maxFreeSockets: 256,
  scheduling: 'fifo',
  maxTotalSockets: Infinity,
  totalSocketCount: 1,
  maxCachedSessions: 100,
  _sessionCache: [Object],
  [Symbol(kCapture)]: false
},
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/api/v7/channels/769900561943625738/messages',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'discordapp.com',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype] {
  host: [Array],
  authorization: [Array],
  'user-agent': [Array],
  'content-type': [Array],
  'accept-encoding': [Array]
}

} } PS C:\Users\vivek\Desktop\project\spambot>

ajmeese7 commented 3 years ago

Hey man, sorry I completely missed this until now. The issue is the client for Discord.js expires in that time frame, so you'll need to use something like a cronjob to reinitialize the client then send a message and kill the client every x amount of minutes/hours/whatever.

Let me know if that doesn't make any sense and I can try to upload a code example.

WeaveAche commented 3 years ago

Oh ok. Makes sense.