Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
381 commits
Select commit Hold shift + click to select a range
952f5fa
Only display each language once
Ninjasoturi Nov 16, 2022
724d6c4
Added feature under `gym` for saving gym address from OSM/Google lookup
Ninjasoturi Nov 16, 2022
7fb5f42
Added `events` command
Ninjasoturi Nov 17, 2022
2c04732
Time vote key fixes
Ninjasoturi Nov 18, 2022
b397274
Fixed new user logic
Ninjasoturi Nov 10, 2022
e3fd064
Map telegram roles to correct access files
Ninjasoturi Nov 10, 2022
28bb866
Added `/history` to help
Ninjasoturi Nov 11, 2022
a1b2da9
Fixed updating raid pokemon manually
Ninjasoturi Nov 11, 2022
0d257b6
Cosmetic changes to `list` and fixed `listall` permission that didn't…
Ninjasoturi Nov 11, 2022
e9d70be
Fixed access rights and menus for ex raid creation
Ninjasoturi Nov 11, 2022
6c5b3c8
Event settings should override everything
Ninjasoturi Nov 11, 2022
e1c03e6
Tutorial fix
Ninjasoturi Nov 11, 2022
071995e
Fixed force-tutorial logic
Ninjasoturi Nov 11, 2022
47c82e5
Fixed error message when there are no active raids in database
Ninjasoturi Nov 11, 2022
fa6d3ca
Removed `/team` command, brounght back missing translations and impro…
Ninjasoturi Nov 12, 2022
f8d961e
Improved documentation
Ninjasoturi Nov 12, 2022
5db4c8e
Fixed lang path
Ninjasoturi Nov 13, 2022
2f61684
Simple uicons support
Ninjasoturi Nov 13, 2022
9f60827
Minor translation fix
Ninjasoturi Nov 13, 2022
1651963
Detect UICONS source size automagically
Ninjasoturi Nov 13, 2022
9897827
Added RAID_EXCLUDE_ELITE_DUPLICATION and made duplicate raid check ra…
Ninjasoturi Nov 14, 2022
7cc96bd
Documented instructions for using UICONS in raid picture
Ninjasoturi Nov 14, 2022
4022ca7
Comments in access file names should now work as advertised in docume…
Ninjasoturi Nov 15, 2022
079f940
Cleaned up pokedex code
Ninjasoturi Nov 16, 2022
0fdc6ab
Cleaned up keys_vote code
Ninjasoturi Nov 16, 2022
c9ea777
Forgot to remove this
Ninjasoturi Nov 16, 2022
59c3287
Fixed gym note deletion feature
Ninjasoturi Nov 16, 2022
6851ec0
Only display each language once
Ninjasoturi Nov 16, 2022
1b4a084
Added feature under `gym` for saving gym address from OSM/Google lookup
Ninjasoturi Nov 16, 2022
da77793
Added `events` command
Ninjasoturi Nov 17, 2022
a03d32e
Cleanup
Ninjasoturi Nov 21, 2022
4d6c6ad
ddos check fix
Ninjasoturi Nov 21, 2022
811a8d6
Store user's privileges in db
Ninjasoturi Nov 21, 2022
e2fb7aa
Minor fixes
Ninjasoturi Nov 21, 2022
5394973
fixes
Ninjasoturi Nov 22, 2022
fe74192
Refactored gym menus and minor edits to botUser class
Ninjasoturi Nov 23, 2022
77db02c
Dependencies
Ninjasoturi Nov 23, 2022
3365f2e
User specific default gymareas
Ninjasoturi Nov 23, 2022
7bc35b0
Added a submenu button for when there are more than six gymareas
Ninjasoturi Nov 24, 2022
6571403
Fixed pogoinfo imports
Ninjasoturi Nov 26, 2022
687ac1f
Fixed pogoinfo imports
Ninjasoturi Nov 26, 2022
46e231b
Simplified pokebattler and pogoinfo import scripts' code
Ninjasoturi Nov 26, 2022
1818bd7
Correct shiny format
Ninjasoturi Nov 26, 2022
c30f1d8
Added done-button to list-menu
Ninjasoturi Nov 27, 2022
ae070cf
Save user id in a better place
Ninjasoturi Nov 28, 2022
c169773
Added a fallback if nothing was fround from cleanup
Ninjasoturi Nov 28, 2022
389c5b5
Fixed extend logic
Ninjasoturi Nov 28, 2022
1badc0c
Update also raid start and end times of they change
Ninjasoturi Nov 28, 2022
864709b
Send alarms when webhook updates raid pokemon
Ninjasoturi Nov 28, 2022
a5c75a9
Fixed metrics endpoint
Ninjasoturi Nov 28, 2022
8d1b88b
Minor cleanups
Ninjasoturi Nov 28, 2022
6cf051c
Fixed participate-key
Ninjasoturi Nov 30, 2022
ec8d570
Fixed participate-key
Ninjasoturi Nov 30, 2022
805e9ac
Fixed gym listing menus for event raids
Ninjasoturi Dec 4, 2022
e652ac1
Fixes and improvements to raid creation menu
Ninjasoturi Dec 6, 2022
6b1254c
Fixes
Ninjasoturi Dec 6, 2022
68d312f
Renamed `callbackAction` array key to `0` in callback data handling
Ninjasoturi Dec 6, 2022
56f91bd
Fixed ex raid creation and gym menu
Ninjasoturi Dec 7, 2022
6ece786
Latest translations
Ninjasoturi Dec 8, 2022
ca9f496
Changed privileges datatype from json to text
Ninjasoturi Dec 8, 2022
81264e4
Fixed gym creation
Ninjasoturi Dec 8, 2022
fd4d364
Removed collate from letter menu creation since it doesn't do anything
Ninjasoturi Dec 8, 2022
41b57e3
Fixed privilege caching for admins and not restricted
Ninjasoturi Dec 8, 2022
2b80236
Fixed raid creation via location
Ninjasoturi Dec 8, 2022
6d64ddf
More callback_data reformatting
Ninjasoturi Dec 9, 2022
abd3f23
New button to display saved raid if it's elite
Ninjasoturi Dec 9, 2022
d1ba2d3
Disable image build message notifications
jinnatar Dec 8, 2022
d6a1f5a
Added translation for Unbound-form
Ninjasoturi Dec 9, 2022
d9035d3
Bring back Pokemon name translation fallback logic
Ninjasoturi Dec 9, 2022
9329d0f
Fixed raid deletion
Ninjasoturi Dec 11, 2022
8658729
Moved access denied -logic to it's own function
Ninjasoturi Dec 11, 2022
e223760
More callback_data formatting that fixes a lot of bugs
Ninjasoturi Dec 11, 2022
c0e18ba
Make the code a bit easier to read
Ninjasoturi Dec 12, 2022
ccfd782
Added a new function to create a simple tg button
Ninjasoturi Dec 12, 2022
9c7c141
Fixed remote gyms button
Ninjasoturi Dec 13, 2022
fc41dbf
Ignore unneeded config folder items when building an image
jinnatar Dec 14, 2022
bce5949
Import config earlier in the metrics endpoint
jinnatar Dec 14, 2022
9caff33
Improve errors for bad config json, debug logging of media edit
jinnatar Dec 14, 2022
7864acc
Ignore unneeded config folder items when building an image
jinnatar Dec 14, 2022
6c5434c
Improve errors for bad config json, debug logging of media edit
jinnatar Dec 14, 2022
f84036c
Merge branch 'v6' of https://github.com/pokepark/PokemonRaidBot into v6
Ninjasoturi Dec 14, 2022
ddec527
Fixed remote raids
Ninjasoturi Dec 14, 2022
f292fa0
Use more accurate date in raid creation
Ninjasoturi Dec 15, 2022
e26ce70
Forgot to remove logging
Ninjasoturi Dec 15, 2022
8978d4d
Finalized the conversion to the new callback_data system
Ninjasoturi Dec 15, 2022
9caaa48
Fixed raid time when raid is already running
Ninjasoturi Dec 17, 2022
1d78dba
Fail gracefully when a raid id is unknown
Ninjasoturi Dec 17, 2022
ae15f51
Done instead of abort
Ninjasoturi Dec 18, 2022
7d60b28
Set temporary gyms only for remote raids
Ninjasoturi Dec 18, 2022
42b7747
Fixed vote_pokemon
Ninjasoturi Dec 18, 2022
9bfb097
Variable names not needed
Ninjasoturi Dec 18, 2022
dceabe7
Get rid of the addressable assets folder
Ninjasoturi Dec 18, 2022
f313fa6
Got rid of most of the old stuff regarding `pokemon` table
Ninjasoturi Dec 18, 2022
4b77363
Forgot to remove debug loggin. Again
Ninjasoturi Dec 18, 2022
2f28dcb
Cleaned up getdb code
Ninjasoturi Dec 19, 2022
6e2ea2c
Fixed participate-key
Ninjasoturi Dec 21, 2022
d12bed8
Merge branch 'v6' into dev
Ninjasoturi Dec 22, 2022
cfa67e7
Fallback for some normal form icons
Ninjasoturi Dec 23, 2022
5e04e30
Added ability to configure timezone for raidhour creator
Ninjasoturi Dec 28, 2022
ce754bc
Fixed automatic boss updater
Ninjasoturi Dec 28, 2022
8800366
Support for multiple config files
Ninjasoturi Dec 28, 2022
fd254ac
Documentation formatting fix
Ninjasoturi Jan 9, 2023
74b296d
Second try
Ninjasoturi Jan 9, 2023
2470b0a
Support for primal raids and mons
Ninjasoturi Jan 26, 2023
4515b9d
Increased the size of pokemon_name column
Ninjasoturi Jan 27, 2023
c5f9073
Fixed new_boss alert to use recipient language
Ninjasoturi Jan 27, 2023
a23ef81
Fixed update queries
Ninjasoturi Jan 27, 2023
1427205
Write out form proto data as well since we have it.
jinnatar Jan 28, 2023
6e50a8b
Export pokemon.json from getdb for debug purposes etc.
jinnatar Jan 28, 2023
391ff38
Rescue v6 refugees that have a different photo_cache structure
jinnatar Jan 29, 2023
f696bd9
Switch htaccess logic to default deny.
jinnatar Jan 29, 2023
fd9f30b
Updated PHP version in documentation
Ninjasoturi Jan 29, 2023
ecc74dd
Removec unnecessary check
Ninjasoturi Jan 29, 2023
0a6146c
New translations
Ninjasoturi Jan 30, 2023
e6a2bbd
Converted $eggs to an actual constant
Ninjasoturi Jan 30, 2023
37d7d9c
Improved logic for time voting keys
Ninjasoturi Feb 4, 2023
57e06f3
More tricks to get Pokebattler primals mapped to right tier
Ninjasoturi Feb 16, 2023
6c67896
Fixed buttons
Ninjasoturi Feb 19, 2023
bb596d6
Changed EX raid level from X to 99
Ninjasoturi Mar 3, 2023
1e067e4
New translations
Ninjasoturi Mar 3, 2023
22cb267
Fixed raid duration
Ninjasoturi Mar 3, 2023
b07f574
Merge branch 'ex_raid_id_rework' into dev
Ninjasoturi Mar 3, 2023
e90d2b3
Use bot specific update_id
Ninjasoturi Mar 5, 2023
921e702
Add coree/tools/hash.php into .gitignore
Ninjasoturi Mar 5, 2023
4f8e7fd
added NL translation
klablabla Mar 5, 2023
09e97c6
added NL translation
klablabla Mar 5, 2023
fe6160e
Merge pull request #287 from klablabla/patch-8
Ninjasoturi Mar 5, 2023
342f749
Fixed sql upgrade
Ninjasoturi Mar 5, 2023
c9a845b
Exclude raid level 10 from automatic level updater
Ninjasoturi Mar 10, 2023
40b4fe3
Minor bug fixes
Ninjasoturi Mar 10, 2023
0adb58a
Shorten the callback_data when creating a raid
Ninjasoturi Mar 11, 2023
f3d2310
Truthiness fix
Ninjasoturi Mar 11, 2023
b5eb4b3
Add limit
Ninjasoturi Mar 12, 2023
d7f048b
Fixed duplicate keys on short raids
Ninjasoturi Mar 12, 2023
c8cef10
Initial support for shadow raids
Ninjasoturi Mar 15, 2023
5738956
Don't debug_log binary blobs, compact other debug logging
jinnatar Apr 2, 2023
8547a63
Simplify image object detection, fix a logic bug
jinnatar Apr 3, 2023
00d9284
New translations
Ninjasoturi Apr 19, 2023
31ff49b
Fixed event raid duration on creation
Ninjasoturi Apr 19, 2023
5b4de9a
Fixed editing of hide_raid_picture under event editor
Ninjasoturi Apr 21, 2023
e09679f
User privilege logic fix
Ninjasoturi May 4, 2023
5d6c8d8
New translations
Ninjasoturi May 4, 2023
81b204f
Fix php error
Ninjasoturi May 18, 2023
82a08bb
Placeholder shadow raid eggs
Ninjasoturi May 19, 2023
894adff
Updated shadow raids
Ninjasoturi May 19, 2023
e3428e4
Deleted unused exgym.png
Ninjasoturi May 19, 2023
a47e596
The shadow raid bit may not be set in incoming raids
jinnatar May 22, 2023
2a6ea07
Add shadow key to raid array for webhook raids also
Ninjasoturi May 22, 2023
c46aec4
Fixed shadow raid pokemon name generation
Ninjasoturi May 22, 2023
204ab56
Updated shadow egg icons
Ninjasoturi May 22, 2023
1387c06
Fixed shadow icon logic
Ninjasoturi May 27, 2023
89dadc9
Fixed sql upgrade 3
Ninjasoturi May 28, 2023
5edd219
Fixed php error
Ninjasoturi May 28, 2023
d5b9776
Fixed php error
Ninjasoturi May 28, 2023
43545f5
Added default value for page
Ninjasoturi May 28, 2023
2e42325
Fixed shadow egg name
Ninjasoturi May 28, 2023
8a93540
Fixed shadow egg translation
Ninjasoturi Jun 10, 2023
d69bde9
Support for pokebattler shadow raids
Ninjasoturi Jun 10, 2023
0d0c07f
Fixed Google Maps links
Ninjasoturi Jun 12, 2023
6d87a1d
Fixed Unown raidpicture
Ninjasoturi Sep 6, 2023
2f15aad
New translations
Ninjasoturi Sep 6, 2023
ae1c1f1
Removed TRAINER_BUTTONS_TOGGLE
Ninjasoturi Sep 6, 2023
f172c91
Fixed getTranslations.php
Ninjasoturi Sep 15, 2023
632242c
New translations
Ninjasoturi Sep 15, 2023
9d09275
Fixed getdb
Ninjasoturi Sep 15, 2023
fd73aaa
New translations
Ninjasoturi Oct 28, 2023
c71fe57
New feature: RAID_BOSS_LIST
Ninjasoturi Oct 28, 2023
80fb690
Translate anytime on alarms based on recipient language setting
Ninjasoturi Oct 31, 2023
3e4ad4b
Fixed how /get and /set handle true/false
Ninjasoturi Nov 2, 2023
5aeac17
Improved costumed pokemon icon's fallback logic
Ninjasoturi Nov 2, 2023
7a7c595
Exclude past bosses
Ninjasoturi Nov 3, 2023
6870ac6
Fixed math
Ninjasoturi Nov 3, 2023
64c9855
Fixed counting of results
Ninjasoturi Dec 4, 2023
f66df66
New data source for getdb
Ninjasoturi Dec 4, 2023
b70af9d
New source for translations and stuff
Ninjasoturi Dec 4, 2023
ecbbe68
Fixed typing for megas
Ninjasoturi Dec 9, 2023
ae102ec
Month format from 01 to 1
Ninjasoturi Dec 22, 2023
4982968
Improved raidpicture fallback icon logic
Ninjasoturi Dec 22, 2023
c71dfbe
Improved importing from pokebattler
Ninjasoturi Dec 22, 2023
9ee0cab
Fixed getdb
Ninjasoturi Jan 11, 2024
64f352c
Another rework of form translations
Ninjasoturi Jan 23, 2024
fd2fc1a
Improved Pokemon icon fallback logic and word wrapping of Pokemon name
Ninjasoturi Jan 23, 2024
ee205a1
Use Pokemon form id instead of form name for translation
Ninjasoturi Jan 23, 2024
873ba7d
Fixed stats and missing Pokemon
Ninjasoturi Jan 23, 2024
4a338d9
Another getdb fix
Ninjasoturi Feb 8, 2024
7b6a912
Share chats config rework
Ninjasoturi Feb 9, 2024
961e9f6
send_message fixes
Ninjasoturi Feb 11, 2024
b9ee659
Only process raid webhook
Ninjasoturi Feb 12, 2024
4638050
Added a few more create_chat_object
Ninjasoturi Feb 12, 2024
28fb58c
More thread_id support
Ninjasoturi Feb 12, 2024
2405606
Again I forgot if not exists
Ninjasoturi Feb 12, 2024
abeb5c2
Renamed variable for consistency
Ninjasoturi Feb 13, 2024
5bd7438
Added thread support to overview management
Ninjasoturi Feb 13, 2024
e521073
Added fallback for thread_id
Ninjasoturi Feb 16, 2024
c024a0d
Hide the expand button
Ninjasoturi Feb 16, 2024
5dcfef4
Fixed vote time key logic
Ninjasoturi Feb 16, 2024
32ce9dc
Backwards compatibility fixes
Ninjasoturi Feb 17, 2024
2a842aa
Switched to using mb_convert_encoding
Ninjasoturi Feb 20, 2024
f8e7814
Fixed cleanup logic
Ninjasoturi Feb 20, 2024
5afd453
More cleanup logic fixing
Ninjasoturi Feb 20, 2024
797b025
Use actual null
Ninjasoturi Feb 21, 2024
b826f64
Backwards compatibility fixes
Ninjasoturi Feb 21, 2024
06aa625
Improved pokemon name lookup logic
Ninjasoturi Feb 29, 2024
f9e6ff6
Set description to empty by default
Ninjasoturi Mar 3, 2024
e017eff
Merge branch 'share_chats_refactor' into dev
Ninjasoturi Mar 3, 2024
1c938fc
Update raids_list.php
Ninjasoturi Mar 4, 2024
0d6b860
Fixed post_raid
Ninjasoturi Mar 6, 2024
ad68b56
Fixed funny behavior of cancel key in edit_event_node and added done …
Ninjasoturi Mar 6, 2024
b1f9b6a
Add raid level 7 to automatic raid hour creator
Ninjasoturi Mar 9, 2024
016b2c1
Don't update chat info to db if request from TG failed
Ninjasoturi Mar 9, 2024
8dda690
Fixed logic
Ninjasoturi Mar 10, 2024
2f45619
Fixed Pokemon translation in alarm
Ninjasoturi Mar 12, 2024
0c42762
French translation
Ninjasoturi Mar 12, 2024
3bb253f
Improved logic on mapping Pokebattler names to pokemon_id and form_id
Ninjasoturi Mar 13, 2024
f4c7dce
Some error handling on curl timeout
Ninjasoturi Mar 13, 2024
55bfbef
Translation fixes
Ninjasoturi Mar 15, 2024
26eb802
Updated the alert_every_poke translations
Ninjasoturi Mar 15, 2024
71c3ccb
Added a config var ``CURL_IPRESOLVE_V4`` for forcing curl to ipv4
Ninjasoturi Mar 15, 2024
6b668aa
Updated translations
Ninjasoturi Mar 15, 2024
614d594
Fixed vote key time slot logic
Ninjasoturi Mar 17, 2024
4867cf6
Maybe fixed the hidden gyms menu
Ninjasoturi Apr 17, 2024
e9ee40a
Added error message on curl fail
Ninjasoturi Apr 17, 2024
7659df0
Added shadow to boss' name in raidbosslist
Ninjasoturi Apr 17, 2024
23bd489
Update docker-compose.yml
Chefkeks Apr 23, 2024
249f739
Update entrypoint.sh
Chefkeks Apr 23, 2024
0e7f254
Update publish-image.yml
Chefkeks Apr 23, 2024
1c8d873
Rename pokemon-raid-bot.sql to 0-pokemon-raid-bot.sql
Chefkeks Apr 23, 2024
5c5ae52
Update help.json
Chefkeks Apr 23, 2024
785b1e4
Update language.json
Chefkeks Apr 23, 2024
68dec22
Update language.json
Chefkeks Apr 24, 2024
0807150
Update language.json
Chefkeks Apr 24, 2024
8caa37c
Fixed gym letter 0 not working
Ninjasoturi Apr 26, 2024
369d1d8
Another vote key refactor
Ninjasoturi Apr 30, 2024
217220e
Fixed getTranslation.php
Ninjasoturi Apr 30, 2024
7b54eb5
New feature: enable/disable scheduled raid bosses
Ninjasoturi May 8, 2024
4358cfc
Merge branch 'another_vote_key_refactor' into dev
Ninjasoturi May 25, 2024
ad33fee
Merge branch 'edit_scheduled_entry' into dev
Ninjasoturi May 25, 2024
4648990
New translations
Ninjasoturi May 25, 2024
75fd157
Another wormhole fix to raid_hour_creator
Ninjasoturi May 29, 2024
dce4491
Added Ho-oh to pokebattler_pokemon_map
Ninjasoturi Jun 21, 2024
bd34bec
getdb fix
Ninjasoturi Aug 23, 2024
b147c8d
Added EXTRA_DATES config option for automatic raid hour creator
Ninjasoturi Aug 23, 2024
b996329
Updated translations
Ninjasoturi Jun 23, 2025
77b68aa
Removed shadow raids from 'local only'
Ninjasoturi Jun 23, 2025
6ceb4bb
Finally fixed automatic raid hour creation
Ninjasoturi Sep 26, 2025
73d62a4
Bump max trainer level to 80 in defaults-config.json
Chefkeks Oct 16, 2025
006cfa0
New translations
Ninjasoturi Dec 9, 2025
5a89188
Support RSVP time slots in vote keys
Ninjasoturi Dec 9, 2025
b2c0d35
Fixed vote keys only showing UTC times
Ninjasoturi Dec 14, 2025
d67422e
Support super mega raids
Ninjasoturi Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ docs
.git
!.git/HEAD
!.git/refs/*
config/
!config/defaults-*.json
3 changes: 3 additions & 0 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
echo ::set-output name=channel::"latest"
echo ::set-output name=version::main_$(cat VERSION)-${GITHUB_SHA::6}
elif [[ "$GITHUB_REF" == "refs/heads/"* ]]; then
echo ::set-output name=channel::${GITHUB_REF/refs\/heads\//}-"latest"
echo ::set-output name=version::${GITHUB_REF/refs\/heads\//}-$(cat VERSION)-${GITHUB_SHA::6}
elif [[ "$GITHUB_REF" == "refs/tags/"* ]]; then
echo ::set-output name=channel::${GITHUB_REF/refs\/tags\//}
Expand Down Expand Up @@ -60,3 +61,5 @@ jobs:
token: ${{ secrets.TELEGRAM_TOKEN }}
message: "New Docker image has been built: ${{ steps.meta.outputs.tags }}"
disable_web_page_preview: true
disable_notification: true

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/access/**
/custom/**
/ddos/**
/core/tools/hash.php
!/access/.gitkeep
!/custom/.gitkeep
!/ddos/.gitkeep
Expand Down
28 changes: 20 additions & 8 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# Block access to all dot files
RedirectMatch 404 /\..*$
# Deny everything by default
Order deny,allow
Deny from all

# Block access to .git files and folders
RedirectMatch 404 /\.git
# Allow plain requests that get routed to index.php
<FilesMatch "^$">
Allow from all
</FilesMatch>

# Block access to .json and .sql files
RedirectMatch 404 /*\.(json|sql)$
# Allow endpoints we expect to be called directly
<FilesMatch "(index|raidpicture)\.php$">
Allow from all
</FilesMatch>

# Block access to specifc folders
RedirectMatch 404 /(access|config|custom|ddos|lang|sql|screens)/
# Allow webhook setup, it's just static
<Files "webhook.html">
Allow from all
</Files>

# Allow metrics without appending /
<Files "metrics">
Allow from all
</Files>
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4
6
161 changes: 0 additions & 161 deletions commands/addgym.php

This file was deleted.

117 changes: 44 additions & 73 deletions commands/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,93 +6,64 @@
//debug_log($update);
//debug_log($data);

// Check access.
bot_access_check($update, 'access-bot');
if($botUser->accessCheck('delete-own', true)) {
$userRestriction = 'AND raids.user_id = ?';
$binds = [$update['message']['chat']['id']];
}elseif($botUser->accessCheck('delete-all', true)) {
$userRestriction = '';
$binds = [];
}else {
$botUser->denyAccess();
}

$query = my_query('
SELECT raids.*, gyms.gym_name
FROM raids
LEFT JOIN gyms
ON raids.gym_id = gyms.id
WHERE raids.end_time > UTC_TIMESTAMP
' . $userRestriction . '
ORDER BY raids.end_time ASC
LIMIT 20
', $binds);

// Count results.
$count = 0;
$own_sql = "";
$own_arr = [];
if(!bot_access_check($update, 'delete', true) && bot_access_check($update,'delete-own',true)) {
$own_sql = "AND users.user_id = :user_id";
$own_arr = [":user_id"=>$update['message']['from']['id']];
if($query->rowCount() == 0) {
$msg = '<b>' . getTranslation('no_active_raids_found') . '</b>';
send_message(create_chat_object([$update['message']['chat']['id']]), $msg);
exit;
}

// Init text and keys.
$text = '';
$keys = [];

try {
while ($row = $query->fetch()) {
// Set text and keys.
$text .= $row['gym_name'] . CR;
$now = utcnow();
$today = dt2date($now);
$raid_day = dt2date($row['start_time']);
$start = dt2time($row['start_time']);
$end = dt2time($row['end_time']);
$text .= get_local_pokemon_name($row['pokemon'], $row['pokemon_form']) . SP . '—' . SP . (($raid_day == $today) ? '' : ($raid_day . ', ')) . $start . SP . getTranslation('to') . SP . $end . CR . CR;
$keys[] = button($row['gym_name'], ['raids_delete', 'r' => $row['id']]);

$query = '
SELECT
raids.*, gyms.lat ,
gyms.lon ,
gyms.address ,
gyms.gym_name ,
gyms.ex_gym ,
users. NAME
FROM
raids
LEFT JOIN gyms ON raids.gym_id = gyms.id
LEFT JOIN users ON raids.user_id = users.user_id
WHERE
raids.end_time > UTC_TIMESTAMP()
'.$own_sql.'
ORDER BY
raids.end_time ASC
LIMIT 20
';
$statement = $dbh->prepare( $query );
$statement->execute($own_arr);
while ($row = $statement->fetch()) {
// Set text and keys.
$text .= $row['gym_name'] . CR;
$now = utcnow();
$today = dt2date($now);
$raid_day = dt2date($row['start_time']);
$start = dt2time($row['start_time']);
$end = dt2time($row['end_time']);
$text .= get_local_pokemon_name($row['pokemon'], $row['pokemon_form']) . SP . '—' . SP . (($raid_day == $today) ? '' : ($raid_day . ', ')) . $start . SP . getTranslation('to') . SP . $end . CR . CR;
$keys[] = array(
'text' => $row['gym_name'],
'callback_data' => $row['id'] . ':raids_delete:0'
);

// Counter++
$count = $count + 1;
}
}
catch (PDOException $exception) {

error_log($exception->getMessage());
$dbh = null;
exit;
}
// Get the inline key array.
$keys = inline_key_array($keys, 1);

// Set message.
if($count == 0) {
$msg = '<b>' . getTranslation('no_active_raids_found') . '</b>';
} else {
// Get the inline key array.
$keys = inline_key_array($keys, 1);
// Add exit key.
$keys[][] = button(getTranslation('abort'), 'exit');

// Add exit key.
$keys[] = [
[
'text' => getTranslation('abort'),
'callback_data' => '0:exit:0'
]
];

// Build message.
$msg = '<b>' . getTranslation('list_all_active_raids') . ':</b>' . CR;
$msg .= $text;
$msg .= '<b>' . getTranslation('select_gym_name') . '</b>' . CR;
}
// Build message.
$msg = '<b>' . getTranslation('list_all_active_raids') . ':</b>' . CR;
$msg .= $text;
$msg .= '<b>' . getTranslation('select_gym_name') . '</b>' . CR;

// Build callback message string.
$callback_response = 'OK';

// Send message.
send_message($update['message']['chat']['id'], $msg, $keys, ['reply_markup' => ['selective' => true, 'one_time_keyboard' => true]]);
?>
send_message(create_chat_object([$update['message']['chat']['id']]), $msg, $keys, ['reply_markup' => ['selective' => true, 'one_time_keyboard' => true]]);
28 changes: 28 additions & 0 deletions commands/events.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
// Write to log.
debug_log('EVENTS()');

// For debug.
//debug_log($update);
//debug_log($data);

// Check access.
$botUser->accessCheck('event-manage');

$q = my_query('SELECT * FROM events');

$msg = '<b>' . getTranslation('events_manage') . '</b>' . CR;

foreach($q->fetchAll() as $event) {
if($event['id'] == EVENT_ID_EX) $event['name'] = getTranslation('Xstars');
if(empty($event['description'])) $event['description'] = '<i>' . getTranslation('events_no_description') . '</i>';
$msg .= '<u>' . $event['name'] . '</u>' . CR;
$msg .= $event['description'] . CR . CR;
}

$keys[][] = button(getTranslation('events_manage'), 'events');
$keys[][] = button(getTranslation('events_create'), 'events_add');
$keys[][] = button(getTranslation('done'), ['exit', 'd' => '1']);

// Send message.
send_message(create_chat_object([$update['message']['chat']['id']]), $msg, $keys, ['reply_markup' => ['selective' => true, 'one_time_keyboard' => true]]);
Loading
Loading