Skip to content

Instantly share code, notes, and snippets.

@tanftw
Last active November 10, 2016 18:42
Show Gist options
  • Save tanftw/52663a467585c950f236dcfbc2da1dfb to your computer and use it in GitHub Desktop.
Save tanftw/52663a467585c950f236dcfbc2da1dfb to your computer and use it in GitHub Desktop.
Weather Intended Actions
<?php
// Matches with 'weather + anything'
$bot->answer('weather%', function ($bot, $user_id, $input)
{
$city = ltrim($input, 'weather');
// Pseudo code to get weather from database
$weather = DB::getWeather($city);
// Response User
return "Weather in {$city} is {$weather}";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment