diff options
| author | jason | 2012-08-11 11:10:36 -0600 |
|---|---|---|
| committer | jason | 2012-08-11 11:10:36 -0600 |
| commit | 2ad5e43a3005736b012cbb018116c78fba607185 (patch) | |
| tree | 80cba44583f6999910b8f4673c5ac6981b3fe13c | |
| parent | ba7d6e1cb4a6869a5bf4437576db91af28fac229 (diff) | |
| download | warmachine-2ad5e43a3005736b012cbb018116c78fba607185.tar.gz warmachine-2ad5e43a3005736b012cbb018116c78fba607185.zip | |
create a settings db and tables.
| -rw-r--r-- | settings.py | 2 | ||||
| -rwxr-xr-x | warmachine | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/settings.py b/settings.py index f0c930e..bdb1e17 100644 --- a/settings.py +++ b/settings.py | |||
| @@ -15,6 +15,8 @@ CHANNELS = ('#warmachine-dev',) | |||
| 15 | 15 | ||
| 16 | ADMINS = ('com4',) | 16 | ADMINS = ('com4',) |
| 17 | 17 | ||
| 18 | DB_PATH = "warmachine.db" | ||
| 19 | |||
| 18 | ACTIONS = ( | 20 | ACTIONS = ( |
| 19 | 'wmd.actions.passive.nickserv.IdentWithNickserv', | 21 | 'wmd.actions.passive.nickserv.IdentWithNickserv', |
| 20 | 'wmd.actions.passive.pong.RespondToPing', | 22 | 'wmd.actions.passive.pong.RespondToPing', |
| @@ -1,8 +1,33 @@ | |||
| 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
| 2 | import sqlite3 | ||
| 3 | |||
| 2 | from wmd.irc import IRC | 4 | from wmd.irc import IRC |
| 3 | import settings | 5 | import settings |
| 4 | 6 | ||
| 5 | if __name__ == '__main__': | 7 | if __name__ == '__main__': |
| 8 | connection = sqlite3.connect(settings.DB_PATH) | ||
| 9 | c = connection.cursor() | ||
| 10 | |||
| 11 | # check to see if a table exists | ||
| 12 | is_installed = bool(c.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='warmachine_settings'").fetchone()) | ||
| 13 | print is_installed | ||
| 14 | if not is_installed: | ||
| 15 | c.execute("""CREATE TABLE warmachine_settings ( | ||
| 16 | key text, | ||
| 17 | value text, | ||
| 18 | plugin text, | ||
| 19 | primary key (key, plugin) | ||
| 20 | ); | ||
| 21 | """) | ||
| 22 | c.execute("""CREATE TABLE warmachine_plugins ( | ||
| 23 | id text, | ||
| 24 | name text, | ||
| 25 | description text, | ||
| 26 | is_active int, | ||
| 27 | primary key (id) | ||
| 28 | ); | ||
| 29 | """) | ||
| 30 | |||
| 6 | i = IRC(settings.SERVER, settings.NICKNAME, settings.IDENT, settings.PORT) | 31 | i = IRC(settings.SERVER, settings.NICKNAME, settings.IDENT, settings.PORT) |
| 7 | i.connect() | 32 | i.connect() |
| 8 | for channel in settings.CHANNELS: | 33 | for channel in settings.CHANNELS: |