Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
283 commits
Select commit Hold shift + click to select a range
9619514
Finally logic.php, where all the magic happens! :D
Chefkeks Oct 20, 2017
caf0d98
Update existing raid after duplication check.
Chefkeks Oct 30, 2017
87db231
Added raid duplication check - searches for last raid details at subm…
Chefkeks Oct 30, 2017
adcdf44
Merge pull request #2 from Chefkeks/patch-2
florianbecker Nov 1, 2017
ec46852
Fixes wrong DB parameter order
marrah83 Nov 1, 2017
982f340
Calculate address based on lat/lon with GEO API, not based on notifie…
marrah83 Nov 1, 2017
460274b
Update raid.php
florianbecker Nov 2, 2017
27e2712
Merge pull request #3 from marrah83/master
florianbecker Nov 2, 2017
9da9992
Mark all user to contact them
florianbecker Nov 2, 2017
6489461
Fix default configuration to really work optional
florianbecker Nov 5, 2017
83a9e3b
remove unnecessary RAID_DURATION
marrah83 Nov 5, 2017
cffc47a
Added logic to make address lookup via Google API optional again, cha…
Chefkeks Nov 5, 2017
ae8e5f9
Added description of the commands to the README, maybe formatting is …
Chefkeks Nov 5, 2017
8bb7a70
Better formatting of README.md
Chefkeks Nov 5, 2017
72fd15b
Merge branch 'master' into master
florianbecker Nov 6, 2017
0179a5e
Merge branch 'master' into master
florianbecker Nov 6, 2017
79f2daa
Merge pull request #4 from marrah83/master
florianbecker Nov 6, 2017
deb5aba
Merge pull request #5 from Chefkeks/patch-3
florianbecker Nov 6, 2017
e285cf3
Fixed undefined index issue in geo_api
Chefkeks Nov 8, 2017
05a0fa0
Merge branch 'master' of https://github.com/florianbecker/raid-pokemo…
Chefkeks Nov 8, 2017
4b4fba9
Merge pull request #6 from Chefkeks/patch-4
florianbecker Nov 8, 2017
c37e3dd
Added ability to write gyms with address to new gyms table.
Chefkeks Nov 17, 2017
6d3deca
Added new functions to readme :D
Chefkeks Nov 27, 2017
99b19fa
A fresh start ;)
Chefkeks Nov 27, 2017
7f71ddf
Added function to get administrators from a specific chat_id
Chefkeks Nov 27, 2017
de816bd
Added bot access check, gym list keys and gym id functions, weekday f…
Chefkeks Nov 27, 2017
ad0517c
Added bot_access to restrict access to the bot - further adjustments …
Chefkeks Nov 27, 2017
a3e49c0
Added a way to create raids by selecting the gyms from the database -…
Chefkeks Nov 27, 2017
278e38b
Added a way to define pre-hatch egg time via inline keys
Chefkeks Nov 27, 2017
45b9f61
Adjustments due to the new option to create a raid by selecting a gym…
Chefkeks Nov 27, 2017
a244560
Added egg as emoji
Chefkeks Nov 29, 2017
35ee84f
Added Raid-Egg as inline key option
Chefkeks Nov 29, 2017
196d9bf
Show counters for each team as well as extra people and trainers with…
Chefkeks Nov 29, 2017
466e007
Fix error in SQL query - when fix is working, needs to be fixed in ot…
Chefkeks Nov 29, 2017
29ae7ca
Merge pull request #7 from Chefkeks/patch-5
florianbecker Nov 29, 2017
41e1db1
Cleanup table
Chefkeks Nov 29, 2017
a0be532
Add command to change raid boss when poll was created during pre-hatc…
Chefkeks Nov 29, 2017
5025a50
Update raid boss, currently level 5 only
Chefkeks Nov 29, 2017
707f852
Optimization to BOT_ACCESS which now allows comma separated input of …
Chefkeks Nov 30, 2017
afd7e0f
Optimization to BOT_ACCESS which now allows comma separated input of …
Chefkeks Nov 30, 2017
88eb7a5
Merge branch 'patch-6' of https://github.com/Chefkeks/raid-pokemon-bo…
Chefkeks Nov 30, 2017
1621f09
Add another step to select first letter of gym name to make gym selec…
Chefkeks Dec 1, 2017
af9650f
Update several files to work with the new first letter gym selection
Chefkeks Dec 1, 2017
e09b759
Remove keys after pokemon got updated
Chefkeks Dec 1, 2017
851fece
Add new logic for first letter selection and remove keys after pokemo…
Chefkeks Dec 1, 2017
19c4b11
Merge branch 'patch-6' of https://github.com/Chefkeks/raid-pokemon-bo…
Chefkeks Dec 1, 2017
9cb6198
Small change to message displayed
Chefkeks Dec 1, 2017
f276245
Remove /pokemon for the moment
Chefkeks Dec 1, 2017
3ba6d8e
Remove /pokemon for the moment #2
Chefkeks Dec 1, 2017
b416444
Remove /pokemon for the moment #3
Chefkeks Dec 1, 2017
c583e30
Remove now unneeded count_data :)
Chefkeks Dec 1, 2017
f14dddb
Merge pull request #8 from Chefkeks/patch-6
florianbecker Dec 1, 2017
1b36ce1
Oops ... Fixes lat lon in address link :)
Chefkeks Dec 1, 2017
8d2d379
Merge pull request #9 from Chefkeks/patch-lat-lon
florianbecker Dec 1, 2017
87d2b96
Merge branch 'master' of https://github.com/Chefkeks/raid-pokemon-bot…
Chefkeks Dec 2, 2017
ee82655
Added /pokemon to update the raid boss
Chefkeks Dec 3, 2017
dcef12f
Added the new raid bosses, removed the egg emoji
Chefkeks Dec 3, 2017
2cd5108
Added pokemon_keys used by raid_edit_poke.php and edit.php, Added bac…
Chefkeks Dec 3, 2017
90aceb4
Added back key to go back to the gym letter selection
Chefkeks Dec 3, 2017
92c8051
Pokemon selection keys are now generated by new pokemon_keys function…
Chefkeks Dec 3, 2017
66b53f9
Use show_raid_poll_small to unify design
Chefkeks Dec 3, 2017
8c20fd3
Use 5 keys per row and every minute in the selection to allow exact t…
Chefkeks Dec 3, 2017
0dbe36d
Merge pull request #10 from Chefkeks/patch-7
florianbecker Dec 4, 2017
5c62e96
Only show own raids since raid_access_check does not allow currently …
Chefkeks Dec 4, 2017
b0ceeb0
Only show own raids since raid_access_check does not allow currently …
Chefkeks Dec 4, 2017
7d0aba5
Update pokemon.php
Chefkeks Dec 4, 2017
fa9d9ef
Merge branch 'patch-8' of https://github.com/Chefkeks/raid-pokemon-bo…
Chefkeks Dec 4, 2017
d577ed4
Added /pokemon to the readme
Chefkeks Dec 4, 2017
0426ac7
Merge branch 'patch-8' of https://github.com/Chefkeks/raid-pokemon-bo…
Chefkeks Dec 4, 2017
052896e
Merge pull request #11 from Chefkeks/patch-8
florianbecker Dec 4, 2017
7eaaef8
New cleanup database table
Chefkeks Dec 5, 2017
b64f4c3
Merge branch 'master' of https://github.com/Chefkeks/raid-pokemon-bot…
Chefkeks Dec 5, 2017
6a3fb3d
Several small improvements and fixes to e.g. avoid duplicate logging,…
Chefkeks Dec 5, 2017
0be6544
Added function to insert cleanup info to database, Small improvements…
Chefkeks Dec 5, 2017
4745a5e
Added delete_message function, Added cleanup preparation stuff in cur…
Chefkeks Dec 5, 2017
33b2317
Deleted some unneeded debug_log's and moved is_numeric check to logic…
Chefkeks Dec 5, 2017
525b511
Improved insert_cleanup function
Chefkeks Dec 5, 2017
25697e6
Added cleanup stuff to index.php
Chefkeks Dec 5, 2017
cbd6b1d
Oops, fixed count for trainers without team
Chefkeks Dec 6, 2017
59333ee
Fixed API Key uppercase/lowercase issues (Finally :D) and improved ra…
Chefkeks Dec 7, 2017
e50ec22
Fixed cleanup preparation call for channel_post and added call to cle…
Chefkeks Dec 7, 2017
32f0693
Changed cleanup table to work with negative numbers used by Telegram …
Chefkeks Dec 7, 2017
5e786f4
Removed end time from function to collect cleanup data, added run_cle…
Chefkeks Dec 7, 2017
9626525
Added id column since raid_id may not be unique when shared to multip…
Chefkeks Dec 10, 2017
7a16e2c
Added column to cleanup info from database once everything else is cl…
Chefkeks Dec 10, 2017
2801116
Moved cleanup process up due to supergroup cleanup info collection is…
Chefkeks Dec 10, 2017
d988780
Added cleanup logic - feature is now complete and working without bug…
Chefkeks Dec 11, 2017
f8e735b
Updated example config for cleanup
Chefkeks Dec 11, 2017
02c6820
Added cleanup features to readme
Chefkeks Dec 11, 2017
172621f
Changed logging stuff to reflect recent changes to 15 minutes duplica…
Chefkeks Dec 11, 2017
b7821c3
Add message to raid poll if raid boss is in list for exclusive raids …
Chefkeks Dec 11, 2017
1afeafb
Added message if no active raids are found
Chefkeks Dec 12, 2017
25a14bb
Added get_chat function
Chefkeks Dec 12, 2017
ee443a8
Improved bot_access_check and fixed SQL issue discovered by @Olimpius…
Chefkeks Dec 12, 2017
0efa3b0
Added BOT_ADMINS in preparation of adding commands to add and remove …
Chefkeks Dec 12, 2017
626c885
Merge pull request #12 from Chefkeks/cleanup
florianbecker Dec 12, 2017
3b74ebe
Merge branch 'master' of https://github.com/Chefkeks/raid-pokemon-bot…
Chefkeks Dec 12, 2017
4de1366
Added some TODO / IDEA stuff so I don't forget
Chefkeks Dec 13, 2017
821a643
Added moderator keys function, a NEXT key function and a get_user fun…
Chefkeks Dec 13, 2017
abe0a7f
Added moderator command /mods to list/add/delete moderators
Chefkeks Dec 13, 2017
46a0cbc
Added button to switch view from minutes until raid start to clock ti…
Chefkeks Dec 13, 2017
3ce6a27
Duplication check 2.0: Works now with /start command :D, Small adjust…
Chefkeks Dec 14, 2017
b5492cd
Duplication check 2.0 adjustment since raid_id can now be negative, s…
Chefkeks Dec 14, 2017
b9a8a80
Adjustments due to changed get_user function
Chefkeks Dec 14, 2017
64f3064
Added duplication check to raid creation via /start to warn user when…
Chefkeks Dec 14, 2017
9d6d2f7
Update README
Chefkeks Dec 14, 2017
247492b
Always add maintainer_id and bot_admins even when checking for access…
Chefkeks Dec 14, 2017
0bd0abc
Language Support for EN, DE and NL
florianbecker Dec 15, 2017
8ae01ad
Translation fix
florianbecker Dec 15, 2017
d6826ad
Insert Groudon Raid Boss
florianbecker Dec 15, 2017
2fe8328
Fix spelling key
florianbecker Dec 15, 2017
0a5f0e1
Update edit_poke.php
klablabla Dec 17, 2017
9685407
Update config.php.example
klablabla Dec 17, 2017
5c17436
Update edit_start.php
klablabla Dec 17, 2017
cc3328a
Language fixes
Dec 17, 2017
6209e62
Update config.php.example
klablabla Dec 17, 2017
61f5c6d
Update edit_start.php
klablabla Dec 17, 2017
f5aed45
Allow moderators to edit any raid
Chefkeks Dec 17, 2017
545fba2
Merge remote-tracking branch 'origin/master' into merge-i18n-mods
Chefkeks Dec 17, 2017
915fdb4
Added handling for moderators who have not votet on a raid before by …
Chefkeks Dec 18, 2017
80130fb
Language optimizations
Chefkeks Dec 18, 2017
0b028ba
Improvements to bot_access_check and raid_access_check
Chefkeks Dec 18, 2017
46d755a
Fixed raid duplication check for empty gym name, Fixed send message b…
Chefkeks Dec 18, 2017
dfa9d40
Fixed spelling and spaces
Chefkeks Dec 18, 2017
53d95a3
Added /mods to the readme
Chefkeks Dec 18, 2017
b77a9cb
Add /list to new multilanguage support, fixed no timezone found issue…
Chefkeks Dec 18, 2017
97e06c4
Fixed untranslated 'Bin da', shortend cancellation and done to just s…
Chefkeks Dec 18, 2017
fedda79
Added option for admins to continue with warning message, non-adminis…
Chefkeks Dec 19, 2017
2fb0e81
Oops! Fixed security issue in BOT_ACCESS_CHECK!
Chefkeks Dec 19, 2017
fa6cc38
Merge pull request #16 from olimpius1985/master
florianbecker Dec 20, 2017
d30d9c1
Merge pull request #13 from klablabla/patch-2
florianbecker Dec 20, 2017
e389cf8
Merge pull request #14 from klablabla/patch-3
florianbecker Dec 20, 2017
a4f61d0
Merge pull request #15 from klablabla/patch-4
florianbecker Dec 20, 2017
99e3a24
Merge branch 'master' of https://github.com/florianbecker/raid-pokemo…
Chefkeks Dec 20, 2017
ade1ee4
Oops! Used wrong translation string for raid message. Discovered by @…
Chefkeks Dec 20, 2017
adb36a2
Merge pull request #17 from Chefkeks/merge-i18n-mods
florianbecker Dec 20, 2017
6cd9bbc
Fix missing x raid boss mewtu
florianbecker Dec 20, 2017
15e75fc
Use most relevant geo api entry
florianbecker Dec 20, 2017
c95f6f4
Added update sql statement to insert_gym function, lookup address alw…
Chefkeks Dec 21, 2017
9a7c0ab
Oops! Continue only if chat type is private, otherwise check administ…
Chefkeks Dec 21, 2017
329878b
Merge pull request #18 from Chefkeks/raid-create-use-geoapi
florianbecker Dec 22, 2017
7abdcb8
Update language.json
klablabla Dec 24, 2017
c308823
Improved logic to allow start_time being a part of the voting times, …
Chefkeks Dec 26, 2017
0dea058
Fixed copy/paste error in address, Added check for ex-raid so a Mewtw…
Chefkeks Dec 26, 2017
d787410
Improved bot_access_check function to allow easier debugging and ensu…
Chefkeks Dec 27, 2017
8828645
Allow moderators to overwrite a raid which is in creation, not only a…
Chefkeks Dec 27, 2017
b6a9179
Merge pull request #19 from klablabla/patch-5
florianbecker Jan 5, 2018
5577202
Merge pull request #20 from Chefkeks/some-fixes-and-improvements
florianbecker Jan 5, 2018
6ee3b96
Update language.json
klablabla Jan 6, 2018
6e1aa24
Update constants.php
klablabla Jan 6, 2018
9a53541
Merge pull request #21 from klablabla/patch-6
florianbecker Jan 8, 2018
7722767
Merge pull request #22 from klablabla/patch-7
florianbecker Jan 8, 2018
49ab834
Add overview table to sql file
Chefkeks Jan 12, 2018
4690b48
Kyogre
Chefkeks Jan 12, 2018
8f8148e
New /list command file
Chefkeks Jan 12, 2018
8dd8633
Disable telegram web_page_preview inside raid poll messages
Chefkeks Jan 12, 2018
c75c62b
Old /list command file, now module file - improved output a bit for s…
Chefkeks Jan 12, 2018
cba3d04
Language stuff for overview
Chefkeks Jan 12, 2018
bede818
Overview modules and logic
Chefkeks Jan 14, 2018
4c335e5
Beautify it! Add a whitespace :D
Chefkeks Jan 14, 2018
4f0c29c
Merge pull request #23 from Chefkeks/raids-overview
florianbecker Jan 15, 2018
433cd5a
Added attendances (summarized for all timeslots) to the overview
Chefkeks Jan 15, 2018
1405b5f
Bug, didn't get translation.
klablabla Jan 15, 2018
607029f
Oops... fix check to avoid updating of pokemon when they are in the e…
Chefkeks Jan 16, 2018
3833650
Merge pull request #24 from Chefkeks/overview-with-attendances
florianbecker Jan 16, 2018
9c355c8
Merge pull request #25 from klablabla/patch-9
florianbecker Jan 16, 2018
5474ef3
Added "Portuguese - Brazilian" Language
GabArcanjo Jan 17, 2018
15ac2d5
Merge pull request #26 from GabArcanjo/patch-1
florianbecker Jan 17, 2018
891a772
Update README to include latest changes
Chefkeks Jan 18, 2018
6da5542
Merge pull request #27 from Chefkeks/patch-1
florianbecker Jan 18, 2018
8c5a2bc
bug on row 535 was 5star had to be 1 star.
klablabla Jan 18, 2018
1df89af
Improved query (now queries) for cleanup logic, fixed unnecessary cal…
Chefkeks Jan 18, 2018
34b2df7
Added cleanup check to my_query function to write cleanup sql stuff t…
Chefkeks Jan 19, 2018
0d1b98f
Oops, forgot the dot
Chefkeks Jan 21, 2018
f1b8719
Merge pull request #28 from klablabla/patch-10
florianbecker Jan 22, 2018
f6b26d4
Merge pull request #29 from Chefkeks/cleanup-improvements
florianbecker Jan 22, 2018
00e5119
Added new command /delete to delete raids
Chefkeks Jan 22, 2018
55be57e
Added new /delete command to existing modules, improved /list and /po…
Chefkeks Jan 22, 2018
31a1751
Renamed to modules/raids_list.php since we now have modules/raids_del…
Chefkeks Jan 22, 2018
38b69d1
Added language stuff to delete raids
Chefkeks Jan 22, 2018
bc49467
Added logic to delete a raid in telegram and the database, improved b…
Chefkeks Jan 22, 2018
c7eed00
Forgot to add missing part of NL translation
Chefkeks Jan 22, 2018
e088b07
Update README to include /delete function
Chefkeks Jan 22, 2018
a46a607
Merge pull request #30 from Chefkeks/feature-delete-raids
florianbecker Jan 23, 2018
9953364
Add new variables to restrict sharing of raids
Chefkeks Jan 23, 2018
1264e9e
Add logic for the share keys
Chefkeks Jan 23, 2018
154aa32
Add new sharing keys, removed updating of raid user_id as a potential…
Chefkeks Jan 23, 2018
3befaf7
Add module to exit the current process/action
Chefkeks Jan 23, 2018
1b510ef
Add new sharing keys and delete key. Update user_id to make sure the …
Chefkeks Jan 23, 2018
04fd07c
Add module to share raids with a chat
Chefkeks Jan 23, 2018
9ccc902
Added new sharing restrictions to readme
Chefkeks Jan 23, 2018
dfdbe01
Buying an i :D
Chefkeks Jan 23, 2018
14d562b
Add translations for the new sharing feature
Chefkeks Jan 23, 2018
3c3d4fb
Add Aggron as level 4 raid boss, fix two misspellings
Chefkeks Jan 24, 2018
b335c4a
Add share buttons to /list command to re-share a raid poll
Chefkeks Jan 24, 2018
915a89f
Add message to cleanup_log if wrong secret was supplied
Chefkeks Jan 24, 2018
2843942
Merge pull request #31 from Chefkeks/raid_sharing
florianbecker Jan 24, 2018
8fb6052
Added reply_to_message_id since we check for it to add raids to cleanup
Chefkeks Jan 24, 2018
3091dad
Some debugging improvements for the cleanup process
Chefkeks Jan 24, 2018
a12ec2b
Two additional fixes
Chefkeks Jan 24, 2018
422ec82
Merge pull request #32 from Chefkeks/sharing_fixes
florianbecker Jan 24, 2018
b32f0cd
Oops... Forgot where in sql statement.
Chefkeks Jan 31, 2018
5136938
Merge pull request #33 from Chefkeks/start_time_fix
florianbecker Jan 31, 2018
3a41672
Added all legendaries
klablabla Feb 8, 2018
9c391c6
Merge pull request #34 from klablabla/patch-11
florianbecker Feb 8, 2018
78a7e81
Add Rayquaza Raid Boss
florianbecker Feb 8, 2018
72a86cd
Added Legendaries
klablabla Feb 8, 2018
4d5873e
Merge pull request #35 from klablabla/patch-12
florianbecker Feb 8, 2018
ea5d815
Added pokemon column to attendance
Chefkeks Feb 9, 2018
79b44a0
Added new file when voting for pokemon
Chefkeks Feb 9, 2018
41d4943
Added logic to vote for pokemon
Chefkeks Feb 9, 2018
5a9c6ff
Added translations for new pokemon voting feature. Maybe the whole fi…
Chefkeks Feb 9, 2018
63251dc
Merge pull request #36 from Chefkeks/pokemon-keys
florianbecker Feb 9, 2018
7d3900f
Fix issue of wrong button layout, now 3 buttons for each row. Do not …
Chefkeks Feb 9, 2018
e1e85f1
Merge pull request #37 from Chefkeks/Elk99
florianbecker Feb 9, 2018
6c8a636
Added new T3/4
klablabla Feb 10, 2018
f30f9b3
Added new T3/4
klablabla Feb 10, 2018
a39d6c4
Merge pull request #38 from klablabla/patch-13
florianbecker Feb 10, 2018
1e6e196
Merge pull request #39 from klablabla/patch-14
florianbecker Feb 10, 2018
e703767
Fix pokemon names as some are different in German
Chefkeks Feb 13, 2018
609f7a7
Improve and fix issues with the new pokemon keys :)
Chefkeks Feb 13, 2018
d02e5d7
Merge pull request #40 from Chefkeks/gen3-poke-keys-fixes
florianbecker Feb 14, 2018
f01ef61
Switch gym selection and location at the start
klablabla Feb 16, 2018
1a90c04
Update start.php
klablabla Feb 16, 2018
f0526b7
Update language.json
klablabla Feb 16, 2018
7e666c7
Update constants.php
klablabla Feb 16, 2018
e7fbe65
Comment the part with INSERT INTO ATTENDANCES sql query to avoid dupl…
Chefkeks Feb 17, 2018
bab2250
Merge pull request #41 from klablabla/patch-15
florianbecker Feb 17, 2018
ef63f24
Merge pull request #42 from Chefkeks/fix-attendance-bug
florianbecker Feb 17, 2018
d61d13e
Fix connection on not well configures utf8 systems
florianbecker Feb 19, 2018
129d082
Define for database host
florianbecker Feb 20, 2018
d7d28a8
Add send_venue function, add detection to cleanup venue messages
Chefkeks Feb 21, 2018
c280c7a
Switch from send_location to send_venue to include it in cleanup
Chefkeks Feb 21, 2018
7c3f8d1
Remove 90% of keys, replace by short raid duration as default and exp…
Chefkeks Feb 21, 2018
3a1fb37
Generate start keys for raid level by levels available in constants.php
Chefkeks Feb 21, 2018
9fa6619
Merge pull request #43 from Chefkeks/improve-improve-improve
florianbecker Feb 21, 2018
9fe85e7
Change SQL to utf8mb4 for real unicoded formatting
florianbecker Feb 23, 2018
9348ac2
Insert Groudon and Kyogre as raid boss again
florianbecker Feb 23, 2018
459efa4
Update raid bosses lvl5, lvl4 and lvl3
florianbecker Mar 6, 2018
acdea86
Add phrases for new ex-raid selection, PT-BR still missing, but will …
Chefkeks Mar 8, 2018
9ca3188
Fixed a few bugs
Chefkeks Mar 8, 2018
debf252
Modified edit_poke and edit_start to work with the new edit_date.php …
Chefkeks Mar 8, 2018
9d747f3
Added edit_date to select date and time of an ex-raid :)
Chefkeks Mar 8, 2018
c1d8c00
Added localized names for months
Chefkeks Mar 9, 2018
f4bafbe
Update constants.php
klablabla Mar 15, 2018
23424c7
Update constants.php
florianbecker Mar 16, 2018
8eeb90b
Merge pull request #44 from klablabla/patch-16
florianbecker Mar 16, 2018
8bb06ae
Merge pull request #45 from Chefkeks/surprise-exraids
florianbecker Mar 16, 2018
d231ec7
Update raid bosses
klablabla Mar 17, 2018
b41a4ed
Update constants.php
klablabla Mar 17, 2018
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 .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.idea
config.php
310 changes: 301 additions & 9 deletions README.md

