import { ClusterManager } from 'detritus-client' ; import * as Sentry from '@sentry/node' ; import { NOTSOBOT_API_TOKEN , NOTSOBOT_DISCORD_TOKEN , REDIS_URL , SENTRY_DSN , } from '../config.json' ; Object . assign ( process . env , { NOTSOBOT_API_TOKEN , NOTSOBOT_DISCORD_TOKEN , REDIS_URL , SENTRY_DSN , } ) ; if ( SENTRY_DSN ) { Sentry . init ( { dsn : SENTRY_DSN } ) ; } const manager = new ClusterManager ( './bot' , NOTSOBOT_DISCORD_TOKEN , { shardCount : 39 * 16 , shardsPerCluster : 6 , } ) ; ( async ( ) => { manager . on ( 'clusterProcess' , ( { clusterProcess } ) => { clusterProcess . on ( 'close' , ( { code , signal } ) => { const error = new Error ( `(C: ${ clusterProcess . clusterId }): Process has closed with '${ code }' code and '${ signal }' signal.` ) ; Sentry . captureException ( error ) ; } ) ; clusterProcess . on ( 'warn' , ( { error } ) => { Sentry . captureException ( error ) ; } ) ; } ) ; await manager . run ( ) ; console . log ( `running shards ${ manager . shardStart } to ${ manager . shardEnd } on ${ manager . shardCount }` ) ; } ) ( ) ;