@@ -312,22 +312,22 @@ function isPointInsidePolygon($point, $vertices) {
312
312
'shadow ' => (in_array ($ level , RAID_LEVEL_SHADOW ) ? 1 : 0 ),
313
313
]);
314
314
315
- $ chats_geofence = $ chats_raidlevel = $ webhook_chats = $ chats_by_pokemon = [];
315
+ $ chats_geofence = $ chats_raidlevel = $ webhook_chats = $ chats_by_pokemon = $ chats = [];
316
316
if ($ send_updates == true ) {
317
317
// Update raid polls and send alerts of updates
318
318
require_once (LOGIC_PATH .'/update_raid_poll.php ' );
319
319
$ tg_json = update_raid_poll ($ raid_id , $ raid , false , $ tg_json , true );
320
320
if ($ wasBossUpdated ) $ tg_json = alarm ($ raid , false , 'new_boss ' , '' , $ tg_json );
321
321
// Post hatched Pokemon to their respective chats if configured
322
322
// Start share_chats backwards compatibility
323
- if (!$ config ->CHATS_SHARE ) {
323
+ if (!isset ( $ config ->CHATS_SHARE ) ) {
324
324
if (!empty ($ config ->WEBHOOK_CHATS_BY_POKEMON [0 ]) && !$ no_auto_posting ) {
325
325
foreach ($ config ->WEBHOOK_CHATS_BY_POKEMON as $ rule ) {
326
326
if (isset ($ rule ['pokemon_id ' ]) && $ rule ['pokemon_id ' ] == $ pokemon && (!isset ($ rule ['form_id ' ]) or (isset ($ rule ['form_id ' ]) && $ rule ['form_id ' ] == $ form ))) {
327
327
foreach ($ rule ['chats ' ] as $ rule_chat ) {
328
328
// If the raid isn't already posted to the chats specified in WEBHOOK_CHATS_BY_POKEMON, we add it to the array
329
329
if (!isset ($ cleanup_data [$ raid_id ]) or !in_array ($ rule_chat , $ cleanup_data [$ raid_id ])) {
330
- $ chats_by_pokemon [] = $ rule_chat ;
330
+ $ chats_by_pokemon [] = create_chat_object ([ $ rule_chat]) ;
331
331
}
332
332
}
333
333
}
@@ -351,7 +351,7 @@ function isPointInsidePolygon($point, $vertices) {
351
351
if (empty ($ chats_by_pokemon )) continue ;
352
352
}else {
353
353
// Start share_chats backwards compatibility
354
- if (!$ config ->CHATS_SHARE ) {
354
+ if (!isset ( $ config ->CHATS_SHARE ) ) {
355
355
// Get chats to share to by raid level and geofence id
356
356
if ($ geofences != false ) {
357
357
foreach ($ inside_geofences as $ geofence_id ) {
@@ -376,7 +376,11 @@ function isPointInsidePolygon($point, $vertices) {
376
376
if (!empty ($ config ->WEBHOOK_CHATS_ALL_LEVELS )) {
377
377
$ webhook_chats = explode (', ' , $ config ->WEBHOOK_CHATS_ALL_LEVELS );
378
378
}
379
- // End chats_share backwards compatibility
379
+ $ chats_combined = array_merge ($ chats_geofence , $ chats_raidlevel , $ webhook_chats );
380
+ foreach ($ chats_combined as $ chat ) {
381
+ $ chats [] = create_chat_object ([$ chat ]);
382
+ }
383
+ // End chats_share backwards compatibility
380
384
}else {
381
385
if ($ geofences != false ) {
382
386
foreach ($ inside_geofences as $ geofence_id ) {
@@ -396,16 +400,18 @@ function isPointInsidePolygon($point, $vertices) {
396
400
397
401
// Get chats
398
402
$ webhook_chats = $ config ->CHATS_SHARE ['webhook ' ]['all ' ] ?? [];
403
+ $ chats = array_merge ($ chats_geofence , $ chats_raidlevel , $ webhook_chats );
399
404
}
400
405
}
401
406
402
- $ chats = array_merge ($ chats_geofence , $ chats_raidlevel , $ webhook_chats , $ chats_by_pokemon );
403
407
require_once (LOGIC_PATH .'/send_raid_poll.php ' );
404
408
if ($ metrics ) {
405
409
$ webhook_raids_posted_total ->inc ();
406
410
}
407
411
if (count ($ chats ) > 0 ) {
408
412
$ tg_json = send_raid_poll ($ raid_id , $ chats , $ raid , $ tg_json );
413
+ }elseif (count ($ chats_by_pokemon ) > 0 ) {
414
+ $ tg_json = send_raid_poll ($ raid_id , $ chats_by_pokemon , $ raid , $ tg_json );
409
415
}
410
416
}
411
417
// Telegram multicurl request.
0 commit comments