Large diffs are not rendered by default.

84 changes: 84 additions & 0 deletions commands/delete.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php
// Write to log.
debug_log('DELETE');

// Check access.
bot_access_check($update, BOT_ACCESS);

// Build query.
$rs = my_query(
"
SELECT timezone
FROM raids
WHERE id = (
SELECT raid_id
FROM attendance
WHERE user_id = {$update['message']['from']['id']}
ORDER BY id DESC LIMIT 1
)
"
);

// Get row.
$row = $rs->fetch_assoc();

// No data found.
if (!$row) {
//sendMessage($update['message']['from']['id'], 'Can\'t determine your location, please participate in at least 1 raid');
//exit;
$tz = TIMEZONE;
} else {
$tz = $row['timezone'];
}

// Build query.
$request = my_query(
"
SELECT *,
UNIX_TIMESTAMP(end_time) AS ts_end,
UNIX_TIMESTAMP(start_time) AS ts_start,
UNIX_TIMESTAMP(NOW()) AS ts_now,
UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(NOW()) AS t_left
FROM raids
WHERE end_time>NOW()
AND timezone='{$tz}'
ORDER BY end_time ASC LIMIT 20
"
);

// Count results.
$count = 0;

// Get raids.
while ($raid = $request->fetch_assoc()) {

// Counter++
$count = $count + 1;

// Create keys array.
$keys = [
[
[
'text' => getTranslation('delete'),
'callback_data' => $raid['id'] . ':raids_delete:0'
]
]
];

// Get message.
$msg = show_raid_poll_small($raid);

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

// Send message if no active raids were found.
if($count == 0) {
// Set message.
$msg = '<b>' . getTranslation('no_active_raids_found') . '</b>';

// Send message.
sendMessage($update['message']['from']['id'], $msg);
}

exit;
129 changes: 87 additions & 42 deletions commands/gym.php
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,44 +1,89 @@
<?php
// Get gym name.
$gym_name = trim(substr($update['message']['text'], 4));

$gym_name = trim(substr($update['message']['text'],4));

debug_log('SET gym name to '.$gym_name);

if ($update['message']['chat']['type']=='private' || $update['callback_query']['message']['chat']['type']=='private') {
$query = 'UPDATE raids SET gym_name="'.$db->real_escape_string($gym_name).'" WHERE user_id='.$update['message']['from']['id'].' ORDER BY id DESC LIMIT 1';
my_query($query);

sendMessage('none',$update['message']['chat']['id'],'Gym name updated');

} else {
if ($update['message']['reply_to_message']['text']) {
$lines = explode(CR,$update['message']['reply_to_message']['text']);
$last_line = array_pop($lines);
$pos = strpos($last_line, 'ID = ');
$id = intval(trim(substr($last_line,$pos+5)));
debug_log('Gym ID='.$id.' name='.$gym_name);

$query = 'SELECT COUNT(*) FROM users WHERE user_id='.$update['message']['from']['id'].' AND moderator=1';
$rs = my_query($query);
$row = $rs->fetch_row();
$q = ' AND user_id='.$update['message']['from']['id'];
if ($row[0]) $q = '';

$query = 'UPDATE raids SET gym_name="'.$db->real_escape_string($gym_name).'" WHERE id='.$id.' '.$q;
my_query($query);

$rs = my_query('SELECT *,
UNIX_TIMESTAMP(end_time) AS ts_end,
UNIX_TIMESTAMP(NOW()) as ts_now,
UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(NOW()) AS t_left
FROM raids WHERE id='.$id.'');
$raid = $rs->fetch_assoc();

$text = show_raid_poll($raid);
$keys = keys_vote($raid);

editMessageText($update['message']['reply_to_message']['message_id'], $text, $keys, $update['message']['chat']['id']);
}
}

exit;
// Write to log.
debug_log('SET gym name to ' . $gym_name);

// Private chat type.
if ($update['message']['chat']['type'] == 'private' || $update['callback_query']['message']['chat']['type'] == 'private') {
// Update gym name in raid table.
my_query(
"
UPDATE raids
SET gym_name = '{$db->real_escape_string($gym_name)}'
WHERE user_id = {$update['message']['from']['id']}
ORDER BY id DESC LIMIT 1
"
);

// Send the message.
sendMessage($update['message']['chat']['id'], getTranslation('gym_name_updated'));

} else {
if ($update['message']['reply_to_message']['text']) {

$lines = explode(CR, $update['message']['reply_to_message']['text']);
$last_line = array_pop($lines);
$pos = strpos($last_line, 'ID = ');
$id = intval(trim(substr($last_line, $pos + 5)));

// Write to log.
debug_log('Gym ID=' . $id . ' name=' . $gym_name);

// Build query.
$rs = my_query(
"
SELECT COUNT(*)
FROM users
WHERE user_id = {$update['message']['from']['id']}
AND moderator = 1
"
);

$row = $rs->fetch_row();


if ($row[0]) {
// Build query.
my_query(
"
UPDATE raids
SET gym_name = '{$db->real_escape_string($gym_name)}'
WHERE id = {$id}
"
);

} else {
// Build query.
my_query(
"
UPDATE raids
SET gym_name = '{$db->real_escape_string($gym_name)}'
WHERE id = {$id}
AND user_id = {$update['message']['from']['id']}
"
);
}

$rs = my_query(
"
SELECT *,
UNIX_TIMESTAMP(end_time) AS ts_end,
UNIX_TIMESTAMP(NOW()) AS ts_now,
UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(NOW()) AS t_left
FROM raids
WHERE id = {$id}
"
);

$raid = $rs->fetch_assoc();

$text = show_raid_poll($raid);
$keys = keys_vote($raid);

editMessageText($update['message']['reply_to_message']['message_id'], $text, $keys, $update['message']['chat']['id']);
}
}

exit;
18 changes: 13 additions & 5 deletions commands/help.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
<?php

$rs = my_query('SELECT * FROM help WHERE id=253227190');
$row = $rs->fetch_assoc();
if (!$row) exit;

sendMessage('none',$update['message']['from']['id'],$row['message']);
$msg = '
<b>EN Guide on how to create a raid poll raid bot</b>
1) make sure the raid hasn\'t been posted yet in the chat
2) check how much time is left for the raid
3) open new PM with @RaidPokemonBot
4) send your location to the bot (make sure you send the location of where the gym is located)
5) choose the type of raid boss and the time left
6) to ensure an easier way to locate the gym in game/chat, it\'s recommended to use the bot function /gym <code>(name of the gym and/or description of it)</code>
7) press share and choose yourRaid channel
8) wait until the option with the boss name appears and select it
';
$msg = 'This is a private bot.'; // temp
sendMessage($update['message']['from']['id'], $msg);

