2017-06-30 11:25:56 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
|
|
|
|
|
|
import irc3
|
|
|
|
import psycopg2
|
|
|
|
from psycopg2.extras import DictCursor
|
|
|
|
|
|
|
|
from . import Plugin
|
|
|
|
|
|
|
|
|
|
|
|
@irc3.plugin
|
|
|
|
class Storage(Plugin):
|
|
|
|
def __init__(self, bot: irc3.IrcBot):
|
|
|
|
super().__init__(bot)
|
|
|
|
# Create database connection
|
|
|
|
self.con = psycopg2.connect(os.environ['DATABASE_URI'])
|
2017-07-04 13:22:20 +00:00
|
|
|
# Create database cursor (with dict factory to access rows by name)
|
2017-06-30 11:25:56 +00:00
|
|
|
self.cur = self.con.cursor(cursor_factory=DictCursor)
|