19 lines
473 B
Python
19 lines
473 B
Python
# -*- 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'])
|
|
# Create database cursor (with dict factory to access rows by name)
|
|
self.cur = self.con.cursor(cursor_factory=DictCursor)
|