Skip to content

dziban303/dziwx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IRC weather bot for python2.7

Installation:

  1. Install python2.7: sudo apt install python2.7
  2. Install virtualenv: sudo apt install python-virtualenv
  3. Ensure libffi is installed: sudo apt install build-essential libssl-dev libffi-dev
  4. Create/go to virtual environment directory: mkdir ~/virtualenvironment | cd ~/virtualenvironment
  5. Clone repository: git clone https://github.com/dziban303/dziwx.git ~/virtualenvironment/dziwx
  6. Set up and activate virtualenv:
    virtualenv -p python2.7 ~/virtualenvironment/dziwx
    cd ~/virtualenvironment/dziwx/bin
    source activate
    cd ~/virtualenvironment/dziwx/pywx
  7. Install requirements.txt: pip install -r requirements.txt
  8. Edit config file with nano nano ~/virtualenvironment/dziwx/pywx/example_config.py:
    • forecast_io_secret = API key for forecast.io / darksky.com
    • host, port = IRC server and port
    • nick = bot's nickname
    • pass = bot's IRC password
    • chans = Channels to join. Must use preceeding #, e.g. "chans": ["#weather,#dziwx"],
    • redlink, youtube, imgur fields = API keys for optional features
    • leave other stuff alone
    • save and rename to local_config.py; in nano, save the file by typing Ctrl+O and then give it the new filename local_config.py when prompted.
  9. Test the bot: python pywx.py
  10. To quit: Ctrl-C terminates the bot and returns you to the shell.
  11. Create a shell script to run the bot: nano ~/dziwx.sh
    #!/bin/bash
    cd ~/virtualenvironment/dziwx/bin
    source activate
    cd ~/virtualenvironment/dziwx/pywx
    python2 pywx.py &
  12. Make script executable: sudo chmod 777 ~/dziwx.sh | sudo cp dziwx.sh /usr/local/bin/dziwx.sh
    • The bot can now be launched by typing dziwx.sh

Notes:

  • To add/edit acronyms for the define command, edit acro.json
  • To add/edit airports, edit airports.dat
  • To join password-protected channels, enter the password after the channel name in the "chans" field
  • To join multiple servers:
    • Copy local_config.py to new_config.py or whatever you want to call it, and populate it with the new server info
    • Copy pywx.py, name it pywx2.py or whatever you want to call it, and change the line therein from from local_config import config to from new_config import config replacing new_config with whatever your config file is named
    • Run python pywx2.py
    • Simultaneous use: python pywx.py & python pywx2.py && fg

Airports.dat formatting:

The airports.dat file is from the OpenFlights database. More info can be found here.

  • Fields: airport_id,name,city,country,faa,icao,lat,long,alt,tz,dst
    • Airport_id is a unique identifier. When adding new airports, just use a sequential number.
    • Name is the common name of the airport.
    • City and country are difficult concepts to explain so I will just hope you know what they are.
    • The FAA code is a three-to-five alphanumeric code unique to the airport; in many cases it is identical to the IATA code.
    • The ICAO code is yet another unique identifier, and consists of a four-letter code. (For more on these codes, see this wikipedia page
    • Latitude and longitude are the airport's coördinates.
    • Altitude is the airport's height above sea level, in feet.
    • Tz is the standard time timezone offset from UTC; e.g., Eastern Standard Time is UTC-5, so -5 is entered, while Japan Standard Time is UTC+9, so +9 is used.
    • Dst indicates when Daylight Saving Time (or Summer Time) is used: Use E (Europe), A (US/Canada), S (South America), O (Australia), Z (New Zealand), N (None) or U (Unknown).

About

GitHub repository for dziwx.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages