forked from serpis/pynik
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move bot configuration to environment variables
- Loading branch information
Showing
5 changed files
with
43 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.pyc | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# pynik | ||
|
||
A Python IRC bot. | ||
|
||
## Environment variables | ||
|
||
Configure your bot with environment variables: | ||
|
||
| Environment variable | Description | | ||
|------------------------|---------------------------------------------------| | ||
| SERVER | IRC server the bot should connect to. | | ||
| SERVER_PORT | IRC server port. | | ||
| NICK | Nickname of the bot. | | ||
| USERNAME | Username part of the bot hostmask. | | ||
| REALNAME | Real name of the bot. | | ||
| ADMINS | Nicknames with bot admin privileges. | | ||
| CHANNELS | Channels the bot should join on start. | | ||
|
||
If put the environment variables in a file named `.env`, you can use [Honcho] | ||
to start the bot. | ||
|
||
Install Honcho if you don't have it | ||
|
||
pip install honcho | ||
|
||
Start the bot | ||
|
||
honcho run python main.py | ||
|
||
[Honcho]: https://github.com/nickstenning/honcho |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
server_address = "port80.se.quakenet.org" | ||
server_port = 6667 | ||
import os | ||
|
||
nick = "CHANGEME" | ||
username = "CHANGEME" | ||
realname = "CHANGEME" | ||
server_address = os.environ['SERVER'] | ||
server_port = int(os.environ['SERVER_PORT']) | ||
nick = os.environ['NICK'] | ||
username = os.environ['USERNAME'] | ||
realname = os.environ['REALNAME'] | ||
admins = os.environ['ADMINS'].split(',') | ||
channels = os.environ['CHANNELS'].split(',') |