nxy/bot/storage.py
2017-08-22 17:43:48 +02:00

16 lines
360 B
Python

# -*- coding: utf-8 -*-
import os
import psycopg2
from psycopg2.extras import DictCursor
from . import Plugin, Bot
class Storage(Plugin):
def __init__(self, bot: Bot):
super().__init__(bot)
self.bot.sql = self
self.con = psycopg2.connect(os.environ['DATABASE_URI'])
self.cur = self.con.cursor(cursor_factory=DictCursor)