Suvarii commited on
Commit
ec35a4b
·
verified ·
1 Parent(s): 49454e0

Update bot.js

Browse files
Files changed (1) hide show
  1. bot.js +18 -8
bot.js CHANGED
@@ -126,7 +126,19 @@ function stopPeriodicHomeChecks() {
126
  }
127
  activeTimeouts.forEach(t => clearTimeout(t));
128
  activeTimeouts = [];
129
- stopCiftciPeriodicSelling();
 
 
 
 
 
 
 
 
 
 
 
 
130
  nextScheduledCheckAtMs = null;
131
  }
132
 
@@ -1196,13 +1208,11 @@ function activateEntityAtNoLook(entity, position) {
1196
  logger.info("[Çiftçi Periyodik] Dakikalık satış zamanlayıcısı başlatıldı.");
1197
  }
1198
 
1199
- function stopCiftciPeriodicSelling() {
1200
- if (ciftciPeriodicIntervalHandle) {
1201
- clearInterval(ciftciPeriodicIntervalHandle);
1202
- ciftciPeriodicIntervalHandle = null;
1203
- logger.info("[Çiftçi Periyodik] Dakikalık satış zamanlayıcısı durduruldu.");
1204
- }
1205
- }
1206
 
1207
  bot.once("spawn", async () => {
1208
  isConnecting = false;
 
126
  }
127
  activeTimeouts.forEach(t => clearTimeout(t));
128
  activeTimeouts = [];
129
+
130
+ // NOT: stopCiftciPeriodicSelling() burada ÇAĞRILMIYOR çünkü o fonksiyon
131
+ // createBot() içinde tanımlı (closure) ve bu fonksiyon (stopPeriodicHomeChecks)
132
+ // module'ün en üst seviyesinde tanımlı olduğu için ona erişemez — erişmeye
133
+ // çalışmak "ReferenceError: stopCiftciPeriodicSelling is not defined" hatasına
134
+ // yol açar. Bunun yerine, zaten üst seviyede tanımlı olan interval handle'ı
135
+ // doğrudan burada temizliyoruz.
136
+ if (ciftciPeriodicIntervalHandle) {
137
+ clearInterval(ciftciPeriodicIntervalHandle);
138
+ ciftciPeriodicIntervalHandle = null;
139
+ logger.info("[Çiftçi Periyodik] Dakikalık satış zamanlayıcısı durduruldu.");
140
+ }
141
+
142
  nextScheduledCheckAtMs = null;
143
  }
144
 
 
1208
  logger.info("[Çiftçi Periyodik] Dakikalık satış zamanlayıcısı başlatıldı.");
1209
  }
1210
 
1211
+ // NOT: Durdurma işlemi artık module-level stopPeriodicHomeChecks() fonksiyonu
1212
+ // içinde, ciftciPeriodicIntervalHandle module-level değişkeni doğrudan
1213
+ // temizlenerek yapılıyor (bkz. dosyanın üst kısmı). Burada ayrı bir
1214
+ // stopCiftciPeriodicSelling() tanımlamaya gerek yok; olsaydı bile createBot()
1215
+ // içindeki bu closure'a module-level koddan erişilemezdi.
 
 
1216
 
1217
  bot.once("spawn", async () => {
1218
  isConnecting = false;