Some refactoring, pgsql follows...soon™
This commit is contained in:
parent
e69307283d
commit
d1911ca4f2
|
@ -19,7 +19,15 @@ class Plugin(BasePlugin):
|
||||||
|
|
||||||
|
|
||||||
class DatabasePlugin(Plugin):
|
class DatabasePlugin(Plugin):
|
||||||
|
# @property
|
||||||
|
# def con(self):
|
||||||
|
# return self.bot.con
|
||||||
|
#
|
||||||
|
# @property
|
||||||
|
# def cur(self):
|
||||||
|
# return self.bot.cur
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
super().__init__(bot)
|
super().__init__(bot)
|
||||||
self.con = bot.con.db
|
self.con = bot.con.db
|
||||||
self.cur = self.con.cursor()
|
self.cur = bot.con.cur
|
||||||
|
|
|
@ -9,7 +9,7 @@ from . import MODULE, Plugin
|
||||||
|
|
||||||
|
|
||||||
@command(permission='admin', show_in_help_list=False)
|
@command(permission='admin', show_in_help_list=False)
|
||||||
def reload(bot: irc3.IrcBot, mask: IrcString, channel: IrcString,
|
def reload(bot: irc3.IrcBot, mask: IrcString, target: IrcString,
|
||||||
args: DocoptDict):
|
args: DocoptDict):
|
||||||
"""Reloads a plugin or the whole bot
|
"""Reloads a plugin or the whole bot
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ def reload(bot: irc3.IrcBot, mask: IrcString, channel: IrcString,
|
||||||
plugin = args.get('<plugin>')
|
plugin = args.get('<plugin>')
|
||||||
if plugin:
|
if plugin:
|
||||||
bot.reload('{module}.{plugin}'.format(plugin=plugin, module=MODULE))
|
bot.reload('{module}.{plugin}'.format(plugin=plugin, module=MODULE))
|
||||||
bot.privmsg(channel, 'Reloaded plugin "{}"'.format(plugin))
|
bot.privmsg(target, 'Reloaded plugin "{}"'.format(plugin))
|
||||||
else:
|
else:
|
||||||
bot.reload()
|
bot.reload()
|
||||||
bot.privmsg(channel, 'Reloaded the bot')
|
bot.privmsg(target, 'Reloaded the bot')
|
||||||
|
|
||||||
|
|
||||||
@irc3.plugin
|
@irc3.plugin
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Coins(Plugin):
|
||||||
requires = ['irc3.plugins.command']
|
requires = ['irc3.plugins.command']
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def btc(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def btc(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Gets the Bitcoin values from BitStamp.
|
"""Gets the Bitcoin values from BitStamp.
|
||||||
|
|
||||||
%%btc
|
%%btc
|
||||||
|
@ -28,7 +28,7 @@ class Coins(Plugin):
|
||||||
'Volume: \x02฿{volume:,.2f}\x02'.format(**values)
|
'Volume: \x02฿{volume:,.2f}\x02'.format(**values)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def eth(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def eth(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Gets the Ethereum values from etherscan.io.
|
"""Gets the Ethereum values from etherscan.io.
|
||||||
|
|
||||||
%%eth
|
%%eth
|
||||||
|
|
|
@ -37,7 +37,7 @@ class CTCP(Plugin):
|
||||||
return self._ctcp(name, nick, reply)
|
return self._ctcp(name, nick, reply)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
async def ping(self, mask: IrcString, channel: IrcString,
|
async def ping(self, mask: IrcString, target: IrcString,
|
||||||
args: DocOptDict):
|
args: DocOptDict):
|
||||||
"""Sends ping via CTCP to user and sends the time needed
|
"""Sends ping via CTCP to user and sends the time needed
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class CTCP(Plugin):
|
||||||
return self._ctcp('PING', nick, reply)
|
return self._ctcp('PING', nick, reply)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
async def finger(self, mask: IrcString, channel: IrcString,
|
async def finger(self, mask: IrcString, target: IrcString,
|
||||||
args: DocOptDict):
|
args: DocOptDict):
|
||||||
"""Gets the client response for finger nick user via CTCP
|
"""Gets the client response for finger nick user via CTCP
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class CTCP(Plugin):
|
||||||
return await self.ctcp('FINGER', mask, args)
|
return await self.ctcp('FINGER', mask, args)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
async def time(self, mask: IrcString, channel: IrcString,
|
async def time(self, mask: IrcString, target: IrcString,
|
||||||
args: DocOptDict):
|
args: DocOptDict):
|
||||||
"""Gets the client time from nick via CTCP
|
"""Gets the client time from nick via CTCP
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ class CTCP(Plugin):
|
||||||
return await self.ctcp('TIME', mask, args)
|
return await self.ctcp('TIME', mask, args)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
async def ver(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
async def ver(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Gets the client version from nick via CTCP
|
"""Gets the client version from nick via CTCP
|
||||||
|
|
||||||
%%ver [<nick>]
|
%%ver [<nick>]
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import sqlite3
|
import os
|
||||||
|
|
||||||
import irc3
|
import irc3
|
||||||
|
import psycopg2
|
||||||
|
from psycopg2.extras import DictCursor
|
||||||
|
|
||||||
from . import Plugin
|
from . import Plugin
|
||||||
|
|
||||||
|
@ -10,13 +12,6 @@ from . import Plugin
|
||||||
class Database(Plugin):
|
class Database(Plugin):
|
||||||
def __init__(self, bot: irc3.IrcBot):
|
def __init__(self, bot: irc3.IrcBot):
|
||||||
super().__init__(bot)
|
super().__init__(bot)
|
||||||
file = bot.config.storage.split('sqlite://', 1)[1]
|
self.db = psycopg2.connect(os.environ['DATABASE_URI'])
|
||||||
if not file:
|
self.cur = self.db.cursor(cursor_factory=DictCursor)
|
||||||
raise ValueError('Invalid database: {}'.format(bot.config.storage))
|
|
||||||
# @formatter:off
|
|
||||||
self.db = sqlite3.connect(file, detect_types=sqlite3.PARSE_DECLTYPES
|
|
||||||
| sqlite3.PARSE_COLNAMES)
|
|
||||||
# @formatter:on
|
|
||||||
self.db.row_factory = sqlite3.Row
|
|
||||||
self.bot = bot
|
|
||||||
self.bot.con = self
|
self.bot.con = self
|
||||||
|
|
|
@ -21,19 +21,19 @@ GNU_LINUX = """I'd Just Like To Interject For A Moment. What you're referring
|
||||||
class Linux(Plugin):
|
class Linux(Plugin):
|
||||||
KERNEL_FEED = 'https://www.kernel.org/feeds/kdist.xml'
|
KERNEL_FEED = 'https://www.kernel.org/feeds/kdist.xml'
|
||||||
|
|
||||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :.*(debian|apt|dpkg).*')
|
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :.*(debian|apt|dpkg).*')
|
||||||
def debillian(self, channel: str):
|
def debillian(self, target: str):
|
||||||
if random.randint(0, 3) is 0:
|
if random.randint(0, 12) is 0:
|
||||||
self.bot.privmsg(channel, 'REEEEEEEEEEEEEEEEEEEEEEEEEEEEE')
|
self.bot.privmsg(target, 'REEEEEEEEEEEEEEEEEEEEEEEEEEEEE')
|
||||||
|
|
||||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :'
|
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :'
|
||||||
r'.*(?<!gnu[/+])linux(?! kernel).*')
|
r'.*(?<!gnu[/+])linux(?! kernel).*')
|
||||||
def linux(self, channel: str):
|
def linux(self, target: str):
|
||||||
if random.randint(0, 3) is 0:
|
if random.randint(0, 12) is 0:
|
||||||
self.bot.privmsg(channel, GNU_LINUX)
|
self.bot.privmsg(target, GNU_LINUX)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def kernel(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def kernel(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Get Linux kernel releases.
|
"""Get Linux kernel releases.
|
||||||
|
|
||||||
%%kernel
|
%%kernel
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Urban(Plugin):
|
||||||
URL = 'https://api.urbandictionary.com/v0/define'
|
URL = 'https://api.urbandictionary.com/v0/define'
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def ud(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def ud(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Searches for a term on YouTube and returns first result.
|
"""Searches for a term on YouTube and returns first result.
|
||||||
|
|
||||||
%%ud <term>...
|
%%ud <term>...
|
||||||
|
|
|
@ -16,39 +16,39 @@ RAINBOW_LEN = len(RAINBOW)
|
||||||
class Useless(Plugin):
|
class Useless(Plugin):
|
||||||
requires = ['irc3.plugins.command']
|
requires = ['irc3.plugins.command']
|
||||||
|
|
||||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :(?P<msg>huehuehue)$')
|
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :(?P<msg>huehuehue)$')
|
||||||
def huehuehue(self, channel: str, msg: str):
|
def huehuehue(self, target: str, msg: str):
|
||||||
"""Returns a huehuehue when someone writes it."""
|
"""Returns a huehuehue when someone writes it."""
|
||||||
self.bot.privmsg(channel, msg)
|
self.bot.privmsg(target, msg)
|
||||||
|
|
||||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :reeeeee$')
|
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :reeeeee$')
|
||||||
def reeeeee(self, channel: str):
|
def reeeeee(self, target: str):
|
||||||
"""Returns a REEEE."""
|
"""Returns a REEEE."""
|
||||||
self.bot.privmsg(channel, 'REEEEEEEEEEEEEEEEEEEEEEEEEEEE')
|
self.bot.privmsg(target, 'REEEEEEEEEEEEEEEEEEEEEEEEEEEE')
|
||||||
|
|
||||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :same$')
|
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :same$')
|
||||||
def same(self, channel: str):
|
def same(self, target: str):
|
||||||
"""Returns a plain same when a user writes same."""
|
"""Returns a plain same when a user writes same."""
|
||||||
self.bot.privmsg(channel, 'same')
|
self.bot.privmsg(target, 'same')
|
||||||
|
|
||||||
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<channel>\S+) :\[(?P<msg>.*)\]$')
|
@irc3.event(r'(?i)^:\S+ PRIVMSG (?P<target>\S+) :\[(?P<msg>.*)\]$')
|
||||||
def intensifies(self, channel: str, msg: str):
|
def intensifies(self, target: str, msg: str):
|
||||||
"""String with brackets around will be returned with INTENSIFIES."""
|
"""String with brackets around will be returned with INTENSIFIES."""
|
||||||
self.bot.privmsg(channel, '\x02[{msg} INTENSIFIES]'.format(
|
self.bot.privmsg(target, '\x02[{msg} INTENSIFIES]'.format(
|
||||||
msg=msg.upper()))
|
msg=msg.upper()))
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def storyofpomfface(self, mask: IrcString, channel: IrcString,
|
def storyofpomfface(self, mask: IrcString, target: IrcString,
|
||||||
args: DocOptDict):
|
args: DocOptDict):
|
||||||
"""Story of pomf face.
|
"""Story of pomf face.
|
||||||
|
|
||||||
%%storyofpomfface
|
%%storyofpomfface
|
||||||
"""
|
"""
|
||||||
for face in (':O C==3', ':OC==3', ':C==3', ':C=3', ':C3', ':3'):
|
for face in (':O C==3', ':OC==3', ':C==3', ':C=3', ':C3', ':3'):
|
||||||
self.bot.privmsg(channel, face)
|
self.bot.privmsg(target, face)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def choose(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def choose(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Decides between items separated by comma.
|
"""Decides between items separated by comma.
|
||||||
|
|
||||||
%%choose <items>...
|
%%choose <items>...
|
||||||
|
@ -58,7 +58,7 @@ class Useless(Plugin):
|
||||||
choice=choice.strip())
|
choice=choice.strip())
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def jn(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def jn(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Decides between yes and no (for a question).
|
"""Decides between yes and no (for a question).
|
||||||
|
|
||||||
%%jn <question>
|
%%jn <question>
|
||||||
|
@ -69,7 +69,7 @@ class Useless(Plugin):
|
||||||
choice=choice)
|
choice=choice)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def kiss(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def kiss(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Kisses a user.
|
"""Kisses a user.
|
||||||
|
|
||||||
%%kiss <nick>
|
%%kiss <nick>
|
||||||
|
@ -78,7 +78,7 @@ class Useless(Plugin):
|
||||||
nick=args['<nick>'])
|
nick=args['<nick>'])
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def hug(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def hug(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Hugs a user.
|
"""Hugs a user.
|
||||||
|
|
||||||
%%hug <nick>
|
%%hug <nick>
|
||||||
|
@ -86,42 +86,42 @@ class Useless(Plugin):
|
||||||
return '\x034♥♡❤♡♥\x03 {nick} \x034♥♡❤♡♥'.format(nick=args['<nick>'])
|
return '\x034♥♡❤♡♥\x03 {nick} \x034♥♡❤♡♥'.format(nick=args['<nick>'])
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def bier(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def bier(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Gives nick a beer.
|
"""Gives nick a beer.
|
||||||
|
|
||||||
%%bier [<nick>]
|
%%bier [<nick>]
|
||||||
"""
|
"""
|
||||||
self.bot.action(channel, 'schenkt ein kühles blondes an {nick} aus.'
|
self.bot.action(target, 'schenkt ein kühles blondes an {nick} aus.'
|
||||||
.format(nick=args.get('<nick>') or mask.nick))
|
.format(nick=args.get('<nick>') or mask.nick))
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def fucken(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def fucken(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Kills and fucks a nick.
|
"""Kills and fucks a nick.
|
||||||
|
|
||||||
%%fucken [<nick>]
|
%%fucken [<nick>]
|
||||||
"""
|
"""
|
||||||
self.bot.action(channel, 'fuckt {nick} und tötet {nick} anschließend.'
|
self.bot.action(target, 'fuckt {nick} und tötet {nick} anschließend.'
|
||||||
.format(nick=args.get('<nick>') or mask.nick))
|
.format(nick=args.get('<nick>') or mask.nick))
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def anhero(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def anhero(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Kicks a nick.
|
"""Kicks a nick.
|
||||||
|
|
||||||
%%anhero
|
%%anhero
|
||||||
"""
|
"""
|
||||||
self.bot.privmsg(channel, 'Sayonara bonzai-chan...')
|
self.bot.privmsg(target, 'Sayonara bonzai-chan...')
|
||||||
self.bot.kick(channel, mask.nick)
|
self.bot.kick(target, mask.nick)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def sudoku(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def sudoku(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Kicks a nick.
|
"""Kicks a nick.
|
||||||
|
|
||||||
%%sudoku
|
%%sudoku
|
||||||
"""
|
"""
|
||||||
self.anhero(mask, channel, args)
|
self.anhero(mask, target, args)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def hack(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def hack(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Hacks (a user).
|
"""Hacks (a user).
|
||||||
|
|
||||||
%%hack [<nick>]
|
%%hack [<nick>]
|
||||||
|
@ -130,15 +130,15 @@ class Useless(Plugin):
|
||||||
return 'hacking{nick}...'.format(nick=' %s' % nick if nick else '')
|
return 'hacking{nick}...'.format(nick=' %s' % nick if nick else '')
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def gay(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def gay(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Make someone gay (alias to rainbow)
|
"""Make someone gay (alias to rainbow)
|
||||||
|
|
||||||
%%gay <word>...
|
%%gay <word>...
|
||||||
"""
|
"""
|
||||||
return self.rainbow(mask, channel, args)
|
return self.rainbow(mask, target, args)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def rainbow(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def rainbow(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Colorize a word in rainbow colors.
|
"""Colorize a word in rainbow colors.
|
||||||
|
|
||||||
%%rainbow <word>...
|
%%rainbow <word>...
|
||||||
|
@ -153,7 +153,7 @@ class Useless(Plugin):
|
||||||
return ''.join(word)
|
return ''.join(word)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def wrainbow(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def wrainbow(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Colorize words in a sentence with rainbow colors.
|
"""Colorize words in a sentence with rainbow colors.
|
||||||
|
|
||||||
%%wrainbow <words>...
|
%%wrainbow <words>...
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Weather(Plugin):
|
||||||
'(select woeid from geo.places(1) where text="{}")'
|
'(select woeid from geo.places(1) where text="{}")'
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def weather(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def weather(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Gets the weather from Yahoo weather API.
|
"""Gets the weather from Yahoo weather API.
|
||||||
|
|
||||||
%%weather <location>...
|
%%weather <location>...
|
||||||
|
|
|
@ -12,7 +12,6 @@ from . import Plugin
|
||||||
from ..utils import date_from_iso
|
from ..utils import date_from_iso
|
||||||
|
|
||||||
|
|
||||||
# TODO: write better code lol
|
|
||||||
@irc3.plugin
|
@irc3.plugin
|
||||||
class YouTube(Plugin):
|
class YouTube(Plugin):
|
||||||
requires = ['irc3.plugins.command']
|
requires = ['irc3.plugins.command']
|
||||||
|
@ -61,7 +60,7 @@ class YouTube(Plugin):
|
||||||
self.bot.privmsg(target, data)
|
self.bot.privmsg(target, data)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
def yt(self, mask: IrcString, channel: IrcString, args: DocOptDict):
|
def yt(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
"""Searches for query on YouTube and returns first result.
|
"""Searches for query on YouTube and returns first result.
|
||||||
|
|
||||||
%%yt <query>...
|
%%yt <query>...
|
||||||
|
|
2
repl.py
2
repl.py
|
@ -5,9 +5,9 @@ import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
|
# noinspection PyPackageRequirements
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
pp = pprint
|
pp = pprint
|
||||||
|
|
||||||
load_dotenv('.env')
|
load_dotenv('.env')
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,4 @@ aiocron==0.6
|
||||||
requests==2.14.2
|
requests==2.14.2
|
||||||
feedparser==5.2.1
|
feedparser==5.2.1
|
||||||
python_dotenv==0.6.4
|
python_dotenv==0.6.4
|
||||||
|
psycopg2==2.7.1
|
||||||
|
|
58
schema.sql
58
schema.sql
|
@ -1,47 +1,47 @@
|
||||||
create table if not exists quotes (
|
create table if not exists quotes (
|
||||||
id integer primary key autoincrement,
|
id serial primary key,
|
||||||
nick text not null collate nocase,
|
nick varchar(30) not null,
|
||||||
item text not null collate nocase,
|
item text not null,
|
||||||
unique (nick, item)
|
unique (nick, item)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists mcmaniacs (
|
create table if not exists mcmaniacs (
|
||||||
id integer primary key autoincrement,
|
id serial primary key,
|
||||||
item text not null collate nocase,
|
item text not null,
|
||||||
unique (item) on conflict replace
|
unique (item)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists timers (
|
create table if not exists timers (
|
||||||
id integer primary key autoincrement,
|
id serial primary key,
|
||||||
mask text not null,
|
nick varchar(30) not null,
|
||||||
channel text not null,
|
channel varchar(32) not null,
|
||||||
message text not null,
|
message text not null,
|
||||||
delay text not null,
|
delay varchar(10) not null,
|
||||||
until timestamp not null,
|
ends_at timestamp not null,
|
||||||
created timestamp not null default current_timestamp
|
created_at timestamp not null default current_timestamp
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists tells (
|
create table if not exists tells (
|
||||||
id integer primary key autoincrement,
|
id serial primary key,
|
||||||
from_user text not null,
|
from_nick varchar(30) not null,
|
||||||
to_user text not null,
|
to_nick varchar(30) not null,
|
||||||
message text not null,
|
message text not null,
|
||||||
created timestamp not null default current_timestamp,
|
created_at timestamp not null default current_timestamp,
|
||||||
unique (to_user, message)
|
unique (to_nick, message)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists seens (
|
create table if not exists seens (
|
||||||
id integer primary key autoincrement,
|
id serial primary key,
|
||||||
nick text not null collate nocase,
|
nick varchar(30) not null,
|
||||||
channel text not null collate nocase,
|
channel varchar(32) not null,
|
||||||
message text not null,
|
message text not null,
|
||||||
last_seen timestamp not null,
|
seen_at timestamp not null,
|
||||||
unique (nick) on conflict replace
|
unique (nick)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists owes (
|
create table if not exists owes (
|
||||||
id integer primary key autoincrement,
|
id serial primary key,
|
||||||
nick text not null collate nocase,
|
nick varchar(30) not null,
|
||||||
amount integer not null,
|
amount integer not null,
|
||||||
unique (nick) on conflict ignore
|
unique (nick)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user