forked from Ninjasoturi/PokemonRaidBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteam.php
47 lines (40 loc) · 1.13 KB
/
team.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
// Write to log.
debug_log('TEAM()');
// For debug.
//debug_log($update);
//debug_log($data);
// Get the team.
$gym_team = trim(strtolower(substr($update['message']['text'], 5)));
// Match team names.
$teams = array(
'mystic' => 'mystic',
'instinct' => 'instinct',
'valor' => 'valor',
getTranslation('red') => 'valor',
getTranslation('blue') => 'mystic',
getTranslation('yellow') => 'instinct',
'r' => 'valor',
'b' => 'mystic',
'y' => 'instinct',
'g' => 'instinct'
);
// Valid team name.
if ($teams[$gym_team]) {
// Update team in raids table.
my_query(
"
UPDATE raids
SET gym_team = '{$teams[$gym_team]}'
WHERE user_id = {$update['message']['from']['id']}
ORDER BY id DESC LIMIT 1
"
);
// Send the message.
sendMessage($update['message']['chat']['id'], getTranslation('gym_team_set_to') . ' ' . ucfirst($teams[$gym_team]));
// Invalid team name.
} else {
// Send the message.
sendMessage($update['message']['chat']['id'], getTranslation('invalid_team'));
}
?>