#!/usr/bin/env python3

# http://inamidst.com/saxo/
# Created by Sean B. Palmer

import os
import saxo

@saxo.command(authorised=True, private=True)
def private_channel(arg):
    path = os.path.join(saxo.env("base"), "database.sqlite3")
    with saxo.database(path) as db:
        if "saxo_private" in db:
            command = "INSERT OR REPLACE INTO saxo_private" + \
                      " (channel) VALUES(?)"
            db.execute(command, arg)
            db.commit()
            return "Set %s as private" % arg
