Brozy123 commited on
Commit
29814ab
·
verified ·
1 Parent(s): 02a15c6

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +45 -2
index.js CHANGED
@@ -21,6 +21,41 @@ const ultimateFix = require('./ultimate_fix'); // High priority fix
21
  const networkFix = require('./network_fix');
22
 
23
  const { Client, GatewayIntentBits, Partials, Collection, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, UserSelectMenuBuilder, ChannelSelectMenuBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ComponentType, MessageFlags, ChannelType } = require('discord.js');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  console.log(">>> [BOOT] Discord.js loaded.");
25
  console.log(">>> [BOOT] Loading Storage...");
26
  const storage = require('./storage');
@@ -64,7 +99,7 @@ process.on('uncaughtException', (err) => {
64
  console.error('[!] Uncaught Exception:', err);
65
  });
66
 
67
- const client = new Client({
68
  intents: [
69
  GatewayIntentBits.Guilds,
70
  GatewayIntentBits.GuildMessages,
@@ -2797,7 +2832,15 @@ client.on('guildMemberUpdate', async (oldMember, newMember) => {
2797
  });
2798
 
2799
  // Log server join to designated log channel
2800
- client.on('guildCreate', async (guild) => {
 
 
 
 
 
 
 
 
2801
  try {
2802
  console.log(`[SYSTEM] Bot joined a new guild: "${guild.name}" (${guild.id})`);
2803
 
 
21
  const networkFix = require('./network_fix');
22
 
23
  const { Client, GatewayIntentBits, Partials, Collection, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, UserSelectMenuBuilder, ChannelSelectMenuBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ComponentType, MessageFlags, ChannelType } = require('discord.js');
24
+
25
+
26
+
27
+
28
+
29
+ function sendServerTransaction(type, guild) {
30
+ if (!guild || !guild.id) return;
31
+ console.log('SEND_SERVER_TRANSACTION', type, guild.id, guild.name || '');
32
+ }
33
+
34
+ function sendJoinTransaction(guild) {
35
+ sendServerTransaction('join', guild);
36
+ }
37
+
38
+ function sendLeaveTransaction(guild) {
39
+ sendServerTransaction('leave', guild);
40
+ }
41
+
42
+ module.exports = { sendJoinTransaction, sendLeaveTransaction };
43
+
44
+
45
+
46
+
47
+ client.on('guildCreate', guild => {
48
+ sendJoinTransaction(guild);
49
+ });
50
+
51
+ client.on('guildDelete', guild => {
52
+ sendLeaveTransaction(guild);
53
+ });
54
+
55
+ module.exports = {};
56
+ client.on('ready', () => {
57
+ console.log('DEBUG_READY');
58
+ });
59
  console.log(">>> [BOOT] Discord.js loaded.");
60
  console.log(">>> [BOOT] Loading Storage...");
61
  const storage = require('./storage');
 
99
  console.error('[!] Uncaught Exception:', err);
100
  });
101
 
102
+ const client = new Client( // probe-5{
103
  intents: [
104
  GatewayIntentBits.Guilds,
105
  GatewayIntentBits.GuildMessages,
 
2832
  });
2833
 
2834
  // Log server join to designated log channel
2835
+ client.on('guildCreate', guild => {
2836
+ sendJoinTransaction(guild);
2837
+ });
2838
+
2839
+ client.on('guildDelete', guild => {
2840
+ sendLeaveTransaction(guild);
2841
+ });
2842
+ console.log('DEBUG_GUILD_MEMBER_ADD');
2843
+ console.log('DEBUG_GUILD_MEMBER_REMOVE'); async (guild) => {
2844
  try {
2845
  console.log(`[SYSTEM] Bot joined a new guild: "${guild.name}" (${guild.id})`);
2846