File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' ) ;
2
+ const { REST } = require ( '@discordjs/rest' ) ;
3
+ const { Routes } = require ( 'discord-api-types/v9' ) ;
4
+ const { Client, Collection, Intents } = require ( 'discord.js' ) ;
5
+ const configFile = ( process . argv [ 2 ] ) ? process . argv [ 2 ] : './config.json' ;
6
+ const { token, clientId, guildIds } = require ( configFile ) ; const config = require ( configFile ) ;
7
+
8
+ const client = new Client ( { intents : [ Intents . FLAGS . GUILDS , Intents . FLAGS . GUILD_VOICE_STATES ] } ) ;
9
+
10
+ client . once ( 'ready' , ( ) => {
11
+ console . log ( 'Ready!' ) ;
12
+ client . user . setActivity ( "by RedTech" , {
13
+ type : "PLAYING"
14
+ } ) ;
15
+ } ) ;
16
+
17
+ const guilds = client . guilds . cache ;
18
+ guilds . forEach ( ( guild , i ) => {
19
+ if ( config . guildIds . indexOf ( guild . id ) > - 1 ) config . guildIds . splice ( config . guildIds . indexOf ( guild . id ) , 1 ) ;
20
+ fs . writeFile ( configFile , JSON . stringify ( config ) , ( err ) => {
21
+ if ( err ) console . log ( "[GuildDelete][WriteFile][Error]: " , err ) ;
22
+ } ) ;
23
+ guild . leave ( ) ;
24
+ } ) ;
You can’t perform that action at this time.
0 commit comments