63 changes: 36 additions & 27 deletions commands/list.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
<?php

debug_log('LIST');
$q = 'SELECT timezone FROM raids WHERE id=(SELECT raid_id FROM attendance WHERE user_id='.$update['message']['from']['id'].' ORDER BY id DESC LIMIT 1)';
debug_log($q);
$rs = my_query($q);
$row = $rs->fetch_assoc();
if (!$row) {
sendMessage('none',$update['message']['from']['id'],'Can\'t determine your location, please participate in at least 1 raid');
exit;
}
// Write to log.
debug_log('LIST');

$tz = $row['timezone'];
// Check access.
bot_access_check($update, BOT_ACCESS);

$request = my_query('SELECT *,
UNIX_TIMESTAMP(end_time) AS ts_end,
UNIX_TIMESTAMP(NOW()) as ts_now,
UNIX_TIMESTAMP(end_time)-UNIX_TIMESTAMP(NOW()) AS t_left
FROM raids WHERE end_time>NOW() AND timezone="'.$tz.'" ORDER BY end_time ASC LIMIT 20');
// Get the userid and chattype
$userid = $update['message']['from']['id'];
$chattype = $update['message']['chat']['type'];

while($raid = $request->fetch_assoc()) {
$keys = [[[
'text' => 'Expand', 'callback_data' => $raid['id'].':vote_refresh:0',
]]];
$msg = show_raid_poll_small($raid);
send_message('none',$update['message']['from']['id'],$msg, $keys,
['reply_markup' => ['selective'=>true, 'one_time_keyboard'=>true]]
);
}
// Init empty keys array.
$keys = array();


exit;
// Create keys array.
$keys = [
[
[
'text' => getTranslation('list'),
'callback_data' => $userid . ',' . $chattype . ':raids_list:0'
]
],
[
[
'text' => getTranslation('overview_share'),
'callback_data' => '0:overview_share:0'
],
[
'text' => getTranslation('overview_delete'),
'callback_data' => '0:overview_delete:0'
]
]
];

// Set message.
$msg = '<b>' . getTranslation('raids_list_share_overview') . ':</b>';

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

exit;
35 changes: 35 additions & 0 deletions commands/mods.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
// Write to log.
debug_log('MODS');

// Check access - user must be admin!
bot_access_check($update, BOT_ADMINS);

// Init empty keys array.
$keys = array();

// Create keys array.
$keys = [
[
[
'text' => getTranslation('list'),
'callback_data' => '0:mods:list'
],
[
'text' => getTranslation('add'),
'callback_data' => '0:mods:add'
],
[
'text' => getTranslation('delete'),
'callback_data' => '0:mods:delete'
]
]
];

// Set message.
$msg = '<b>' . getTranslation('mods_list_add_delete') . ':</b>';

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

exit;
34 changes: 34 additions & 0 deletions commands/new.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
// Write to log.
debug_log('NEW');

// Get the userid and chattype
$userid = $update['message']['from']['id'];
$chattype = $update['message']['chat']['type'];

// Get lat and lon from message text. (remove: "/new ")
$coords = trim(substr($update['message']['text'], 4));

// #TODO
// Add check to validate latitude and longitude
// If lat and lon = valid
// button to create raid
// else
// no button and error message

// Create keys array.
$keys = [
[
[
'text' => getTranslation('create_a_raid'),
'callback_data' => $userid . ',' . $chattype . ':raid_create:' . $coords,
]
]
];

$msg = getTranslation('coordination_succes');

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

exit;
Loading