public function main() { $Vote = new Vote($this->db); $leaderboard = $Vote->getVoteLeaderboard($this->Message->Chat->id); $out = ''; $index = 0; if (!empty($leaderboard)) { foreach ($leaderboard as $uservote) { $index++; $out .= "`" . $this->addOrdinalNumberSuffix($index); if ($index >= 10) { $out .= " `"; } else { $out .= " `"; } $vote_prefix = $uservote->vote_total > 0 ? "+" : ""; if (!isset($uservote->vote_total)) { $uservote->vote_total = 0; } $out .= "*" . $uservote->user->getName() . "* (" . $vote_prefix . $uservote->vote_total . ")\n"; } } else { $out .= "No users to display."; } Telegram::talk($this->Message->Chat->id, $out); }
public function main() { if ($this->Message->text == 'dubs') { $no = mt_rand(0, 9); Telegram::talk($this->Message->Chat->id, "`" . str_repeat($no, 9) . "`"); return true; } $q = explode("d", trim($this->Message->text)); if (count($q) == 2 && is_numeric($q[0]) && is_numeric($q[1])) { $no = intval($q[0]); $sides = intval($q[1]); if ($no < 0 || $sides < 0 || $no > 50 || $sides > 999999999) { Telegram::talk($this->Message->Chat->id, "naw brah"); return false; } $out = array_map("mt_rand", array_fill(0, $no, 1), array_fill(0, $no, $sides)); $out = implode(", ", $out); Telegram::talk($this->Message->Chat->id, "`" . $out . "`"); } else { $out = mt_rand(0, 999999999); $dubs = array(9 => "nines", 8 => "eights", 7 => "sevens", 6 => "sixes", 5 => "quints", 4 => "quads", 3 => "trips", 2 => "dubs"); foreach ($dubs as $key => $value) { $test = substr(strval($out), 0 - $key); if (preg_match('/^(.)\\1*$/', $test)) { $text = str_repeat(emoji(0x1f389), $key - 1) . "`" . sprintf('%09d', $out) . "`" . "\nnice " . $value . " brah" . str_repeat("!", $key - 1); Telegram::talk($this->Message->Chat->id, $text); return true; } } Telegram::talk($this->Message->Chat->id, "`" . sprintf('%09d', $out) . "`"); } return true; }
public function main() { $Vote = new Vote($this->db); $user_vote_total = $Vote->getVoteTotalForUserInChat($this->Message->User, $this->Message->Chat->id); $user_vote_from = $Vote->getUserVotesInChat($this->Message->User, $this->Message->Chat->id); $out = "You're on *{$user_vote_total}*. "; if (count($user_vote_from) > 0) { $out .= "You've voted as follows:"; $thumbs_up = emoji(0x1f44d); $thumbs_down = emoji(0x1f44e) . emoji(0x1f3ff); foreach ($user_vote_from as $userVote) { $emoji = $userVote->vote == VoteType::Up ? $thumbs_up : $thumbs_down; $out .= "\n` `• " . $emoji . " *" . ($userVote->voted_for ? $userVote->voted_for->getName() : 'uhoh') . "* "; } } else { $out .= "You haven't cast any votes."; } $out .= "\nYou can see the voting leaderboard with /vote"; Telegram::talk($this->Message->Chat->id, $out); }
public function main() { if ($this->isParam() && $this->noParams() > 2) { $params = explode(' to ', $this->getAllParams(), 2); if (count($params) == 2) { try { $date_due = Carbon::parse($params[0]); $reminder = new Reminder(); $reminder->construct($this->Message->User->user_id, $this->Message->Chat->id, Carbon::now()->toDateTimeString(), $date_due->toDateTimeString(), $params[1]); $ReminderControl = new Control($this->db); $ReminderControl->addReminder($reminder); $diff = $date_due->diffForHumans(Carbon::now(), true); $out = emoji(0x23f2) . " Okay, I've scheduled a reminder in *{$diff}*."; if ($date_due->diffInMinutes(Carbon::now()) < 60) { $out .= "\n\nBy the way, I only send out notifications once a minute."; } Telegram::talk($this->Message->Chat->id, $out); return true; } catch (\Exception $e) { // nada } } } $out = emoji(0x270d) . " Like this fam: " . "\n" . "\n` `• `/remind` *+2 hours* `to` *pick up the milk*" . "\n` `• `/remind` *2:25PM 26th April* `to` *look out the window*" . "\n` `• `/remind` *tomorrow 5PM* `to` *go outside*" . "\n` `• `/remind` *monday 2AM* `to` *go to sleep*" . "\n" . "\nMy timezone is *GMT+8*, and it's now *" . date('g:i A') . "* on the *" . date('jS') . "*."; Telegram::talk($this->Message->Chat->id, $out); return true; }
public function main() { $Transact = new Transact($this->db); if ($this->noParams() == 2) { $user_receiving = Query::getUserMatchingStringOrErrorMessage($this->db, $this->Message->Chat, $this->getParam()); if (is_string($user_receiving)) { Telegram::talk($this->Message->Chat->id, $user_receiving); return false; } $Transaction = new Transaction($this->Message->User, $user_receiving, $this->getParam(1), new TransactionType(TransactionType::Manual)); $Transact->performTransaction($Transaction); if ($Feedback = $Transact->Feedback->getFeedback()) { $out = emoji("0x1F4E2") . " " . $Feedback . "\n` `• `" . $user_receiving->getName() . "` now has 💰*" . $user_receiving->getBalance() . "*" . "\n` `• `You've` got 💰*" . $this->Message->User->getBalance() . "* left."; if ($user_receiving->user_id != -1) { $out .= "\n` `• `The Bank` took 2%, or 💰*" . round($this->getParam(1) * 0.02, 2) . "*"; } Telegram::talk($this->Message->Chat->id, $out); } else { Telegram::talk($this->Message->Chat->id, "I'm so sorry brah..."); } } else { Telegram::talk($this->Message->Chat->id, "Like this fam " . emoji("0x1F449") . " /send richardstallman 10"); } return true; }
public function main() { $RussianRoulette = new RussianRoulette($this->db, $this->Message->Chat->id, $this->Message->User->user_id); $RussianRoulette->reload(); $out = emoji(0x1f52b) . " `Revolver reloaded.`" . "\n" . "\nThere are *six* chambers, and *one* bullet." . "\nUse /trigger to play."; Telegram::talk($this->Message->Chat->id, $out); }
public function q_echo() { if ($this->Message->isText()) { Telegram::talk($this->Message->Chat->id, ">not understanding echo"); } else { Telegram::talk($this->Message->Chat->id, $this->Message->text); } }
public function s_spookyecho() { if ($this->Message->Chat->type == ChatType::Group) { Telegram::talk($this->Message->Chat->id, ">not understanding spookyecho"); } elseif (strlen($this->Message->text) == 0) { Telegram::talk($this->Message->Chat->id, ">still not understanding spookyecho"); } else { Telegram::talk('-19315940', $this->Message->text); } }
public function main() { $word = strlen($this->getAllParams()) > 10 ? substr($this->getAllParams(), 10) : $this->getAllParams(); $word = strtoupper($word); $out = implode(' ', str_split($word)); foreach (str_split(substr($word, 1)) as $char) { $out .= "\n{$char}"; } Telegram::talk($this->Message->Chat->id, "*{$out}*"); }
public function main() { $Level = new Level(); $user = $this->Message->User; $greetings = array("Arise", "Congratulations"); if ($Level->buyLevel($user, $this->db)) { $out = emoji(0x1f4ef) . " " . $greetings[mt_rand(0, count($greetings) - 1)] . " *" . $user->getName() . "*, you are now a *Level " . $user->level . " " . $user->getTitle() . "*!" . "\nYou may rise to Level " . ($user->level + 1) . " for a price of " . $Level->getLevelPrice($user->level + 1) . " Coin."; } else { $out = emoji(0x1f44e) . " Sorry, you need " . $Level->getLevelPrice($user->level + 1) . " Coin to rise to Level " . ($user->level + 1) . "."; } Telegram::talk($this->Message->Chat->id, $out); }
public function s_spookyzalgoperson() { $zalgo = new Zalgo(NULL); $out = $zalgo->speak($this->Message->text); $no1 = $zalgo->speak(">not understanding spookyzalgoperson"); $no2 = $zalgo->speak(">still not understanding spookyzalgoperson"); if ($this->Message->Chat->type == ChatType::Group) { Telegram::talk($this->Message->Chat->id, $no1); } elseif (strlen($this->Message->text) == 0) { Telegram::talk($this->Message->Chat->id, $no2); } else { Telegram::talk('-19315940', person($out, false)); } }
public function main() { if ($this->isParam()) { $user = Query::getUserMatchingStringOrErrorMessage($this->db, $this->Message->Chat, $this->getParam()); if (is_string($user)) { Telegram::talk($this->Message->Chat->id, $user); return false; } Telegram::talk($this->Message->Chat->id, $user->getNameLevelAndTitle() . " has " . emoji("0x1F4B0") . "*" . $user->getBalance() . "*, brah"); } else { Telegram::talk($this->Message->Chat->id, "You've got " . emoji("0x1F4B0") . "*" . $this->Message->User->getBalance() . "*, brah"); } return true; }
public function main() { $this->out = emoji(0x1f4a2) . " *A great rumbling fills the earth...* " . emoji(0x1f4a2) . "\n"; if ($this->Message->User->getBalance() > 0 && $this->Message->User->level > 1) { $choices = ['loseFreeBets', 'losePopularity', 'loseAllMoney', 'dropOneLevel']; } elseif ($this->Message->User->getBalance() > 0 && $this->Message->User->level == 1) { $choices = ['loseFreeBets', 'losePopularity', 'loseAllMoney']; } elseif ($this->Message->User->getBalance() == 0 && $this->Message->User->level > 1) { $choices = ['loseFreeBets', 'losePopularity', 'dropOneLevel']; } else { $choices = ['loseFreeBets', 'losePopularity']; } $this->{$choices[mt_rand(0, count($choices) - 1)]}(); Telegram::talk($this->Message->Chat->id, $this->out); }
public function main() { $count = $this->isParam() && is_numeric($this->getParam()) ? intval($this->getParam()) : 1; if ($count < 1) { $count = 1; } if ($count > 4096) { $count = 4096; } $out = ''; for ($i = 0; $i < $count; $i++) { $out .= randomEmoji(); } Telegram::talk($this->Message->Chat->id, $out); }
public function main() { $Level = new \GroupBot\Brains\Level\Level(); if ($this->isParam()) { $user = Query::getUserMatchingStringOrErrorMessage($this->db, $this->Message->Chat, $this->getParam()); if (is_string($user)) { $out = $user; } else { $out = emoji(0x1f4ef) . " Make way for " . $user->getNameLevelAndTitle() . "!"; } } else { $user = $this->Message->User; $out = emoji(0x1f4ef) . " Greetings " . $user->getNameLevelAndTitle() . "." . "\nYou may rise to level " . ($user->level + 1) . " for a price of " . $Level->getLevelPrice($user->level + 1) . " Coin." . "\nPlease use /buylevel to do this."; } Telegram::talk($this->Message->Chat->id, $out); }
public function main() { $Events = new Events($this->db); if ($Events->addIncome($this->Message->User)) { Telegram::talk($this->Message->Chat->id, emoji(0x1f4b8) . " " . $this->Message->User->getNameLevelAndTitle() . ", you received your daily allowance of `" . Level::getDailyAllowance($this->Message->User->level) . "` coin. You now have `" . $this->Message->User->getBalance() . "` coin."); } else { $now = new \DateTime(); $future_date = new \DateTime('tomorrow'); $interval = $future_date->diff($now); $time = $interval->format("*%h hours* and *%i minutes*"); $out = emoji(0x1f4e2) . " " . $this->Message->User->getNameLevelAndTitle() . "..." . "\n\n" . emoji(0x1f44e) . " You must wait {$time} until you can add to your collection of `" . $this->Message->User->getBalance() . "` coin."; //$out = emoji(0x1F44E) . " You've already received your allowance today!" // . "\nThere's still $time to go until tomorrow"; Telegram::talk($this->Message->Chat->id, $out); } }
public function main() { return true; //Telegram::sendChatSendingPhotoStatus($this->Message->Chat->id); $Radar = new \GroupBot\Brains\Weather\Radar\Radar($this->Message->Chat->id, $this->db); $radar_code = 70; $image_radius_code = 3; if ($this->Message->isCallback()) { $key = $this->getParam(); $radar_code = Radar_Codes::$radar_codes[$key][0]; if (!$radar_code) { Telegram::edit_inline_message($this->Message->Chat->id, $this->Message->message_id, "Something went wrong!", []); return false; } Telegram::edit_inline_message($this->Message->Chat->id, $this->Message->message_id, "Showing {$radar_code}", []); } elseif ($this->isParam()) { if (!($radar_code = $Radar->getRadarCodeFromString($this->getParam()))) { Telegram::talk($this->Message->Chat->id, "Can't find that location, fam"); return false; } if (is_array($radar_code)) { $keyboard = []; $row = []; foreach ($radar_code as $name) { $row[] = ['text' => $name[0] . " (" . $name[2] . ")", 'callback_data' => "/radar {$name['2']}"]; } $keyboard[] = $row; Telegram::talk_inline_keyboard($this->Message->Chat->id, "Did you mean one of these?", $keyboard); return false; } if ($this->noParams() > 1 && !($image_radius_code = $Radar->getImageRangeFromString($this->getParam(1)))) { Telegram::talk($this->Message->Chat->id, "can't find that range, fam\nusually there's `128km`, `256km` or `512km` available"); return false; } } // Acquire lock $fp = fopen('/var/www/html/bot/radar/lock', 'r+'); if (!flock($fp, LOCK_EX | LOCK_NB)) { Telegram::talk($this->Message->Chat->id, "cool it, m8\n" . emoji(0x1f914) . " i'm thinking"); return false; } // Payload $Radar->createAndSendRadarGIF($radar_code, $image_radius_code); // Release lock fclose($fp); return true; }
public function main() { $RussianRoulette = new RussianRoulette($this->db, $this->Message->Chat->id, $this->Message->User->user_id); if ($RussianRoulette->isLoaded()) { if ($RussianRoulette->trigger()) { $out = emoji(0x1f4a5) . emoji(0x1f52b) . "\n" . "\n" . emoji(0x2620) . " *" . $this->Message->User->getName() . "* killed themselves." . "\n /reload to play again."; Telegram::talkForced($this->Message->Chat->id, $out); //Telegram::kick($this->Message->Chat->id, $this->Message->User->user_id); } else { $out = $this->getFace() . emoji(0x1f52b) . " `Click.`"; Telegram::talk($this->Message->Chat->id, $out); } } else { $out = emoji(0x1f449) . " The revolver isn't loaded. Use /reload first."; Telegram::talk($this->Message->Chat->id, $out); } }
public function t_stats() { $log = new Logging($this->Message); $Coin = new Coin(); $BlackjackSQL = new SQL(); $CasinowarSQL = new \GroupBot\Brains\Casinowar\SQL(); $Level = new Level(); if ($this->isParam()) { $user_id = $log->checkIfUserIsLogged($this->getParam()); if (!$user_id) { Telegram::talk($this->Message->Chat->id, "can't find that user, brah"); return false; } } else { $user_id = $this->Message->User->id; } $log = $log->getAllUserLogsForChat($user_id); $bj_stats = $BlackjackSQL->select_player_stats($user_id); $cw_stats = $CasinowarSQL->select_player_stats($user_id); $level = $Level->SQL->get_level($user_id); $level_title = $Level->getTitle($level); $CoinUser = $Coin->SQL->GetUserById($user_id); $date = 0; foreach ($log->LogsCommand as $cmd) { if (strtotime($cmd->last_used) > $date) { $last_cmd = $cmd; $date = strtotime($cmd->last_used); } } if (!isset($last_cmd)) { return false; } $out = emoji(0x1f4c8) . "*" . $this->Message->Chat->title . "* stats for " . "\n*" . $log->User->first_name . " " . $log->User->last_name . "*, the Level *{$level}* {$level_title}" . "\n` `•` " . $log->posts_today . "` message" . $this->plural_grammar($log->posts_today) . " sent today" . "\n` `•` " . $log->posts . "` message" . $this->plural_grammar($log->posts) . " sent ever" . "\n` `•` " . round(86400 * $log->posts / (strtotime("now") - strtotime("2015-11-19 11:00:00")), 0) . "` messages sent per day, on average" . "\nLast message `(" . date('D jS g:iA', strtotime($log->lastpost_date)) . ")`:" . "\n` `_" . $log->lastpost . "_" . "\nLast command: `" . $last_cmd->command . "`" . "\n` `•` " . $last_cmd->uses_today . "` use" . $this->plural_grammar($last_cmd->uses_today) . " today" . "\n` `•` " . $last_cmd->uses . "` use" . $this->plural_grammar($last_cmd->uses_today) . " ever"; $last_coin_activity = isset($CoinUser->last_activity) ? date('D jS g:iA', strtotime($CoinUser->last_activity)) : "not recorded"; $out .= "\n\n" . emoji(0x1f4b2) . "*" . COIN_CURRENCY_NAME . "* stats:" . "\n` `•` " . $CoinUser->getBalance() . "`" . emoji(0x1f4b0) . " in the bank" . "\n` `•` " . $Coin->SQL->GetNumberOfTransactionsByUser($CoinUser) . "` outgoing transactions ever" . "\n` `•` `Last activity: `" . $last_coin_activity . "`"; if ($bj_stats) { $bj_balance = $bj_stats->coin_won - $bj_stats->coin_lost; $out .= "\n\n" . emoji(0x1f0cf) . "*Blackjack* stats:" . "\n` `•` " . $bj_stats->games_played . "` games ever with `" . $bj_stats->wins . ":" . $bj_stats->losses . ":" . $bj_stats->draws . "` _(W:L:D)_" . "\n` `•` " . $bj_stats->hits . "` hits, `" . $bj_stats->stands . "` stands, `" . $bj_stats->surrenders . "` surrenders" . "\n` `•` " . $bj_stats->splits . "` splits, `" . $bj_stats->doubledowns . "` doubledowns, `" . $bj_stats->blackjacks . "` blackjacks" . "\n` `•` " . round($bj_stats->total_coin_bet, 2) . "`" . emoji(0x1f4b0) . " bet ever, currently " . ($bj_balance == 0 ? "breaking even at `" : ($bj_balance > 0 ? "up `" : "down `")) . round($bj_balance, 2) . "`" . emoji(0x1f4b0); } if ($cw_stats) { $cw_balance = $cw_stats->coin_won - $cw_stats->coin_lost; $out .= "\n\n" . emoji(0x1f0cf) . "*Casino war* stats:" . "\n` `•` " . $cw_stats->games_played . "` games ever with `" . $cw_stats->wins . ":" . $cw_stats->losses . "` _(W:L)_" . "\n` `•` " . $cw_stats->wars . "` wars and `" . $cw_stats->surrenders . "` surrenders." . "\n` `•` " . round($cw_stats->total_coin_bet, 2) . "`" . emoji(0x1f4b0) . " bet ever, currently " . ($cw_balance == 0 ? "breaking even at `" : ($cw_balance > 0 ? "up `" : "down `")) . round($cw_balance, 2) . "`" . emoji(0x1f4b0); } Telegram::talk($this->Message->Chat->id, $out); return true; }
public function main() { $jokes_file = file(__DIR__ . "/../Libraries/jokes_christmas"); $jokes = array(); $joke = ""; foreach ($jokes_file as $line) { if ($line == "\r\n") { $jokes[] = $joke; $joke = ""; continue; } $joke .= $line; } $out = $this->tree(15) . "\n"; $out .= $jokes[mt_rand(0, count($jokes) - 1)]; $out .= $this->santa(15); Telegram::talk($this->Message->Chat->id, $out); }
public function createAndSendRadarGIF($radar_code, $image_radius_code) { $radar_string = BoM::getBoMRadarString($radar_code, $image_radius_code); $web_image_paths = BoM::getRadarTransparencies($radar_code, $image_radius_code); $file_path = self::getNewLocalFilePath($web_image_paths); if (count($web_image_paths) < 2) { \GroupBot\Telegram::talk($this->chat_id, emoji(0x274c) . " Something went wrong getting the radar images fam. The radar might be down. Check here to see if it's working: \n \nhttp://www.bom.gov.au/products/" . $radar_string . ".loop.shtml#skip"); return false; } if (!$this->telegram->sendIfExists($file_path)) { \GroupBot\Telegram::sendChatSendingPhotoStatus($this->chat_id); ImageProcessing::createBackground($radar_string); $images = ImageProcessing::overlay($web_image_paths, $radar_string); ImageProcessing::animate($images, $file_path); $this->telegram->sendGIFThroughTelegram($file_path); } return true; }
public function t_wiki() { if (strlen($this->Message->text) == 0) { Telegram::talk($this->Message->Chat->id, ">not understanding wiki"); return 0; } $url = 'http://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exsentences=3&exintro=&explaintext=&exsectionformat=plain&titles='; $url .= urlencode($this->Message->text) . "&redirects="; $data = json_decode(file_get_contents($url)); $info = key($data->{'query'}->{'pages'}); if ($info == '-1') { Telegram::talk($this->Message->Chat->id, "doesn't exist, fam"); } else { $out = current($data->{'query'}->{'pages'})->{'extract'}; Telegram::talk($this->Message->Chat->id, $out); } return true; }
public function main() { if ($this->isParam() && $this->noParams() > 2) { $params = explode(' or ', $this->getAllParams()); if (count($params) > 1) { $decision = mt_rand(0, count($params) - 1); $out = emoji(0x1f44d) . " *" . $params[$decision] . "*"; Telegram::talk($this->Message->Chat->id, $out); return true; } } if (mt_rand(0, 1)) { $out = emoji(0x1f44d) . " *Yes!*"; } else { $out = emoji(0x1f44e) . " *No.*"; } Telegram::talk($this->Message->Chat->id, $out); return true; }
public function main() { $ribbon = emoji(0x1f380); $santa = emoji(0x1f385); $baub_yellow = emoji(0x1f315); $baub_black = emoji(0x1f311); $baub_red = emoji(0x1f534); $baub_blue = emoji(0x1f535); $out = ''; $out .= $santa . $santa . ".` `" . emoji(0x2b50) . "\n"; $out .= $santa . $santa . ".` `" . $this->tree(2) . "\n"; $out .= ".` `" . $this->tree(2) . $baub_blue . "\n"; $out .= ".` `" . $this->tree(1) . $baub_red . $this->tree(2) . "\n"; $out .= ".` `" . $this->tree(1) . $baub_yellow . $this->tree(1) . $baub_yellow . $this->tree(1) . "\n"; $out .= ".` `" . $this->tree(1) . $ribbon . $this->tree(2) . $ribbon . $this->tree(1) . "\n"; $out .= ".` `" . $this->tree(3) . $baub_red . $this->tree(1) . $baub_blue . $this->tree(1) . "\n"; $out .= ".``" . $this->tree(8) . "\n"; $out .= ".``" . $this->present(8) . "\n"; $out .= "*M E R R Y C H R I S T M A S*"; Telegram::talk($this->Message->Chat->id, $out); }
public function main() { Telegram::sendChatTypingStatus($this->Message->Chat->id); if ($this->isParam()) { if (in_array($this->getParam(), \GroupBot\Brains\Weather\Weather::$locations)) { $city = $this->getParam(); } else { Telegram::talk($this->Message->Chat->id, "I don't have that city on record, fam.\nTry an Australian capital city."); return false; } } else { $city = 'perth'; } $realtime = \GroupBot\Brains\Weather\Weather::realtime($city); $uv = \GroupBot\Brains\Weather\Weather::uv_index($city); $sunrise = \GroupBot\Brains\Weather\Weather::sunrise($city); $forecast = \GroupBot\Brains\Weather\Weather::forecast($city); $today = $forecast[Carbon::today()->format('l')]; $tomorrow = $forecast[Carbon::tomorrow()->format('l')]; $today_icon = \GroupBot\Brains\Weather\Weather::$icon_map[$today['forecast_icon_code']]; $tomorrow_icon = \GroupBot\Brains\Weather\Weather::$icon_map[$tomorrow['forecast_icon_code']]; $out = emoji(0x1f321) . " Weather for *" . $realtime->name . "*, *" . $realtime->state . "*." . "\n" . "\n" . emoji($today_icon) . " *Now:*" . "\n` `• It's currently *" . $realtime->air_temp . "°C*" . "\n` `• The UV index is at *" . $uv->value . "* ([" . $uv->description . "](http://www.arpansa.gov.au/uvindex/realtime/images//per_rt.gif))" . "\n" . "\n" . emoji($today_icon) . " *Today:*" . "\n` `• " . $today['forecast'] . "\n` `• Maximum of *" . $today['air_temperature_maximum'] . "°C*" . "\n` `• *" . $today['probability_of_precipitation'] . "* chance of rain" . "\n` `• Sunrise is at *{$sunrise->sunrise}* today, and sunset at *{$sunrise->sunset}*" . "\n" . "\n" . emoji($tomorrow_icon) . " *Tomorrow:*" . "\n` `• " . $tomorrow['forecast'] . "\n` `• Minimum of *" . $tomorrow['air_temperature_minimum'] . "°C*, maximum of *" . $tomorrow['air_temperature_maximum'] . "°C*" . "\n` `• *" . $tomorrow['probability_of_precipitation'] . "* chance of rain"; Telegram::talk($this->Message->Chat->id, $out, true); }
private function sed() { $s = explode('/', $this->Message->text); if (count($s) == 3 && $s[0] == 's') { if ($this->Message->MessageType == MessageType::Reply) { $out = preg_replace("/" . $s[1] . "/", $s[2], $this->Message->reply_to_message->text); if (strcmp($out, $this->Message->reply_to_message->text) === 0) { return false; } } else { $DbUser = new User($this->db); $last_message = $DbUser->getUserPostStatsInChat($this->Message->Chat, $this->Message->User)->lastpost; $out = preg_replace("/" . $s[1] . "/", $s[2], $last_message); if (strcmp($out, $last_message) === 0) { return false; } } Telegram::talk($this->Message->Chat->id, "*{$out}*"); return true; } return false; }
public function main() { if ($this->Message->Chat->isPrivate()) { $this->chat = NULL; } else { $this->chat = $this->Message->Chat; } if ($this->noParams() == 2) { if (strcmp($this->getParam(), '_view_chat') === 0) { $DbChat = new \GroupBot\Database\Chat($this->db); if ($this->chat = $DbChat->getChatById($this->getParam(1))) { $out = $this->displayLeaderboard(); $out .= $this->displayInstructions(); } else { $out = emoji(0x1f44e) . " Can't find that chat, displaying the Global Leaderboard instead.\n\n"; $this->chat = NULL; $out .= $this->displayLeaderboard(); $out .= $this->displayInstructions(); } } else { $out = $this->performVote(); //$out .= $this->displayLeaderboard(); $out .= $this->displayInstructions(); } } else { $out = $this->displayLeaderboard(); $out .= $this->displayInstructions(); } if ($this->Message->Chat->isPrivate()) { if ($this->Message->isCallback()) { Telegram::edit_inline_message($this->Message->Chat->id, $this->Message->message_id, $out, $this->keyboard); } else { Telegram::talk_inline_keyboard($this->Message->Chat->id, $out, $this->keyboard); } } else { Telegram::talk($this->Message->Chat->id, $out); } return true; }
public function q_person() { Telegram::talk($this->Message->Chat->id, person($this->Message->text, true)); }
public function main() { if (!$this->Message->Chat->isPrivate()) { $this->group_status(); Telegram::talk($this->Message->Chat->id, $this->out); return true; } $this->out = ''; if ($this->isParam()) { switch ($this->getParam()) { case 'name': $this->change_name(); break; case 'chat': if ($this->noParams() == 2) { $DbChat = new \GroupBot\Database\Chat($this->db); if ($this->chat = $DbChat->getChatById($this->getParam(1))) { $this->chat_options(false); break; } } $this->all_options(); break; case 'chatset': if ($this->noParams() == 4) { $DbChat = new \GroupBot\Database\Chat($this->db); if ($this->chat = $DbChat->getChatById($this->getParam(1))) { if ($this->set_option($this->getParam(2), $this->getParam(3))) { $this->chat_options(true); } else { $this->chat_options(false); } break; } } $this->all_options(); break; case 'yandex': break; default: $this->all_options(); } } else { $this->all_options(); } if ($this->Message->isCallback()) { Telegram::edit_inline_message($this->Message->Chat->id, $this->Message->message_id, $this->out, $this->keyboard); } else { Telegram::talk_inline_keyboard($this->Message->Chat->id, $this->out, $this->keyboard); } return true; }
public function t_bow() { Telegram::talk($this->Message->Chat->id, "*roaring applause*"); }