I have created my own Telegram Bot using a python wrapper
- Search for
PrtPrmr_Bot
in your Telegram App on your mobile/windows/mac- Please replace
PrtPrmr_Bot
with your bot name if you are planning on replicating the code
- Please replace
- Start interacting with the Bot. It's that easy!
Definition and example of a word
- Command:
def
- Usage: /def word
- If an example for the word is available then the command returns an example as well
- Example:
- /def intense
- Definition: of extreme force, degree, or strength
Example: the job demands intense concentration
Weather for the given place
- Command:
w
- For the purpose of this, I have decided to use Dark Sky Weather API.
- Dark Sky API requires Latitude and Longitude
- In order to get the Latitude and Longitude, I am using Google's Geo-Coding API
- The place is passed to Google's Geo-Coding API, which returns Latitude and Longitude of the given place
- The Latitude and Longitude is then passed to Dark Sky Weather API to get the weather
- Added
InlineKeyboard
functionality to select Celsius and Fahrenheit units of temperature - Usage: /w place
- Example:
- /w boston
- Currently the temperature is 8°C
Summary: Mostly cloudy throughout the day.
Today it will vary from 8°C to 15°C
Get a random meme
- Usage: /ha | /haha | /hahaha
- Added a
regex
functionality to the command so you can useha
as a command as many times
- Added a
Get a random cute dog photo! <3 Aww!!!
- Usage: /aw | /aww | /awww
- Added a
regex
functionality, so that you can use the commandaw
with any numbers w follwingaw
- Added a
Get a random joke :D
- Command:
joke
- Usage: /joke
- Provides a random joke everytime
- Will add functionality to toggle
NSFW
feature
Handling Unknown Commands
- If a command is given which is currently not available, then you will get a reply Invalid Command
- Create a
credentials.py
file - Add variables in the
credentials.py
file:telegram_key
: Your Telegram Bot Tokendark_sky_key
: Dark Sky Weather APIgeocoding_key
: Google's Geo-Coding APIoxford_id
: Oxford Dictionary API IDoxford_key
: Oxford Dictionary API Key
- The script uses API from:
- Oxford Dictionary API - Requires Log In
- Dark Sky API - Requires Log In
- Google Geo-Coding API - Requires Log In
- meme api - Open Source
- dog api - Open Source
If you have any suggestions or just want to chat, feel free to reach me preetparmar@outlook.com