2017-06-30 11:25:56 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import os
|
|
|
|
|
|
|
|
import psycopg2
|
|
|
|
from psycopg2.extras import DictCursor
|
|
|
|
|
2017-08-22 15:43:48 +00:00
|
|
|
from . import Plugin, Bot
|
2017-06-30 11:25:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Storage(Plugin):
|
2017-08-22 15:43:48 +00:00
|
|
|
def __init__(self, bot: Bot):
|
2017-06-30 11:25:56 +00:00
|
|
|
super().__init__(bot)
|
2017-08-22 15:43:48 +00:00
|
|
|
self.bot.sql = self
|
2017-06-30 11:25:56 +00:00
|
|
|
self.con = psycopg2.connect(os.environ['DATABASE_URI'])
|
|
|
|
self.cur = self.con.cursor(cursor_factory=DictCursor)
|